🎬 Automate video uploads to thumbnails with FFmpeg and Google Drive

1,476 views · 🎬 Content Creation & Video

Description

Automate Video Upload → Auto-Thumbnail → Google Drive

This workflow accepts a video via HTTP upload, verifies it’s a valid video, extracts a thumbnail frame at the 5-second mark using FFmpeg (auto-installs a static build if missing), uploads the image to a specified Google Drive folder and returns a structured JSON response containing the new file’s details.

Who’s it for

How it works

  1. Accept Video Upload (Webhook) Receives multipart/form-data with file in field media at /mediaUpload. Response is deferred until the final node.
  2. Validate Upload is Video (IF) Checks {{$binary.media.mimeType}} contains video/. Non-video payloads can be rejected with HTTP 400.
  3. Persist Upload to /tmp (Write Binary File) Writes the uploaded file to /tmp/<originalFilename or input.mp4> for stable processing.
  4. Extract Thumbnail with FFmpeg (Execute Command)
    • Uses system ffmpeg if available; otherwise downloads a static binary to /tmp/ffmpeg.
    • Runs: ffmpeg -y -ss 5 -i <video> -frames:v 1 -q:v 2 /tmp/thumbnail.jpg
  5. Load Thumbnail from Disk (Read Binary File) Reads /tmp/thumbnail.jpg into the item’s binary as thumbnail.
  6. Upload Thumbnail to Drive (Google Drive) Uploads to your target folder. File name is &lt;original&gt;-thumb.jpg.
  7. Return API Response (Respond to Webhook) Sends JSON to the client including Drive file id, name, links, size, and checksums (if available).

How to set up

  1. Import the workflow JSON into n8n.
  2. Google Drive
    • Create (or choose) a destination folder; copy its Folder ID.
    • Add Google Drive OAuth2 credentials in n8n and select them in the Drive node.
    • Set the folder in the Drive “Upload” node.
  3. Webhook
    • The endpoint is POST /webhook/mediaUpload.
    • Test:
      curl -X POST https://YOUR-N8N-URL/webhook/mediaUpload \
        -F "media=@/path/to/video.mp4"
  4. FFmpeg
    • Nothing to install manually: the Execute Command node auto-installs a static ffmpeg if it’s not present.
    • (Optional) If running n8n in Docker and you want permanence, use an image that includes ffmpeg.
  5. Response body
    • The Respond node returns JSON with file metadata. You can customize the fields as needed.
  6. (Optional) Non-video branch
    • On the IF node’s false output, add a Respond node with HTTP 400 and a helpful message.

Requirements

How to customize

Add-ons

Use Case Examples

Common troubleshooting

IssuePossible CauseSolution
ffmpeg: not foundSystem lacks ffmpeg and static build couldn’t downloadEnsure outbound HTTPS allowed; keep the auto-installer lines intact; or use a Docker image that includes ffmpeg.
Webhook returns 400 “not a video”Wrong field name or non-video MIMESend file in media field; ensure it’s video/*.
Drive upload fails (403 / insufficient permissions)OAuth scope or account lacks folder accessReconnect Drive credential; verify the destination Folder ID and sharing/ownership.
Response missing webViewLink / webContentLinkDrive node not returning link fieldsEnable link fields in the Drive node or build URLs using the returned id.
413 Payload Too Large at reverse proxyProxy limits on upload sizeIncrease body size limits in your proxy (e.g., Nginx client_max_body_size).
Disk full / ENOSPCLarge uploads filling /tmpIncrease temp storage; keep Cleanup step; consider size caps and early rejection.
Corrupt thumbnail or black frameTimestamp lands on a black frameChange -ss or use -ss before -i vs. after; try different seconds (e.g., 1–3s).
Slow extractionLarge or remote files; cold FFmpeg downloadWarm the container; host near upload source; keep static ffmpeg cached in image.
Duplicate outputsRepeat requests with same video/nameAdd a de-dup check (query Drive for existing &lt;base&gt;-thumb.jpg before upload).

Need Help?

Want this wired to S3 or Zoho WorkDrive or to generate multiple timestamps and public links out of the box? We’re happy to help.

🔗 Nodes Used

Read Binary File, Write Binary File, Webhook, Google Drive

📥 Import

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

📖 Importing guide · 🔑 Credential setup