🎬 Bulk AI video generation with Freepik Minimax Hailuo & Google Suite integration

3,271 views · 🎬 Content Creation & Video

Description

This n8n workflow automates bulk AI video generation using Freepik’s Image-to-Video API powered by Minimax Hailuo-02-768p. It reads video prompts from a Google Sheet, generates multiple variations of each video using Freepik’s AI, handles asynchronous video processing with intelligent polling, and automatically uploads completed videos to Google Drive with organized file names. This is perfect for content creators, marketers, or video producers who need to generate multiple AI videos in bulk and store them systematically.

Key Features:

Step-by-Step Implementation Guide

Prerequisites

Before setting up this workflow, you’ll need:

  1. n8n instance (cloud or self-hosted)
  2. Freepik API account with Video Generation access
  3. Google account with access to Sheets and Drive
  4. Google Sheet with your video prompts

Step 1: Set Up Freepik API Credentials

  1. Go to Freepik API Developer Portal
  2. Create an account or sign in
  3. Navigate to your API dashboard
  4. Generate an API key with Video Generation permissions
  5. Copy the API key and save it securely
  6. In n8n, go to CredentialsAdd CredentialHTTP Header Auth
  7. Configure as follows:
    • Name: “Header Auth account”
    • Header Name: x-freepik-api-key
    • Header Value: Your Freepik API key

Step 2: Set Up Google Credentials

Google Sheets Access:

  1. Go to Google Cloud Console
  2. Create a new project or select existing one
  3. Enable Google Sheets API
  4. Create OAuth2 credentials
  5. In n8n, go to CredentialsAdd CredentialGoogle Sheets OAuth2 API
  6. Enter your OAuth2 credentials and authorize with spreadsheets.readonly scope

Google Drive Access:

  1. In Google Cloud Console, enable Google Drive API
  2. In n8n, go to CredentialsAdd CredentialGoogle Drive OAuth2 API
  3. Enter your OAuth2 credentials and authorize

Step 3: Create Your Google Sheet

  1. Create a new Google Sheet: sheets.google.com
  2. Set up your sheet with these columns:
    • Column A: Prompt (your video generation prompts)
    • Column B: Name (identifier for file naming)
  3. Example data:
    | Prompt                                          | Name          |
    |-------------------------------------------------|---------------|
    | A butterfly landing on a flower in slow motion | butterfly-01  |
    | Ocean waves crashing on rocky coastline        | ocean-waves   |
    | Time-lapse of clouds moving across blue sky    | clouds-timelapse |
  4. Copy the Sheet ID from the URL (the long string between /d/ and /edit)

Step 4: Set Up Google Drive Folder

  1. Create a folder in Google Drive for your generated videos
  2. Copy the Folder ID from the URL when viewing the folder
  3. Note: The workflow is configured to use a folder called “n8n workflows”

Step 5: Import and Configure the Workflow

  1. Copy the provided workflow JSON
  2. In n8n, click Import from File or Import from Clipboard
  3. Paste the workflow JSON
  4. Configure each node as detailed below:

Node Configuration Details:

Get prompt from google sheet (Google Sheets)
Duplicate Rows2 (Code Node)
const original = items[0].json;

return [
  { json: { ...original, run: 1 } },
  { json: { ...original, run: 2 } },
];
Loop Over Items (Split in Batches)
Create Video (HTTP Request)
Get Video URL (HTTP Request)
Switch (Switch Node)
Wait (Wait Node)
Download Video as Base64 (HTTP Request)
Upload to Google Drive1 (Google Drive)

Step 6: Customize for Your Use Case

  1. Modify Duplicate Count: Edit the “Duplicate Rows2” code to create more variations
  2. Update File Naming: Change the naming pattern in the Google Drive upload node
  3. Adjust Wait Time: Modify the Wait node duration based on typical processing times
  4. Add Video Parameters: Enhance the Create Video request with additional Freepik parameters

Step 7: Test the Workflow

  1. Ensure your Google Sheet has test data
  2. Click Execute Workflow on the manual trigger (if present)
  3. Monitor the execution flow - note that video generation takes time
  4. Watch the Switch node handle different status responses
  5. Verify videos are uploaded to Google Drive when completed

Step 8: Production Deployment

  1. Set up error handling for API failures and timeouts
  2. Configure appropriate batch sizes based on your Freepik API limits
  3. Add logging for successful uploads and failed generations
  4. Consider webhook triggers for automated execution
  5. Set up monitoring for stuck or failed video generations

Freepik Video API Details

Video Generation Process:

  1. Submit Request: Send prompt to generate video
  2. Get Task ID: Receive task_id for tracking
  3. Poll Status: Check generation status periodically
  4. Download: Retrieve completed video URL

Status Types:

Model Specifications:

Example Enhanced Parameters:

{
  "prompt": "{{ $json.Prompt }}",
  "duration": 5,
  "aspect_ratio": "16:9",
  "fps": 24
}

Workflow Flow Summary

  1. Start → Read prompts from Google Sheets
  2. Duplicate → Create multiple runs for variations
  3. Loop → Process items in batches
  4. Generate → Submit video generation request to Freepik
  5. Poll → Check video generation status
  6. Switch → Route based on status:
    • Completed → Download video
    • Processing/Created → Wait and retry
    • Failed → Handle error
  7. Download → Retrieve completed video file
  8. Upload → Save to Google Drive with organized naming
  9. Continue → Process next batch

Troubleshooting Tips

Common Issues:

Error Handling:

Performance Optimization:

Cost Considerations

Freepik API:

Processing Time:


Contact Information

Robert A Ynteractive

For support, customization, or questions about this workflow:

Need help implementing this workflow or want custom automation solutions? Get in touch for professional n8n consulting and workflow development services.

🔗 Nodes Used

Google Sheets, HTTP Request, Google Drive

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup