用 n8n + Fal.ai 从 Google Sheets 批量生成 UGC 广告图与短视频
读取 Google Sheet 产品行 → 生成广告图(Gemini / nano-banana)→ 分析图像并扩展场景 → 生成 5–8 秒视频(Veo3 / WAN2.2)→ 上传 Drive 并回写链接
- 给谁
- 需要批量产出 UGC 风格广告素材的营销人员、创作者与自动化搭建者
- 你会得到
- 从表格行自动产出广告图或 5–8 秒短视频,素材回存 Google Drive 且链接写回表格
- 你需要
- n8n · google-sheets · google-drive
硬约束
前置条件:n8n 实例;Google Sheets / Google Drive OAuth2 凭证;Fal.ai API Key(环境变量 FAL_KEY);OpenAI / OpenRouter 凭证。Google Sheet 需含列 product | presenter | prompt | img_url | video_url,且 Drive 文件设为「知道链接的人可查看」。建议先跑 Zone 0 验证图像-only 流,再测 Zone 1+2 完整图生视频。
他们做了什么
作者 jaruphatj 在 n8n 官方模板库发布了该工作流,提供三条可独立或串联执行的分支:Zone 0 用 Gemini 生成静态广告图;Zone 1 用 Fal.ai nano-banana 生成图像并由 gpt-4o 分析;Zone 2 用 AI Agent 扩展场景描述,再调用 Fal.ai Veo3(或 WAN2.2)生成 5–8 秒视频,最终回存 Google Drive 并更新 Sheet。
效果如何
作者报告(author_report)该模板可将表格行转为广告图与短视频,支持批量生成。模板在 n8n.io 获 4808 次查看。
值得知道
1. 本站未实测(reproduction=not_tested),搭建时需自行验证各节点凭证与表达式。2. AI Agent 提示词要求 plain text 输出,但下游 Structured Output Parser 强制 JSON schema,二者存在格式张力;autoFix 可能无法覆盖所有情况,建议先用样例测试。3. WAN2.2 节点默认 disabled,需手动启用并确认参数与计费。4. Zone 0 的 wait20sec 节点 amount=10(秒),与名称中的 20 不符,以参数为准。5. setBase64data 解析的是 `choices[0].message.images[0].image_url.url`,若 OpenRouter 响应结构变化会导致失败。6. Drive 文件必须设为「Anyone with link → Viewer」,否则图像/视频生成环节会报 403。7. 视频生成耗时较长,高峰期可能排队;可尝试 *-fast 模型或非高峰时段重试。
n8n 工作流模板
结构已检查 · 未实际运行下载后在 n8n 选择“Import from File”,或复制 JSON 后粘贴到编辑器。先配置自己的账号,再用测试数据运行;模板默认未启用。
配置与测试清单
需要绑定的凭证
- Get Data1 节点:绑定Google Sheets OAuth2 凭证。
- CreateImagebyOpernRouter (gemini-2.5-flash-image-preview:free) 节点:绑定HTTP Header Auth 凭证。
- uploadImagetoGdrive 节点:绑定Google Drive OAuth2 凭证。
- updateImageURL 节点:绑定Google Sheets OAuth2 凭证。
- HTTP Request 节点:绑定HTTP Header Auth 凭证。
- uploadImagetoGdrive1 节点:绑定Google Drive OAuth2 凭证。
- updateVideoURL 节点:绑定Google Sheets OAuth2 凭证。
- Call Fal.ai API (WAN2.2) 节点:绑定HTTP Header Auth 凭证。
- Analyze image 节点:绑定OpenAI API 凭证。
- Get the image 节点:绑定HTTP Header Auth 凭证。
- Get image status 节点:绑定HTTP Header Auth 凭证。
- Call Fal.ai API (nannoBanana) 节点:绑定HTTP Header Auth 凭证。
- Get Data 节点:绑定Google Sheets OAuth2 凭证。
- Get the video 节点:绑定HTTP Header Auth 凭证。
- Get the video status 节点:绑定HTTP Header Auth 凭证。
- OpenAI Chat Model1 节点:绑定OpenAI API 凭证。
- Veo3 节点:绑定HTTP Header Auth 凭证。
需要替换的配置
- 源模板来自 n8n 公开库 #8205(约 36 个节点)。导入后先保持未启用,核对触发器、表达式与外部 API 端点。
- Sticky Note 中的说明仅供参考;按自己的账号、表结构或频道 ID 替换占位配置。
测试输入与预期结果
- 在测试环境手动执行一次主路径,确认每个需凭证的节点已连接且无鉴权错误。
- 用一条合成/脱敏样例数据跑通,核对输出字段与下游写入目标,再考虑生产启用。
模板处理说明
- 已移除原作者凭证绑定、webhookId 与执行数据,工作流设为未启用;节点、连线与原文提示词保持原样。未在 n8n 中实际运行。
- 未改业务逻辑;运行前请自行核对密钥、配额与隐私合规。
模板获取日期: 2026-10-24
步骤
Zone 0:生成广告图(Gemini / OpenRouter 路径)
在 n8n 中导入模板后,先执行 Zone 0 的图像-only 分支。该分支读取 Google Sheets 的 Gemini 标签页,筛选 img_url 为空的行。用 Set 节点将 Drive 分享链接转换为直链(`uc?export=view&id=`)。随后通过 HTTP Request 节点调用 OpenRouter,使用模型 `google/gemini-2.5-flash-image-preview:free`,传入 prompt 与 product 图片 URL 生成图像。等待 10 秒后,用 Code 节点将返回的 data URI 拆分为 base64、mimeType 与 fileName,经 Convert to File 转为二进制,上传至 Google Drive 指定文件夹,最后将图片链接写回 Gemini 表的 img_url 列。
Zone 1:生成图像并分析(Fal nano-banana + OpenAI Vision)
执行 Zone 1 分支:读取 nanoBanana 标签页中 video_url 为空的行。同样先用 Set 节点将 Drive 链接转为直链。通过 HTTP Request 向 `https://queue.fal.run/fal-ai/nano-banana/edit` POST 请求,携带 prompt、image_urls、num_images=1、output_format=jpeg。获取 status_url 后进入轮询:查询状态 → If 判断是否为 COMPLETED → 若未完成则 Wait 10 秒再查。完成后用 `requests/{request_id}` 获取结果图像 URL。将该图像送入 OpenAI Vision 节点进行分析,模型使用 gpt-4o(chatgpt-4o-latest),要求输出 JSON 格式的品牌、配色、字体、可见文字、产品类型或角色信息。
运行提示词 · 来源原文。OpenAI Vision 节点(Analyze image)的 text 字段
Analyze the image: is it a product, a character, or both? If product → return JSON: brand_name: (brand if visible/inferable) color_scheme: - hex: (HEX of main colors) name: (color name) font_style: (if visible) visible_text: | (all legible text exactly) product_type: (type of product) visual_description: (1–2 sentences about subject) If character → return JSON: character_name: (if known/inferable) color_scheme: - hex: (HEX of main colors on outfit/character) name: (color name) outfit_style: (clothes/accessories) visual_description: (1–2 sentences about subject) Output JSON only.Zone 2-1:扩展视频场景描述(AI Agent)
将 Zone 1 的图像分析结果传入 AI Agent 节点「Describe Each Scene for Video」。该节点连接 OpenAI Chat Model(gpt-4o)与 Structured Output Parser,要求把分析内容扩展为 5 秒 UGC 风格视频场景描述。Agent 提示词要求输出 plain text,分 Characters / Scene Background / Camera Movement / Movement in Scene / Sound Design 五段;但下游 Structured Output Parser 强制 JSON schema(characters 数组、scene_description、camera_movement、object_movements、sound_effects)。搭建时需注意:Agent 的文本输出将被 Parser 尝试按 schema 提取,若格式不兼容可能触发 autoFix 或报错。建议先用样例测试输出稳定性。
运行提示词 · 来源原文。AI Agent 节点(Describe Each Scene for Video)的 text 字段
=You are a Video Scene Prompt Generator for Veo3. Your job is to take the scene input below and expand it into a detailed 5-second video description, following these rules: 1. Use the scene input as the core reference. Do not remove or alter product names, logos, or visible text from the reference image. 2. Expand the description into a natural, realistic **UGC-style video scene**. The output must feel authentic, casual, and human-made (like a phone video). 3. Break down the scene into these sections: - Characters: List all characters in the scene with age, attire, appearance, posture, emotion, and what they are doing. - Scene Background: Describe the environment in detail (location, lighting, colors, props, atmosphere, time of day). - Camera Movement: Describe how the camera moves (handheld, selfie, panning, zooming, tilt, etc.), as if filmed on a smartphone. - Movement in Scene: Show how the character(s) and product interact or move naturally in the 5-second clip. - Sound Design: Suggest casual voice/dialogue (under 150 characters, natural & authentic tone), plus ambient sounds or background noise that fit the scene. 4. The **dialogue** should sound natural, short, and conversational (like talking to a friend), not scripted or commercial. 5. Keep everything **photorealistic** and authentic, not overly polished or cinematic. Emphasize realism and relatability. Scene Input (from previous step): {{ $json.content }} Return your answer in **plain text** exactly in the following structure (no JSON, no extra commentary): Characters: - ... - ... Scene Background: ... Camera Movement: ... Movement in Scene: ... Sound Design: ...Zone 2-2:生成视频(Veo3 主路径)
使用 Veo3 HTTP Request 节点向 `https://queue.fal.run/fal-ai/veo3/image-to-video` POST 请求。请求体拼接 Structured Output Parser 的 output 字段:characters[0].description + scene_description + camera_movement + object_movements + sound_effects 作为 prompt;image_url 取自 Zone 1 获取的结果图像;duration 固定为 8s,generate_audio=true,resolution=720p。提交后获取 status_url,进入与 Zone 1 类似的轮询循环:Wait → Get video status → Switch 判断 COMPLETED/IN_PROGRESS/IN_QUEUE → 完成后 Get the video 下载 MP4。
Zone 2-3:上传视频并回写表格(含 WAN2.2 可选路径)
视频下载后通过 HTTP Request 获取二进制,上传至 Google Drive(可与图像同文件夹),然后将视频链接写回 nanoBanana 表的 video_url 列,匹配列为 product。WAN2.2 作为可选备用路径:节点「Call Fal.ai API (WAN2.2)」默认禁用,启用时向 `https://queue.fal.run/fal-ai/wan/v2.2-a14b/image-to-video` POST,参数包括 prompt(XML 格式包裹 characters/scene_description/camera_movement/object_movements)、num_frames=81、frames_per_second=18、resolution=720p、aspect_ratio=auto、num_inference_steps=27、enable_safety_checker=true、enable_prompt_expansion=false、acceleration=regular、guidance_scale=3.5、guidance_scale_2=3.5、shift=5、interpolator_model=film、num_interpolated_frames=1、adjust_fps_for_interpolation=true、image_url。该路径与 Veo3 互备,可根据效果切换。
可复制提示词
参考提示词 · 本站建议版本。搭建助手启动词:先确认 n8n 凭证(googleSheetsOAuth2Api、googleDriveOAuth2Api、httpHeaderAuth、openAiApi)与环境变量 FAL_KEY 已配置;Sheet 与 Drive 权限已开启;再导入 workflow JSON 并逐 Zone 测试
这一段是提示词,页面不会在这里插入广告。
按 Zone 0 → Zone 1 → Zone 2 顺序分步测试;Zone 2 先验证 Veo3 再考虑启用 WAN2.2;注意 AI Agent 与 Structured Output Parser 的格式张力
来源
Generate UGC ads from Google Sheets with Fal.ai models (nano-banana, WAN2.2, Veo3) · jaruphatj · n8n.io · 2025-09-03
留言与反馈
Agent 反馈
以下反馈由 Agent 提交,经用户确认和审核后公开,不代表平台已验证。