Skip to content

Natan-Asrat/n8n_ai_video_generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

N8N VEO Video Generator

  • Scheduled to create AI videos using Veo3, save video file on Google Drive and update Google Sheets about the new video created.
  • You can check it out by importing Veo3_Video_Generator.json into n8n.

Output

Output

  • It has successfully generated the video, saved the video file in google drive, and updated the google sheets with the link to the file.

Nodes

nodes

  • Trigger
    • Schedule Trigger
  • AI Agent
    • Idea Generator
    • Video Prompt Generator
  • Http Request Nodes
    • Create Video
    • Check Completion
    • Download Video
  • Google Drive
    • Upload file
    • Share file
  • Set, Wait, If nodes

Steps

  • Create a trigger node.

    trigger

  • Attach an AI Agent node that will act as an Idea Generator with Structured Output Parser and Think Tool.

    idea generator

  • Attach another AI Agent node that will generate the video prompt.

    video prompt

    output

  • Go to Google One -> Google AI to start your Google AI Pro subscription free trial which will give you access to Veo 3 in Gemini.

  • Go to Google AI studio to create your API key, and also to Google Cloud Console to enable Billing.

  • Attach an Http Request node after the Video Prompt Generator node and use the Gemini API documentation to find the Endpoints so choose REST among the options (python, javascript ...) and copy the curl command to import into the Http Request node. Don't forget to turn on Expression for the body instead of sending fixed since {{ JSON.stringify($json.output) }} should be parsed.

    doc

    curl -s "https://generativelanguage.googleapis.com/v1beta/models/veo-3.0-generate-preview:predictLongRunning" \
    -H "x-goog-api-key: YOUR_API_KEY_HERE" \
    -H "Content-Type: application/json" \
    -X POST \
    -d '{
    "instances": [
      {
        "prompt": {{ JSON.stringify($json.output) }}
      }
    ]
    }'
    

    create video request

  • Check completion by sending a get request using the operation name from the response of the post request which will be in {{ $json.name }}.

    curl -s -H "x-goog-api-key: YOUR_API_KEY_HERE" \
    "https://generativelanguage.googleapis.com/v1beta/{{ $json.name }}"
    
    

    check completion

  • After the get request node, check if {{ $json.done }} is true using an If node.

    if

  • If completed (true branch), you need to download the video file so attach another Http Request node with a Get request to a URL provided by the Check completion node.

    download1

    • But before downloading the file, in order to name it properly, attach a Set node that adds a fileName field in the data by slicing the caption to a maximum of 50 characters.

    file name

    • Then use the file name by adding response option to the Download node and apply file name in Put Output in Field field.

    • Allow Redirects option as adviced by the Gemini Api documentation.

    download2

  • After receiving the file, you now have to save it in Google Drive

    • Get your OAuth credentials by enabling Google Drive Api in Google Cloud Console and create or use your existing credentials.
    • You will use a Upload file node from Google Drive. Create a folder that you wish to save the videos in and select the folder.

    save

    saved

  • In order to actually save the link for the file in a google sheet and later have no issues with permissions, you have to share the file or make it publicly accessible by it's link. Add a Share file node from Google Drive and add permission Reader for Anyone.

    share

  • Create a new google sheet and add a google sheet Append Row node to save the Google Drive URL (webViewLink) and other information about the video.

    new sheet

    sheets node

    sheet node

  • However, if the file is not ready and $json.done is false, you should add a Wait node for the false branch of the If node which then loops back to the Check completion node.

    wait

    waiting

Contact

About

N8N AI Video Generator | Veo 3 | Idea Generator Agent | Video Prompt Generator Agent | Google Drive | Google Sheets

Topics

Resources

Stars

48 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors