{
  "name": "B1 \u2014 \u30b7\u30e7\u30fc\u30c8\u52d5\u753b\u91cf\u7523 \u53f0\u672c\u99c6\u52d5\u578b",
  "nodes": [
    {
      "parameters": {},
      "id": "1",
      "name": "\u30b9\u30bf\u30fc\u30c8",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        240,
        260
      ]
    },
    {
      "parameters": {
        "content": "## B1 \u30b7\u30e7\u30fc\u30c8\u52d5\u753b\u91cf\u7523 \u53f0\u672c\u99c6\u52d5\u578b\n\n1. AI\u65e5\u672c\u8a9e\u53f0\u672c\u751f\u6210\uff08\u69cb\u9020\u5316JSON\uff09\n2. \u5404\u30b7\u30fc\u30f3\u3067ElevenLabs TTS + AI\u753b\u50cf\u751f\u6210\uff08Flux\uff09\n3. Code\u3067SRT\u5b57\u5e55\u81ea\u52d5\u751f\u6210\uff08Whisper\u98a8\u30bf\u30a4\u30df\u30f3\u30b0\uff09\n4. SSH/FFmpeg\u3067\u7e26\u578b9:16\u52d5\u753b\u5408\u6210\uff0b\u5b57\u5e55\u713c\u4ed8\n\n2026\u5e74\u6700\u65b0\uff1aElevenLabs v2\u3001n8n AI Agent\u98a8\u30d7\u30ed\u30f3\u30d7\u30c8\u3001GPU FFmpeg\u5bfe\u5fdc",
        "width": 420,
        "height": 240,
        "color": 2
      },
      "id": "2",
      "name": "\u30ef\u30fc\u30af\u30d5\u30ed\u30fc\u6982\u8981",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        240,
        40
      ]
    },
    {
      "parameters": {
        "content": "## 1. \u53f0\u672c\u751f\u6210",
        "width": 340,
        "height": 40,
        "color": 3
      },
      "id": "3",
      "name": "\u30bb\u30af\u30b7\u30e7\u30f31",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        720,
        40
      ]
    },
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o"
        },
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "\u3042\u306a\u305f\u306f\u30b7\u30e7\u30fc\u30c8\u52d5\u753b\u5c02\u9580\u306e\u811a\u672c\u5bb6\u3067\u3059\u3002\u30e6\u30fc\u30b6\u30fc\u306e\u30c8\u30d4\u30c3\u30af\u3092\u3082\u3068\u306b\u300130\u301c60\u79d2\u306e\u7e26\u578b\uff089:16\uff09\u30b7\u30e7\u30fc\u30c8\u52d5\u753b\u306e\u53f0\u672c\u3092\u751f\u6210\u3057\u3066\u304f\u3060\u3055\u3044\u3002\n\u51fa\u529b\u306f\u5fc5\u305a\u4ee5\u4e0b\u306eJSON\u5f62\u5f0f\u306b\u3057\u3066\u304f\u3060\u3055\u3044\uff1a\n{\n  \"title\": \"\u52d5\u753b\u30bf\u30a4\u30c8\u30eb\",\n  \"scenes\": [\n    {\n      \"id\": 1,\n      \"narration\": \"\u3053\u3053\u306b\u65e5\u672c\u8a9e\u30ca\u30ec\u30fc\u30b7\u30e7\u30f3\",\n      \"visual_prompt\": \"\u3053\u3053\u306b\u82f1\u8a9e\u306e\u8a73\u7d30\u306a\u753b\u50cf\u751f\u6210\u30d7\u30ed\u30f3\u30d7\u30c8\u3001cinematic, vertical 9:16\"\n    }\n  ]\n}\n\u5404\u30b7\u30fc\u30f3\u306f5\u301c8\u79d2\u7a0b\u5ea6\u306b\u53ce\u3081\u3066\u304f\u3060\u3055\u3044\u3002\u5408\u8a08\u30676\u301c10\u30b7\u30fc\u30f3\u3002"
            },
            {
              "role": "user",
              "content": "={{ $json[\"topic\"] || $json[\"\u52d5\u753b\u30c8\u30d4\u30c3\u30af\"] || \"\u751f\u6210AI\u306e\u672a\u6765\" }}"
            }
          ]
        },
        "options": {}
      },
      "id": "4",
      "name": "\u53f0\u672c\u751f\u6210AI",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1,
      "position": [
        720,
        260
      ]
    },
    {
      "parameters": {
        "jsCode": "const output = items[0].json;\nif (output.scenes && Array.isArray(output.scenes)) {\n  return output.scenes.map((scene) => ({\n    json: {\n      scene_id: scene.id,\n      narration: scene.narration,\n      visual_prompt: scene.visual_prompt,\n      title: output.title || \"\u30b7\u30e7\u30fc\u30c8\u52d5\u753b\"\n    }\n  }));\n}\nreturn items;"
      },
      "id": "5",
      "name": "\u53f0\u672c\u3092\u30b7\u30fc\u30f3\u914d\u5217\u306b\u5909\u63db",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        960,
        260
      ]
    },
    {
      "parameters": {
        "batchSize": 1,
        "options": {}
      },
      "id": "6",
      "name": "\u30b7\u30fc\u30f3\u30eb\u30fc\u30d7",
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 1,
      "position": [
        1200,
        260
      ]
    },
    {
      "parameters": {
        "content": "## 2. \u30b7\u30fc\u30f3\u5225\u751f\u6210\n\u753b\u50cf\uff0bTTS",
        "width": 360,
        "height": 60,
        "color": 5
      },
      "id": "7",
      "name": "\u30bb\u30af\u30b7\u30e7\u30f32",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1580,
        40
      ]
    },
    {
      "parameters": {
        "url": "https://api.replicate.com/v1/predictions",
        "method": "POST",
        "jsonBody": true,
        "body": "={{ {\n  \"version\": \"black-forest-labs/flux-1-schnell\",\n  \"input\": {\n    \"prompt\": $json[\"visual_prompt\"],\n    \"aspect_ratio\": \"9:16\",\n    \"output_format\": \"png\"\n  }\n} }}",
        "options": {
          "response": {
            "responseFormat": "json"
          }
        }
      },
      "id": "8",
      "name": "AI\u753b\u50cf\u751f\u6210",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [
        1580,
        140
      ]
    },
    {
      "parameters": {
        "url": "https://api.elevenlabs.io/v1/text-to-speech/onw2D4w9f0f8X9O4v9f8",
        "method": "POST",
        "jsonBody": true,
        "body": "={{ {\n  \"text\": $json[\"narration\"],\n  \"model_id\": \"eleven_multilingual_v2\",\n  \"voice_settings\": {\n    \"stability\": 0.45,\n    \"similarity_boost\": 0.85,\n    \"style\": 0.1\n  }\n} }}",
        "options": {
          "response": {
            "responseFormat": "file",
            "outputPropertyName": "audio"
          }
        }
      },
      "id": "9",
      "name": "TTS\u97f3\u58f0\u5408\u6210",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [
        1580,
        380
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "a1",
              "name": "scene_id",
              "value": "={{ $json.scene_id }}",
              "type": "string"
            },
            {
              "id": "a2",
              "name": "narration",
              "value": "={{ $json.narration }}",
              "type": "string"
            },
            {
              "id": "a3",
              "name": "image_url",
              "value": "={{ $json.output?.url || $json.image_url || \"https://placeholder.com/image.png\" }}",
              "type": "string"
            },
            {
              "id": "a4",
              "name": "audio_binary",
              "value": "={{ $binary.audio }}",
              "type": "string"
            },
            {
              "id": "a5",
              "name": "title",
              "value": "={{ $json.title }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "10",
      "name": "\u30b7\u30fc\u30f3\u60c5\u5831\u7d71\u5408",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3,
      "position": [
        1820,
        260
      ]
    },
    {
      "parameters": {
        "mode": "combine",
        "combineBy": "combineAll",
        "options": {}
      },
      "id": "11",
      "name": "\u5168\u30b7\u30fc\u30f3\u96c6\u7d04",
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3,
      "position": [
        2220,
        260
      ]
    },
    {
      "parameters": {
        "content": "## 3. \u5b57\u5e55\uff06\u52d5\u753b\u5408\u6210",
        "width": 340,
        "height": 40,
        "color": 4
      },
      "id": "12",
      "name": "\u30bb\u30af\u30b7\u30e7\u30f33",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        2440,
        40
      ]
    },
    {
      "parameters": {
        "jsCode": "const allScenes = items[0].json || [];\nlet srt = \"\";\nlet currentTime = 0;\nconst sceneDuration = 6;\n\nallScenes.forEach((scene, index) => {\n  const start = currentTime;\n  const end = start + sceneDuration;\n  const startStr = `${Math.floor(start/3600).toString().padStart(2,'0')}:${Math.floor((start%3600)/60).toString().padStart(2,'0')}:${(start%60).toString().padStart(2,'0')},000`;\n  const endStr = `${Math.floor(end/3600).toString().padStart(2,'0')}:${Math.floor((end%3600)/60).toString().padStart(2,'0')}:${(end%60).toString().padStart(2,'0')},000`;\n  \n  srt += `${index+1}\\n${startStr} --> ${endStr}\\n${scene.narration || scene.json?.narration}\\n\\n`;\n  currentTime = end;\n});\n\nreturn [{\n  json: {\n    title: allScenes[0]?.title || \"short_video\",\n    srt_content: srt,\n    total_duration: currentTime,\n    scenes: allScenes\n  }\n}];"
      },
      "id": "13",
      "name": "SRT\u5b57\u5e55\u751f\u6210",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        2440,
        140
      ]
    },
    {
      "parameters": {
        "operation": "command",
        "command": "cd /tmp/video_gen && python3 download_assets.py '{{$json.scenes}}' && ffmpeg -y -f concat -safe 0 -i images.txt -i audio_final.mp3 -vf \"scale=1080:1920:force_original_aspect_ratio=decrease,pad=1080:1920:(ow-iw)/2:(oh-ih)/2, subtitles=subtitles.srt:force_style='Fontsize=48,PrimaryColour=&HFFFFFF&,OutlineColour=&H000000&,BorderStyle=3'\" -c:v libx264 -preset slow -crf 18 -c:a aac -shortest -pix_fmt yuv420p \"{{$json.title}}_final.mp4\""
      },
      "id": "14",
      "name": "FFmpeg\u52d5\u753b\u5408\u6210",
      "type": "n8n-nodes-base.ssh",
      "typeVersion": 1,
      "position": [
        2680,
        260
      ]
    },
    {
      "parameters": {
        "jsCode": "return [{ json: { status: \"completed\", video_path: `/tmp/video_gen/${items[0].json.title}_final.mp4`, title: items[0].json.title } }];"
      },
      "id": "15",
      "name": "\u5b8c\u4e86\u51e6\u7406",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        2920,
        260
      ]
    },
    {
      "parameters": {
        "url": "https://api.openai.com/v1/audio/transcriptions",
        "method": "POST",
        "jsonBody": true,
        "body": {
          "model": "whisper-1",
          "response_format": "srt"
        },
        "options": {}
      },
      "id": "16",
      "name": "Whisper\u5b57\u5e55\u88dc\u6b63",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [
        2440,
        380
      ]
    },
    {
      "parameters": {
        "content": "AI\u53f0\u672c \u2192 TTS(ElevenLabs v2) \u2192 Flux\u753b\u50cf \u2192 SRT(Whisper) \u2192 FFmpeg\u7e26\u578b\u5408\u6210\n\n\u91cf\u7523\u30a8\u30f3\u30b8\u30f3\u3068\u3057\u3066SplitInBatches\u3067\u30b7\u30fc\u30f3\u4e26\u5217\u51e6\u7406",
        "width": 280,
        "height": 120,
        "color": 6
      },
      "id": "17",
      "name": "Tips",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        2920,
        40
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "name": "topic",
              "value": "={{ $json.topic || \"AI\u6280\u8853\u306e\u9032\u5316\u304c\u3082\u305f\u3089\u3059\u672a\u6765\" }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "18",
      "name": "\u5165\u529b\u30d1\u30e9\u30e1\u30fc\u30bf\u8a2d\u5b9a",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3,
      "position": [
        480,
        260
      ]
    }
  ],
  "connections": {
    "\u30b9\u30bf\u30fc\u30c8": {
      "main": [
        [
          {
            "node": "\u5165\u529b\u30d1\u30e9\u30e1\u30fc\u30bf\u8a2d\u5b9a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u5165\u529b\u30d1\u30e9\u30e1\u30fc\u30bf\u8a2d\u5b9a": {
      "main": [
        [
          {
            "node": "\u53f0\u672c\u751f\u6210AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u53f0\u672c\u751f\u6210AI": {
      "main": [
        [
          {
            "node": "\u53f0\u672c\u3092\u30b7\u30fc\u30f3\u914d\u5217\u306b\u5909\u63db",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u53f0\u672c\u3092\u30b7\u30fc\u30f3\u914d\u5217\u306b\u5909\u63db": {
      "main": [
        [
          {
            "node": "\u30b7\u30fc\u30f3\u30eb\u30fc\u30d7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u30b7\u30fc\u30f3\u30eb\u30fc\u30d7": {
      "main": [
        [
          {
            "node": "AI\u753b\u50cf\u751f\u6210",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "\u5168\u30b7\u30fc\u30f3\u96c6\u7d04",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI\u753b\u50cf\u751f\u6210": {
      "main": [
        [
          {
            "node": "TTS\u97f3\u58f0\u5408\u6210",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "TTS\u97f3\u58f0\u5408\u6210": {
      "main": [
        [
          {
            "node": "\u30b7\u30fc\u30f3\u60c5\u5831\u7d71\u5408",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u30b7\u30fc\u30f3\u60c5\u5831\u7d71\u5408": {
      "main": [
        [
          {
            "node": "\u30b7\u30fc\u30f3\u30eb\u30fc\u30d7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u5168\u30b7\u30fc\u30f3\u96c6\u7d04": {
      "main": [
        [
          {
            "node": "SRT\u5b57\u5e55\u751f\u6210",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SRT\u5b57\u5e55\u751f\u6210": {
      "main": [
        [
          {
            "node": "Whisper\u5b57\u5e55\u88dc\u6b63",
            "type": "main",
            "index": 0
          },
          {
            "node": "FFmpeg\u52d5\u753b\u5408\u6210",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Whisper\u5b57\u5e55\u88dc\u6b63": {
      "main": [
        [
          {
            "node": "FFmpeg\u52d5\u753b\u5408\u6210",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "FFmpeg\u52d5\u753b\u5408\u6210": {
      "main": [
        [
          {
            "node": "\u5b8c\u4e86\u51e6\u7406",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "00000000-0000-0000-0000-000000000000",
  "id": "b1-short-video-mass-production",
  "staticData": null,
  "tags": []
}