自动化视频上传 → 自动缩略图 → Google Drive
中级
这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 9 个节点。主要使用 If, Webhook, GoogleDrive, ExecuteCommand, ReadBinaryFile 等节点。 使用 FFmpeg 和 Google Drive 自动化视频上传和缩略图生成
前置要求
- •HTTP Webhook 端点(n8n 会自动生成)
- •Google Drive API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "W69y1dllbQpuNZQ0",
"meta": {
"instanceId": "14e4c77104722ab186539dfea5182e419aecc83d85963fe13f6de862c875ebfa",
"templateCredsSetupCompleted": true
},
"name": "自动化视频上传 → 自动缩略图 → Google Drive",
"tags": [],
"nodes": [
{
"id": "0f0dc32f-cadc-4001-9ded-4049186ed556",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-570,
-180
],
"parameters": {
"width": 1600,
"height": 340,
"content": "## 视频上传 → 自动缩略图 → Google Drive"
},
"typeVersion": 1
},
{
"id": "9e6b7fcd-2c7a-4762-8dd7-efa102ad9599",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-560,
180
],
"parameters": {
"width": 1580,
"height": 660,
"content": "# **节点分解与说明:**"
},
"typeVersion": 1
},
{
"id": "eb68ca4d-93d6-4535-a009-be7a129e18f3",
"name": "接受视频上传 (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": "验证上传是否为视频 (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": "将上传持久化到 /tmp (写入二进制文件)",
"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": "使用 FFmpeg 提取缩略图(自动安装)(执行命令)",
"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": "从磁盘加载缩略图 (读取二进制文件)",
"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": "上传缩略图到 Drive (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 响应 (响应 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": {
"Accept Video Upload (Webhook)": {
"main": [
[
{
"node": "Validate Upload is Video (IF)",
"type": "main",
"index": 0
}
]
]
},
"Validate Upload is Video (IF)": {
"main": [
[
{
"node": "Persist Upload to /tmp (Write Binary File)",
"type": "main",
"index": 0
}
]
]
},
"Upload Thumbnail to Drive (Google Drive)": {
"main": [
[
{
"node": "Return API Response (Respond to Webhook)",
"type": "main",
"index": 0
}
]
]
},
"Persist Upload to /tmp (Write Binary File)": {
"main": [
[
{
"node": "Extract Thumbnail with FFmpeg (Auto-Install) (Execute Command)",
"type": "main",
"index": 0
}
]
]
},
"Load Thumbnail from Disk (Read Binary File)": {
"main": [
[
{
"node": "Upload Thumbnail to Drive (Google Drive)",
"type": "main",
"index": 0
}
]
]
},
"Extract Thumbnail with FFmpeg (Auto-Install) (Execute Command)": {
"main": [
[
{
"node": "Load Thumbnail from Disk (Read Binary File)",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 内容创作, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
AI驱动视频创作与上传至Instagram、TikTok和YouTube
从云端硬盘进行AI驱动视频创作并上传至Instagram、TikTok和YouTube
If
Set
Code
+14
53 节点DevCode Journey
内容创作
发票和收据生成器(HTML转PDF)
自动发票生成器 - 从Shopify到PDF,支持Google Drive存储和邮件发送
If
Code
Gmail
+6
19 节点Jitesh Dugar
内容创作
为视频生成字幕
使用OpenAI Whisper和LibreTranslate生成并翻译视频字幕
Gmail
Merge
Webhook
+5
13 节点Paul Abraham
内容创作
iOS应用商店评论监控器
监控iOS应用商店评论并自动发送邮件通知
If
Set
Code
+4
12 节点WeblineIndia
内容创作
YouTube 转录、摘要与翻译到 Google 文档
使用 Gemini AI 将 YouTube 转录和翻译至 Google 文档
Code
Webhook
Google Docs
+4
10 节点WeblineIndia
内容创作
潜在客户资格评定与路由引擎
基于AI的潜在客户资格评定与路由:使用OpenAI、Slack和Airtable
If
Set
Slack
+8
17 节点Xavier Tai
内容创作
工作流信息
难度等级
中级
节点数量9
分类2
节点类型8
作者
WeblineIndia
@weblineindiaA Leading Software Engineering, Consulting & Outsourcing Services Company in USA & India serving Clients Globally since 1999.
外部链接
在 n8n.io 查看 →
分享此工作流