8
n8n 中文网amn8n.com

生成会说话的虚拟形象视频并发布到 TikTok

高级

这是一个Content Creation, Miscellaneous, Multimodal AI领域的自动化工作流,包含 24 个节点。主要使用 If, Set, Wait, Postiz, HttpRequest 等节点。 使用Elevenlabs和Infinitalk创建会说话的虚拟形象视频并自动发布到TikTok

前置要求
  • 可能需要目标 API 的认证凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "XZSeWj4y0SWnp94K",
  "meta": {
    "instanceId": "a4bfc93e975ca233ac45ed7c9227d84cf5a2329310525917adaf3312e10d5462",
    "templateCredsSetupCompleted": true
  },
  "name": "生成会说话的虚拟形象视频并发布到 TikTok",
  "tags": [],
  "nodes": [
    {
      "id": "f0260063-c620-455f-ad89-a288b3deeb24",
      "name": "当点击\"测试工作流\"时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -288,
        256
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "970f94fe-c0f0-46dc-94b5-21b225f031a9",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -976,
        272
      ],
      "parameters": {
        "width": 560,
        "height": 960,
        "content": "## 输入 - 图像"
      },
      "typeVersion": 1
    },
    {
      "id": "b4f04df4-a42b-4c17-b4fe-c5e7d3b1964b",
      "name": "等待60秒.1",
      "type": "n8n-nodes-base.wait",
      "position": [
        624,
        640
      ],
      "webhookId": "bb15f2f3-caec-4df6-ac1f-374ed90d8a3e",
      "parameters": {
        "amount": 60
      },
      "typeVersion": 1.1
    },
    {
      "id": "1e27c532-b751-4e38-8b9d-d9478caa419c",
      "name": "便签8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        352,
        576
      ],
      "parameters": {
        "width": 180,
        "height": 200,
        "content": "设置在步骤 2 中创建的 API 密钥"
      },
      "typeVersion": 1
    },
    {
      "id": "1f85dad8-9641-4514-abe4-e9e882e91d28",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        848,
        976
      ],
      "parameters": {
        "width": 180,
        "height": 200,
        "content": "设置频道ID 步骤3"
      },
      "typeVersion": 1
    },
    {
      "id": "e9c7afd2-8741-476d-95a0-29045a06175e",
      "name": "等待60秒.2",
      "type": "n8n-nodes-base.wait",
      "position": [
        624,
        256
      ],
      "webhookId": "bb15f2f3-caec-4df6-ac1f-374ed90d8a3e",
      "parameters": {
        "amount": 60
      },
      "typeVersion": 1.1
    },
    {
      "id": "c64be753-c029-4e74-a6a6-85a5ac7d9d83",
      "name": "便签9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        352,
        192
      ],
      "parameters": {
        "width": 180,
        "height": 200,
        "content": "设置在步骤 2 中创建的 API 密钥"
      },
      "typeVersion": 1
    },
    {
      "id": "2920c75b-df35-4042-9693-f345bad4e73d",
      "name": "设置文本输入",
      "type": "n8n-nodes-base.set",
      "position": [
        32,
        256
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "5b4cdec4-d8e0-4adf-9669-c242320bed4a",
              "name": "text",
              "type": "string",
              "value": "=Tomorrow in New York the weather will be clear and partly cloudy with a temperature of 25 degrees"
            },
            {
              "id": "76f947bc-1802-4106-8e4e-54a44364afc5",
              "name": "voice",
              "type": "string",
              "value": "Alice"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "f4c56b29-5818-4cbd-8204-859f18c13dfc",
      "name": "获取音频状态",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        800,
        256
      ],
      "parameters": {
        "url": "=https://queue.fal.run/fal-ai/elevenlabs/requests/{{ $('Create voice').item.json.request_id }}/status ",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "daOZafXpRXLtoLUV",
          "name": "Fal.run API"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "6da04971-2400-446a-baf1-8e64109b11d2",
      "name": "音频完成?",
      "type": "n8n-nodes-base.if",
      "position": [
        976,
        256
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "383d112e-2cc6-4dd4-8985-f09ce0bd1781",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "COMPLETED"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "94141113-277d-49ce-8072-a9a7b56286d8",
      "name": "获取音频URL",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -272,
        640
      ],
      "parameters": {
        "url": "=https://queue.fal.run/fal-ai/elevenlabs/requests/{{ $json.request_id }}",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "daOZafXpRXLtoLUV",
          "name": "Fal.run API"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "f987697a-1436-4a85-9aed-4a1a6ea9882b",
      "name": "设置音频URL",
      "type": "n8n-nodes-base.set",
      "position": [
        -64,
        640
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "149fe1da-641e-4949-b695-fd6e3ad673f7",
              "name": "audio_url",
              "type": "string",
              "value": "={{$json.audio.url}}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "193435c0-3b1f-4820-a24d-1645c0d81311",
      "name": "设置视频参数",
      "type": "n8n-nodes-base.set",
      "position": [
        176,
        640
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "c713d31f-9abd-496a-ac79-e8e2efe60aa0",
              "name": "image_url",
              "type": "string",
              "value": "=https://n3wstorage.b-cdn.net/n3witalia/result2.png"
            },
            {
              "id": "5b4cdec4-d8e0-4adf-9669-c242320bed4a",
              "name": "audio_url",
              "type": "string",
              "value": "={{$json.audio_url}}"
            },
            {
              "id": "66901b83-8687-4e7d-8860-a76e232e6027",
              "name": "prompt",
              "type": "string",
              "value": "=You are a girl who makes weather forecasts and needs to be expressive"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "f45bc334-7baa-48f7-be4e-dda094f52c5e",
      "name": "创建视频",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        400,
        640
      ],
      "parameters": {
        "url": "https://queue.fal.run/fal-ai/infinitalk",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n     \"image_url\": \"{{ $json.image_url }}\",\n     \"audio_url\": \"{{ $json.audio_url }}\",\n     \"prompt\": \"{{ $json.prompt }}\"\n   }",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "daOZafXpRXLtoLUV",
          "name": "Fal.run API"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "faf0fb26-d0cc-4c76-9ce9-9dd9fb3c0f78",
      "name": "获取状态",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        800,
        640
      ],
      "parameters": {
        "url": "=https://queue.fal.run/fal-ai/infinitalk/requests/{{ $('Create Video').item.json.request_id }}/status ",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "daOZafXpRXLtoLUV",
          "name": "Fal.run API"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "c6c38e72-966e-44de-a65b-b6f5694523a8",
      "name": "完成?",
      "type": "n8n-nodes-base.if",
      "position": [
        976,
        640
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "383d112e-2cc6-4dd4-8985-f09ce0bd1781",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "COMPLETED"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "1368b0f4-7d61-4cc3-8b0a-81d13a167fbe",
      "name": "获取视频URL",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -272,
        1024
      ],
      "parameters": {
        "url": "=https://queue.fal.run/fal-ai/infinitalk/requests/{{ $json.request_id }}",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "daOZafXpRXLtoLUV",
          "name": "Fal.run API"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "22c6d754-17d2-4730-b680-81027dfb6ec1",
      "name": "生成标题",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -16,
        1024
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "GPT-4O-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=Input: {{ $('Set text input').item.json.text }}\n\nPrompt: {{ $('Set Video Params').item.json.prompt }}"
            },
            {
              "role": "system",
              "content": "You are a TikTok expert specialized in creating engaging and optimized titles.\n\nYour task is to generate an effective title for a YouTube video based on the user's video description.\n\nGUIDELINES:\n- Maximum 60 characters to avoid truncation\n- Use relevant keywords for SEO\n- Make the title catchy and clickable\n- Avoid excessive or misleading clickbait\n- Consider the target audience of the content\n- Use numbers, questions, or power words when appropriate\n- IMPORTANT: Generate the title in the same language as the input description\n\nOUTPUT FORMAT:\nProvide only the title, without additional explanations.\n\nEXAMPLE:\nInput: \"Tutorial video on how to cook perfect pasta carbonara\"\nOutput: \"PERFECT Carbonara in 10 Minutes - Chef's Secrets\""
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "id": "TefveNaDaMERl1hY",
          "name": "OpenAi account (Eure)"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "95db6c0f-1606-4035-b906-4e597844de20",
      "name": "获取视频文件",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        352,
        1024
      ],
      "parameters": {
        "url": "={{ $('Get Url Video').item.json.video.url }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "a549c100-6d5a-4098-b270-4230a1f2dab3",
      "name": "上传视频到 Postiz",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        640,
        1024
      ],
      "parameters": {
        "url": "https://api.postiz.com/public/v1/upload",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "file",
              "parameterType": "formBinaryData",
              "inputDataFieldName": "data"
            }
          ]
        },
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "GIEq2Y2xhJSgjqyG",
          "name": "Postiz"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "670d593d-da7a-45ca-b40e-109a2bcbe1f3",
      "name": "TikTok",
      "type": "n8n-nodes-postiz.postiz",
      "position": [
        880,
        1024
      ],
      "parameters": {
        "date": "={{ $now.format('yyyy-LL-dd') }}T{{ $now.format('HH:ii:ss') }}",
        "posts": {
          "post": [
            {
              "value": {
                "contentItem": [
                  {
                    "image": {
                      "imageItem": [
                        {
                          "id": "={{ $json.id }}",
                          "path": "={{ $json.path }}"
                        }
                      ]
                    },
                    "content": "={{ $('Generate title').item.json.message.content }}"
                  }
                ]
              },
              "integrationId": "XXX"
            }
          ]
        },
        "shortLink": true
      },
      "credentials": {
        "postizApi": {
          "id": "c8iQxqMcfCXPbUHc",
          "name": "Postiz account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "1d42267b-70a4-4b15-ad3f-877a918ceb67",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -976,
        -192
      ],
      "parameters": {
        "color": 3,
        "width": 992,
        "height": 224,
        "content": "# 从一张图像生成会说话的AI虚拟形象视频并发布到TikTok"
      },
      "typeVersion": 1
    },
    {
      "id": "531b4fa0-ea2b-438c-81b2-c0647cba1393",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -976,
        64
      ],
      "parameters": {
        "width": 992,
        "content": "## 设置步骤"
      },
      "typeVersion": 1
    },
    {
      "id": "3b104696-0805-49a7-8f6b-6657b8e74dfa",
      "name": "创建语音",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        400,
        256
      ],
      "parameters": {
        "url": "https://queue.fal.run/fal-ai/elevenlabs/tts/eleven-v3",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n     \"text\": \"{{ $json.text }}\",\n     \"voice\": \"{{ $json.voice }}\"\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "daOZafXpRXLtoLUV",
          "name": "Fal.run API"
        }
      },
      "typeVersion": 4.2
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "464c3e69-6f5c-445b-9e95-cf7cdde3db78",
  "connections": {
    "Completed?": {
      "main": [
        [
          {
            "node": "Get Url Video",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait 60 sec.1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get status": {
      "main": [
        [
          {
            "node": "Completed?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Video": {
      "main": [
        [
          {
            "node": "Wait 60 sec.1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create voice": {
      "main": [
        [
          {
            "node": "Wait 60 sec.2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Url Audio": {
      "main": [
        [
          {
            "node": "Set Audio Url",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Url Video": {
      "main": [
        [
          {
            "node": "Generate title",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Audio Url": {
      "main": [
        [
          {
            "node": "Set Video Params",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 60 sec.1": {
      "main": [
        [
          {
            "node": "Get status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 60 sec.2": {
      "main": [
        [
          {
            "node": "Get status audio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate title": {
      "main": [
        [
          {
            "node": "Get File Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get File Video": {
      "main": [
        [
          {
            "node": "Upload Video to Postiz",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set text input": {
      "main": [
        [
          {
            "node": "Create voice",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Completed audio?": {
      "main": [
        [
          {
            "node": "Get Url Audio",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait 60 sec.2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get status audio": {
      "main": [
        [
          {
            "node": "Completed audio?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Video Params": {
      "main": [
        [
          {
            "node": "Create Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Video to Postiz": {
      "main": [
        [
          {
            "node": "TikTok",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Set text input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 内容创作, 杂项, 多模态 AI

需要付费吗?

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

工作流信息
难度等级
高级
节点数量24
分类3
节点类型8
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者

Full-stack Web Developer based in Italy specialising in Marketing & AI-powered automations. For business enquiries, send me an email at info@n3w.it or add me on Linkedin.com/in/davideboizza

外部链接
在 n8n.io 查看

分享此工作流