This n8n workflow accepts a video via HTTP upload, validates it, extracts a thumbnail at the 5-second mark using FFmpeg, uploads it to a Google Drive folder, and responds with structured JSON metadata.
It auto-installs a static FFmpeg build if one is not available.
- Marketing / Social Teams → Quickly generate ready-to-publish thumbnails.
- Developers → Lightweight API-first thumbnail service without extra infra.
- Agencies / Creators → Centralize standardized thumbnails in shared Drive.
-
Accept Video Upload (Webhook)
- Endpoint:
POST /webhook/mediaUpload - Receives
multipart/form-datawith file fieldmedia. - Response deferred until the final node.
- Endpoint:
-
Validate Upload (IF Node)
- Checks:
{{$binary.media.mimeType}}containsvideo/. - Non-video → return HTTP
400 Bad Request.
- Checks:
-
Persist Upload (Write Binary File)
- Saves file to
/tmp/<originalFilename>.mp4.
- Saves file to
-
Extract Thumbnail (Execute Command)
- Uses system
ffmpegor downloads static build to/tmp/ffmpeg. - Command run:
ffmpeg -y -ss 5 -i <video> -frames:v 1 -q:v 2 /tmp/thumbnail.jpg
- Uses system
-
Load Thumbnail (Read Binary File)
- Reads
/tmp/thumbnail.jpginto workflow binary asthumbnail.
- Reads
-
Upload to Drive (Google Drive Node)
- Saves file as
<original>-thumb.jpgin target folder.
- Saves file as
-
Respond to Webhook
- Returns JSON response with file details:
{ "id": "drive_file_id", "name": "sample-thumb.jpg", "mimeType": "image/jpeg", "size": 12345, "webViewLink": "https://drive.google.com/...", "webContentLink": "https://drive.google.com/..." }
- Returns JSON response with file details:
- Load the provided workflow JSON into your n8n instance.
- Create or choose a target folder in Drive.
- Copy its Folder ID.
- Add Google Drive OAuth2 credentials in n8n.
- Select the credential in the Drive node and configure the folder.
- Endpoint:
POST /webhook/mediaUpload - Example test with
curl:curl -X POST https://YOUR-N8N-URL/webhook/mediaUpload \ -F "media=@/path/to/video.mp4"
- 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.
- The Respond node returns JSON with file metadata. You can customize the fields as needed.
- On the IF node’s false output, add a Respond node with HTTP 400 and a helpful message.
- n8n instance with Execute Command node enabled (self-hosted/container/VM).
- Outbound network access (to fetch static FFmpeg if not installed).
- Google Drive OAuth2 credential with permission to the destination folder.
- Adequate temporary space in
/tmpfor the uploaded video and generated thumbnail.
- Change
-ss 5to another second, or make it dynamic via request param (e.g.,timestamp=15).
- Duplicate the FFmpeg + Read steps with
-ss 5,-ss 15,-ss 30. - Use suffixes like
-thumb-5.jpg,-thumb-15.jpg.
- Add upload time or Drive File ID in the file name:
{{ base + '-' + $now + '-thumb.jpg' }}
Public sharing: add a Drive → Permission: Create node (Role: reader, Type: anyone) and return webViewLink.
- Slack / Teams notification with the uploaded thumbnail link.
- Image optimization (e.g., convert to WebP or resize variants).
- Retry & alerts via error trigger workflow.
- Audit log to a database (e.g., Postgres) for observability.
- CMS ingestion: Editors upload videos; workflow returns a thumbnail URL to store alongside the article.
- Social scheduling: Upload longform to generate a quick hero image for a post.
- Client portals: Clients drop raw footage; you keep thumbnails uniform in one Drive folder.
| Issue | Possible Cause | Solution |
|---|---|---|
ffmpeg: not found |
System lacks ffmpeg and static build couldn’t download | Ensure outbound HTTPS is allowed; keep auto-installer lines intact; or use a Docker image with ffmpeg pre-installed. |
| Webhook returns 400 “not a video” | Wrong field name or invalid MIME type | Upload the file in media field; ensure MIME type is video/*. |
| Drive upload fails (403) | OAuth scope issue or account lacks folder access | Reconnect Google Drive credentials; verify destination Folder ID and permissions. |
Response missing webViewLink / webContentLink |
Drive node not returning link fields | Enable link fields in the Drive node or construct URLs manually from the returned file ID. |
| 413 Payload Too Large (reverse proxy) | Proxy limits on upload size | Increase body size limits in your proxy (e.g., set client_max_body_size in Nginx). |
Disk full / ENOSPC |
Large uploads filling /tmp |
Increase temp storage; add cleanup steps; enforce file size caps and reject oversized files early. |
| Corrupt or black frame thumbnail | FFmpeg timestamp hit a black frame | Adjust -ss parameter (e.g., use 1–3 seconds) or move -ss before -i. |
| Slow extraction | Large or remote files; cold FFmpeg install | Pre-bundle ffmpeg in Docker image; warm the container; host workflow close to upload source. |
| Duplicate outputs | Same file uploaded multiple times | Add a de-duplication check (query Drive for existing <base>-thumb.jpg before upload). |
Looking to extend this workflow? We can help you:
- Wire the output to S3 or Zoho WorkDrive instead of Google Drive.
- Generate multiple thumbnails at custom timestamps.
- Enable public sharing links automatically.
- Add logging, retry strategies, and monitoring for production.
👉 Contact WeblineIndia Automation Experts to turn this into a robust video asset pipeline.