8
n8n 中文网amn8n.com

为视频生成字幕

中级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 13 个节点。主要使用 Gmail, Merge, Webhook, HttpRequest, ExecuteCommand 等节点。 使用OpenAI Whisper和LibreTranslate生成并翻译视频字幕

前置要求
  • Google 账号和 Gmail API 凭证
  • HTTP Webhook 端点(n8n 会自动生成)
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "w2qeYCgIcuMglLEB",
  "meta": {
    "instanceId": "058026fc00ddd0f398afec59419d60070007f9155d42ea1b5598fa1878c9da96",
    "templateCredsSetupCompleted": true
  },
  "name": "为视频生成字幕",
  "tags": [],
  "nodes": [
    {
      "id": "7fa3143f-a837-4711-a72e-ee8b85e56757",
      "name": "Webhook触发器",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1504,
        112
      ],
      "webhookId": "a5f7f098-25f6-40ea-b139-c1fb1ef25b74",
      "parameters": {
        "path": "generate-subtitles",
        "options": {
          "responseData": {
            "responseBody": "Processing started"
          }
        },
        "httpMethod": "POST"
      },
      "typeVersion": 1
    },
    {
      "id": "23f12e94-e98c-4787-be58-763624e59537",
      "name": "下载视频",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1200,
        112
      ],
      "parameters": {
        "url": "={{$json[\"body\"][\"video_url\"]}}",
        "options": {},
        "responseFormat": "file"
      },
      "typeVersion": 2
    },
    {
      "id": "d0f75494-fa2c-46f1-9ff2-2e17f8a88d0b",
      "name": "提取音频(FFmpeg)",
      "type": "n8n-nodes-base.executeCommand",
      "position": [
        -896,
        112
      ],
      "parameters": {
        "command": "ffmpeg -i /data/video.mp4 -q:a 0 -map a /data/audio.wav"
      },
      "typeVersion": 1
    },
    {
      "id": "8d462da7-7935-4c5d-9528-2f4a41d2b79b",
      "name": "运行Whisper(本地)",
      "type": "n8n-nodes-base.executeCommand",
      "position": [
        -608,
        112
      ],
      "parameters": {
        "command": "whisper /data/audio.wav --model base --output_format srt --output_dir /data/"
      },
      "typeVersion": 1
    },
    {
      "id": "85ffc4ca-8f9d-485b-ab99-83b6774781b0",
      "name": "读取SRT文件",
      "type": "n8n-nodes-base.readBinaryFile",
      "position": [
        -304,
        112
      ],
      "parameters": {
        "filePath": "/data/audio.srt"
      },
      "typeVersion": 1
    },
    {
      "id": "c982d95f-b63b-4dc0-abc5-0bfdb6fbced9",
      "name": "翻译字幕(LibreTranslate)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        224,
        560
      ],
      "parameters": {
        "url": "https://libretranslate.com/translate",
        "options": {},
        "authentication": "genericCredentialType",
        "jsonParameters": true
      },
      "typeVersion": 2
    },
    {
      "id": "aa3eee42-8559-4f05-891c-9169b32f58cf",
      "name": "写入翻译后的SRT",
      "type": "n8n-nodes-base.writeBinaryFile",
      "position": [
        448,
        560
      ],
      "parameters": {
        "options": {},
        "fileName": "audio_translated.srt"
      },
      "typeVersion": 1
    },
    {
      "id": "fb95e5aa-dd78-4249-b0d1-775dc259a870",
      "name": "合并路径",
      "type": "n8n-nodes-base.merge",
      "position": [
        112,
        128
      ],
      "parameters": {
        "mode": "passThrough"
      },
      "typeVersion": 1
    },
    {
      "id": "dae85000-c87f-4607-b80c-5c9c70276ce1",
      "name": "发送消息",
      "type": "n8n-nodes-base.gmail",
      "position": [
        768,
        128
      ],
      "webhookId": "0dc39fa6-fac8-480d-a4cc-a1074edac0c2",
      "parameters": {
        "sendTo": "your-email@gmail.com",
        "message": "Attached are the subtitles (original and translated, if requested).",
        "options": {},
        "subject": "Video Subtitles Generated"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "f2AXAChfee6nsCv9",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "22d8ef5e-e319-4f76-8366-7b23bc600f43",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1536,
        -176
      ],
      "parameters": {
        "color": 3,
        "width": 480,
        "height": 480,
        "content": "## 输入"
      },
      "typeVersion": 1
    },
    {
      "id": "5bf9004c-5e09-4cc2-af0f-63f9a2df15f7",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -960,
        -176
      ],
      "parameters": {
        "color": 4,
        "width": 848,
        "height": 480,
        "content": "## 音频提取和转录"
      },
      "typeVersion": 1
    },
    {
      "id": "2627a7bc-a0f7-4d03-b849-878abe63eb6a",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        144,
        336
      ],
      "parameters": {
        "color": 5,
        "width": 480,
        "height": 400,
        "content": "## 翻译"
      },
      "typeVersion": 1
    },
    {
      "id": "fc33c12c-d054-4afe-bbf3-2f8a36c2f9df",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2432,
        -160
      ],
      "parameters": {
        "width": 608,
        "height": 912,
        "content": "# 字幕生成器和翻译器N8N模板说明"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "66d89da8-0755-4e8b-bf81-d1ae3fad5507",
  "connections": {
    "Merge Paths": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read SRT File": {
      "main": [
        [
          {
            "node": "Merge Paths",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Video": {
      "main": [
        [
          {
            "node": "Extract Audio (FFmpeg)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook Trigger": {
      "main": [
        [
          {
            "node": "Download Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Whisper (Local)": {
      "main": [
        [
          {
            "node": "Read SRT File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Write Translated SRT": {
      "main": [
        [
          {
            "node": "Merge Paths",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Extract Audio (FFmpeg)": {
      "main": [
        [
          {
            "node": "Run Whisper (Local)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Translate Subtitles (LibreTranslate)": {
      "main": [
        [
          {
            "node": "Write Translated SRT",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

中级 - 内容创作, 多模态 AI

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
中级
节点数量13
分类2
节点类型8
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
Paul Abraham

Paul Abraham

@hellopaul

Software Engineer & Automation Consultant with over 3+ years in experience helping teams streamline workflows with n8n, APIs, and AI-driven solutions.

外部链接
在 n8n.io 查看

分享此工作流