Automatisiertes Video-Upload → Automatische Thumbnails → Google Drive
Dies ist ein Content Creation, Multimodal AI-Bereich Automatisierungsworkflow mit 9 Nodes. Hauptsächlich werden If, Webhook, GoogleDrive, ExecuteCommand, ReadBinaryFile und andere Nodes verwendet. Automatisiere das Video-Upload und die Thumbnail-Erstellung mit FFmpeg und Google Drive
- •HTTP Webhook-Endpunkt (wird von n8n automatisch generiert)
- •Google Drive API-Anmeldedaten
Verwendete Nodes (9)
Kategorie
{
"id": "W69y1dllbQpuNZQ0",
"meta": {
"instanceId": "14e4c77104722ab186539dfea5182e419aecc83d85963fe13f6de862c875ebfa",
"templateCredsSetupCompleted": true
},
"name": "Automate Video Upload → Auto-Thumbnail → Google Drive",
"tags": [],
"nodes": [
{
"id": "0f0dc32f-cadc-4001-9ded-4049186ed556",
"name": "Notizzettel",
"type": "n8n-nodes-base.stickyNote",
"position": [
-570,
-180
],
"parameters": {
"width": 1600,
"height": 340,
"content": "## Video Upload → Auto-Thumbnail → Google Drive\n\n### **What it does (high level)**\nAccepts a video via HTTP upload, validates it’s a real video file, extracts a thumbnail at the 5-second mark using FFmpeg (auto-installs if missing), saves the thumbnail to a designated Google Drive folder, and returns a JSON response with the new file’s details."
},
"typeVersion": 1
},
{
"id": "9e6b7fcd-2c7a-4762-8dd7-efa102ad9599",
"name": "Notizzettel1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-560,
180
],
"parameters": {
"width": 1580,
"height": 660,
"content": "# **Node Breakdown & Descriptions:**\n\n### \\* The workflow starts with a **Webhook** node named **“Accept Video Upload”**, which activates on an HTTP **POST** to `/mediaUpload`. It expects `multipart/form-data` with the file in the `media` field and defers responding until the last node, so the API reply can include the uploaded thumbnail’s metadata.\n\n### \\* The next node, **IF** named **“Validate Upload is Video”**, checks `{{$binary.media.mimeType}}` contains `video/`. Only true (video) items proceed. If it ever receives a non-video, the false branch can return a **400** (optional improvement).\n\n### \\* The **Write Binary File** node named **“Persist Upload to /tmp”** writes the incoming `media` binary to disk at `/tmp/<originalFilename or input.mp4>`. This produces a stable file path for FFmpeg to read from.\n\n### \\* The **Execute Command** node named **“Extract Thumbnail with FFmpeg (Auto-Install)”** runs FFmpeg to grab a single frame at **5 seconds**:\n\n* If FFmpeg exists in the environment, it uses it.\n* Otherwise it **downloads a static FFmpeg** build into `/tmp/ffmpeg` (no root needed) and uses that.\n* Command outputs `/tmp/thumbnail.jpg` (`-ss 5 -frames:v 1 -q:v 2`).\n\n### \\* The **Read Binary File** node named **“Load Thumbnail from Disk”** reads `/tmp/thumbnail.jpg` back into the item’s binary data, preparing it for upload (thumbnail is now available as the node’s binary output).\n\n### \\* The **Google Drive** node named **“Upload Thumbnail to Drive”** uploads the thumbnail image to your target folder (folder ID you configured). The file name is derived from the original video name with a `-thumb.jpg` suffix. On success, it returns Drive metadata such as `id` and `name`.\n\n### \\* Finally, the **Respond to Webhook** node named **“Return API Response”** sends a JSON response to the caller indicating success, including the Drive `thumbnailFileId` and `thumbnailName`, so the client can reference or share the thumbnail immediately."
},
"typeVersion": 1
},
{
"id": "eb68ca4d-93d6-4535-a009-be7a129e18f3",
"name": "Video-Upload akzeptieren (Webhook)",
"type": "n8n-nodes-base.webhook",
"position": [
-480,
0
],
"webhookId": "53a1804d-fde6-4e38-abd4-f22f5cf2e4b2",
"parameters": {
"path": "mediaUpload",
"options": {},
"httpMethod": "POST",
"responseData": "allEntries",
"responseMode": "lastNode"
},
"typeVersion": 1
},
{
"id": "22cf7a78-1f4b-4dac-83b6-718476d74c11",
"name": "Upload als Video validieren (IF)",
"type": "n8n-nodes-base.if",
"position": [
-260,
0
],
"parameters": {
"options": {},
"conditions": {
"string": [
{
"value1": "={{$binary.file.mimeType}}",
"value2": "video/",
"operation": "contains"
}
],
"boolean": []
}
},
"typeVersion": 2
},
{
"id": "9bc950c0-4ffd-4c86-9345-7aa2bb682625",
"name": "Upload in /tmp speichern (Write Binary File)",
"type": "n8n-nodes-base.writeBinaryFile",
"position": [
-40,
0
],
"parameters": {
"options": {},
"fileName": "={{$('Accept Video Upload (Webhook)').item.binary.media.fileName ? \"/tmp/\" + $('Accept Video Upload (Webhook)').item.binary.media.fileName : \"/tmp/input.mp4\"}}",
"dataPropertyName": "media"
},
"typeVersion": 1
},
{
"id": "b8ecc2ac-ddca-42cb-a735-ec3e79e02f1c",
"name": "Miniaturansicht mit FFmpeg extrahieren (Auto-Install) (Execute Command)",
"type": "n8n-nodes-base.executeCommand",
"position": [
180,
0
],
"parameters": {
"command": "=set -e\n\nVIDEO=\"{{ $('Persist Upload to /tmp (Write Binary File)').item.json.fileName }}\"\nOUT=\"/tmp/{{ $('Accept Video Upload (Webhook)').item.binary.media.fileName }}_thumbnail.jpg\"\n\n# 1) locate ffmpeg\nif command -v ffmpeg >/dev/null 2>&1; then\n FFMPEG_BIN=\"$(command -v ffmpeg)\"\nelif [ -x /tmp/ffmpeg/ffmpeg ]; then\n FFMPEG_BIN=\"/tmp/ffmpeg/ffmpeg\"\nelse\n # 2) fetch a static ffmpeg (no root). Works on most Linux hosts/containers.\n ARCH=\"$(uname -m)\"\n case \"$ARCH\" in\n x86_64|amd64) URL=\"https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz\" ;;\n aarch64|arm64) URL=\"https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-arm64-static.tar.xz\" ;;\n armv7l|armhf) URL=\"https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-armhf-static.tar.xz\" ;;\n i686|i386) URL=\"https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-i686-static.tar.xz\" ;;\n *) echo \"Unsupported CPU arch: $ARCH\" >&2; exit 1 ;;\n esac\n\n mkdir -p /tmp/ffmpeg && cd /tmp/ffmpeg\n\n # downloader: prefer curl, else wget\n if command -v curl >/dev/null 2>&1; then\n curl -fsSL \"$URL\" -o ffmpeg.tar.xz\n elif command -v wget >/dev/null 2>&1; then\n wget -qO ffmpeg.tar.xz \"$URL\"\n else\n echo \"Need curl or wget to fetch ffmpeg\" >&2\n exit 1\n fi\n\n # extract (xz support required by most tars on Linux)\n tar -xJf ffmpeg.tar.xz --strip-components=1\n chmod +x ./ffmpeg ./ffprobe\n FFMPEG_BIN=\"/tmp/ffmpeg/ffmpeg\"\nfi\n\n# 3) do the work\n\"$FFMPEG_BIN\" -y -ss 5 -i \"$VIDEO\" -frames:v 1 -q:v 2 \"$OUT\"\n",
"executeOnce": false
},
"typeVersion": 1
},
{
"id": "736a61c2-bfeb-4821-8ca2-a0e54ddfb04d",
"name": "Miniaturansicht von Festplatte laden (Read Binary File)",
"type": "n8n-nodes-base.readBinaryFile",
"position": [
400,
0
],
"parameters": {
"filePath": "=/tmp/{{ $('Persist Upload to /tmp (Write Binary File)').item.binary.media.fileName }}_thumbnail.jpg"
},
"typeVersion": 1
},
{
"id": "8b2760d0-22f8-4291-9663-71f01e3c397b",
"name": "Miniaturansicht in Drive hochladen (Google Drive)",
"type": "n8n-nodes-base.googleDrive",
"position": [
620,
0
],
"parameters": {
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"options": {},
"folderId": {
"__rl": true,
"mode": "list",
"value": "1AXMk_yyq3sD_Oc9f5eRLuqtJevbX-d1i",
"cachedResultUrl": "",
"cachedResultName": "Video_Thumbnail"
}
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "LzEW2SwCQjcSdvdB",
"name": "Google Drive account 6"
}
},
"typeVersion": 3
},
{
"id": "418127d5-2902-472c-b4dc-5f9628c7c6b7",
"name": "API-Antwort zurückgeben (Respond to Webhook)",
"type": "n8n-nodes-base.respondToWebhook",
"position": [
840,
0
],
"parameters": {
"options": {
"responseCode": 200
},
"respondWith": "json",
"responseBody": "={\n \"ok\": true,\n \"fileName\": \"{{ $json.name || $json.originalFilename }}\",\n \"type\": \"{{ $json.mimeType || $json.fullFileExtension || $json.fileExtension }}\",\n \"sizeBytes\": \"{{ $json.size }}\",\n \"sizeHuman\": \"={{ (Number($json.size) >= 1048576 ? (Number($json.size)/1048576).toFixed(2) + ' MB' : (Number($json.size)/1024).toFixed(2) + ' KB') }}\",\n \"url\": \"={{ $json.webViewLink || ('https://drive.google.com/file/d/' + $json.id + '/view') }}\",\n \"downloadUrl\": \"={{ $json.webContentLink || ('https://drive.google.com/uc?id=' + $json.id + '&export=download') }}\",\n \"createdTime\": \"{{ $json.createdTime }}\",\n \"modifiedTime\": \"{{ $json.modifiedTime }}\",\n \"image\": {\n \"width\": \"{{ $json.imageMediaMetadata && $json.imageMediaMetadata.width }}\",\n \"height\": \"{{ $json.imageMediaMetadata && $json.imageMediaMetadata.height }}\",\n \"rotation\": \"{{ $json.imageMediaMetadata && $json.imageMediaMetadata.rotation }}\"\n },\n \"owner\": \"{{ $json.owners && $json.owners[0] && $json.owners[0].displayName }}\"\n}"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "8797b44a-f6aa-4043-9997-84a2147ae0aa",
"connections": {
"eb68ca4d-93d6-4535-a009-be7a129e18f3": {
"main": [
[
{
"node": "22cf7a78-1f4b-4dac-83b6-718476d74c11",
"type": "main",
"index": 0
}
]
]
},
"22cf7a78-1f4b-4dac-83b6-718476d74c11": {
"main": [
[
{
"node": "9bc950c0-4ffd-4c86-9345-7aa2bb682625",
"type": "main",
"index": 0
}
]
]
},
"8b2760d0-22f8-4291-9663-71f01e3c397b": {
"main": [
[
{
"node": "418127d5-2902-472c-b4dc-5f9628c7c6b7",
"type": "main",
"index": 0
}
]
]
},
"9bc950c0-4ffd-4c86-9345-7aa2bb682625": {
"main": [
[
{
"node": "b8ecc2ac-ddca-42cb-a735-ec3e79e02f1c",
"type": "main",
"index": 0
}
]
]
},
"736a61c2-bfeb-4821-8ca2-a0e54ddfb04d": {
"main": [
[
{
"node": "8b2760d0-22f8-4291-9663-71f01e3c397b",
"type": "main",
"index": 0
}
]
]
},
"b8ecc2ac-ddca-42cb-a735-ec3e79e02f1c": {
"main": [
[
{
"node": "736a61c2-bfeb-4821-8ca2-a0e54ddfb04d",
"type": "main",
"index": 0
}
]
]
}
}
}Wie verwende ich diesen Workflow?
Kopieren Sie den obigen JSON-Code, erstellen Sie einen neuen Workflow in Ihrer n8n-Instanz und wählen Sie "Aus JSON importieren". Fügen Sie die Konfiguration ein und passen Sie die Anmeldedaten nach Bedarf an.
Für welche Szenarien ist dieser Workflow geeignet?
Fortgeschritten - Content-Erstellung, Multimodales KI
Ist es kostenpflichtig?
Dieser Workflow ist völlig kostenlos. Beachten Sie jedoch, dass Drittanbieterdienste (wie OpenAI API), die im Workflow verwendet werden, möglicherweise kostenpflichtig sind.
Verwandte Workflows
WeblineIndia
@weblineindiaA Leading Software Engineering, Consulting & Outsourcing Services Company in USA & India serving Clients Globally since 1999.
Diesen Workflow teilen