Home
Softono
n8n_ai_video_generator

n8n_ai_video_generator

Open source
48
Stars
15
Forks
0
Issues
0
Watchers
10 months
Last Commit

About n8n_ai_video_generator

n8n AI Video Generator is an automated workflow for creating AI videos using Google Veo 3, managing file storage, and logging results. The system operates on a scheduled trigger to generate fresh video concepts. An AI Idea Generator creates a creative brief, which feeds into a Video Prompt Generator to craft a detailed prompt for the Veo 3 model. The workflow then executes a series of HTTP requests to the Google AI API to submit the generation task, monitor its status, and handle long-running operations until completion. Once finished, the process retrieves the video file via a secure download, dynamically naming the file by truncating the video caption for clarity. The generated video is uploaded to a designated Google Drive folder and shared to ensure accessibility. Finally, the workflow records the file link and metadata in Google Sheets for tracking and management. Setup requires a Google AI Pro subscription, an API key from Google AI Studio, and OAuth credentials for Google Drive and Sheets integration.

Platforms

Web Self-hosted

Links

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