{
  "name": "Rebuild product-focused reels shot by shot with Apify, Gemini and fal.ai",
  "nodes": [
    {
      "id": "Sticky Note",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1328,
        -512
      ],
      "parameters": {
        "width": 480,
        "height": 880,
        "content": "## Rebuild a reel shot by shot around your product\n\n### How it works\n\nYou give it a reel that already works, and the product you want to sell. It gives you back the same video, shot for shot, with your product in it.\n\nMost reel cloners watch a video once and generate something that feels similar. This one takes the reel apart. It finds every cut, pulls one frame from each shot, and studies them one at a time: how close the camera sits, what angle it looks from, how it moves, where the light falls. Then it rebuilds each shot around your product and puts the pieces back in the original order, each trimmed to the length it was before.\n\nSo a reel with three cuts comes back with three cuts, in the same rhythm. Whatever made the original hold attention is still holding it. Only the product changed.\n\n### Setup steps\n\n- [ ] Add three Header Auth credentials: Apify, Google Gemini and fal.ai.\n- [ ] Open **Set Source Reel And Target Product**. Paste the reel URL, describe your product. That is the only node you need to touch.\n- [ ] Press execute, or send a reel and product to the webhook from wherever you already work.\n\n### Customization\n\nMissing a cut you wanted? Lower `scene_threshold`. Getting more shots than the reel really has? Raise it."
      },
      "typeVersion": 1
    },
    {
      "id": "Sticky Note1",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -768,
        -304
      ],
      "parameters": {
        "color": 7,
        "width": 448,
        "height": 528,
        "content": "## Collect what you are working with\nStart it by hand, or send a reel and a product to the webhook. Either way it lands here, where the reel URL, your product and the cut sensitivity are set."
      },
      "typeVersion": 1
    },
    {
      "id": "Sticky Note2",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -224,
        -160
      ],
      "parameters": {
        "color": 7,
        "width": 416,
        "height": 320,
        "content": "## Get the reel\nApify pulls down the source reel, then hands it to the scene splitter to work out where the cuts are."
      },
      "typeVersion": 1
    },
    {
      "id": "Sticky Note3",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        -128
      ],
      "parameters": {
        "color": 7,
        "width": 640,
        "height": 304,
        "content": "## Wait for the cuts\nScene detection runs in the background. This checks every ten seconds and loops until it is done, so long reels never time out mid-run."
      },
      "typeVersion": 1
    },
    {
      "id": "Sticky Note4",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        912,
        -240
      ],
      "parameters": {
        "color": 7,
        "width": 672,
        "height": 304,
        "content": "## Pull one frame per shot\nThe finished report is split into individual scenes, and the single frame that represents each shot is downloaded ready for reading."
      },
      "typeVersion": 1
    },
    {
      "id": "Sticky Note5",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1616,
        -272
      ],
      "parameters": {
        "color": 7,
        "width": 592,
        "height": 320,
        "content": "## Read every shot\nAll the frames go to Gemini together. It reads the framing, angle, movement and lighting of each shot, then writes what that shot looks like with your product in it."
      },
      "typeVersion": 1
    },
    {
      "id": "Sticky Note6",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2240,
        -144
      ],
      "parameters": {
        "color": 7,
        "width": 672,
        "height": 368,
        "content": "## Rebuild each shot\nOne scene at a time: a new still is generated from the shot description, then sent off to be animated with the movement that shot originally had."
      },
      "typeVersion": 1
    },
    {
      "id": "Sticky Note7",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2944,
        -80
      ],
      "parameters": {
        "color": 7,
        "width": 800,
        "height": 304,
        "content": "## Wait for each clip\nAnimation takes a while, so this polls until the clip is ready, collects it, and goes back round for the next scene."
      },
      "typeVersion": 1
    },
    {
      "id": "Sticky Note8",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2240,
        -432
      ],
      "parameters": {
        "color": 7,
        "width": 416,
        "height": 272,
        "content": "## Lay out the timeline\nOnce every scene is done, the clips go back in the original order and each is trimmed to the length of the shot it replaces."
      },
      "typeVersion": 1
    },
    {
      "id": "Sticky Note9",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2688,
        -432
      ],
      "parameters": {
        "color": 7,
        "width": 592,
        "height": 272,
        "content": "## Wait for the final render\nThe assembly job is polled the same way, until the finished video is ready to collect."
      },
      "typeVersion": 1
    },
    {
      "id": "Sticky Note10",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3312,
        -432
      ],
      "parameters": {
        "color": 7,
        "width": 400,
        "height": 272,
        "content": "## Hand back the video\nThe finished reel is fetched and returned to whoever called the webhook, along with a thumbnail."
      },
      "typeVersion": 1
    },
    {
      "id": "run-manually",
      "name": "Run Workflow Manually",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -720,
        -120
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "receive-reel",
      "name": "Receive Reel Via Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -720,
        60
      ],
      "parameters": {
        "path": "clone-shot-structure",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2
    },
    {
      "id": "set-inputs",
      "name": "Set Source Reel And Target Product",
      "type": "n8n-nodes-base.set",
      "notes": "The only node you need to edit.",
      "position": [
        -460,
        -30
      ],
      "parameters": {
        "mode": "manual",
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "f1",
              "name": "source_reel_url",
              "type": "string",
              "value": "={{ $json.body?.source_reel_url || 'https://www.instagram.com/p/REPLACE_WITH_A_REEL/' }}"
            },
            {
              "id": "f2",
              "name": "target_product",
              "type": "string",
              "value": "={{ $json.body?.target_product || 'a brushed stainless steel insulated water bottle' }}"
            },
            {
              "id": "f3",
              "name": "scene_threshold",
              "type": "number",
              "value": 0.35
            },
            {
              "id": "f4",
              "name": "clip_aspect_ratio",
              "type": "string",
              "value": "portrait_16_9"
            }
          ]
        },
        "includeOtherFields": false
      },
      "notesInFlow": true,
      "typeVersion": 3.4
    },
    {
      "id": "download-source-reel-with-apify",
      "name": "Download Source Reel With Apify",
      "type": "n8n-nodes-base.httpRequest",
      "maxTries": 3,
      "position": [
        -180,
        0
      ],
      "parameters": {
        "url": "https://api.apify.com/v2/acts/apify~instagram-scraper/run-sync-get-dataset-items",
        "method": "POST",
        "options": {
          "timeout": 300000
        },
        "jsonBody": "={{ JSON.stringify({ directUrls: [$json.source_reel_url], resultsType: \"posts\", resultsLimit: 1, addParentData: false }) }}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "retryOnFail": true,
      "typeVersion": 4.2,
      "waitBetweenTries": 5000
    },
    {
      "id": "start-scene-detection",
      "name": "Start Scene Detection",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        40,
        0
      ],
      "parameters": {
        "url": "https://api.apify.com/v2/acts/frameprobe~video-scene-splitter/runs",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ JSON.stringify({ videoUrls: [$json.videoUrl], sceneThreshold: $('Set Source Reel And Target Product').first().json.scene_threshold, minSceneSeconds: 0.6, maxKeyframes: 40, keyframeLongEdge: 1024, includeKeyframes: true }) }}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "typeVersion": 4.2
    },
    {
      "id": "wait-10-seconds-for-detection",
      "name": "Wait 10 Seconds For Detection",
      "type": "n8n-nodes-base.wait",
      "position": [
        288,
        0
      ],
      "parameters": {
        "unit": "seconds",
        "amount": 10
      },
      "typeVersion": 1.1
    },
    {
      "id": "check-scene-detection-status",
      "name": "Check Scene Detection Status",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        512,
        0
      ],
      "parameters": {
        "url": "=https://api.apify.com/v2/actor-runs/{{ $('Start Scene Detection').first().json.data.id }}",
        "method": "GET",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "typeVersion": 4.2
    },
    {
      "id": "if-scene-detection-complete",
      "name": "If Scene Detection Complete",
      "type": "n8n-nodes-base.if",
      "position": [
        736,
        0
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "c1",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.data.status }}",
              "rightValue": "SUCCEEDED"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "fetch-scene-report",
      "name": "Fetch Scene Report",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        960,
        -112
      ],
      "parameters": {
        "url": "=https://api.apify.com/v2/datasets/{{ $('Start Scene Detection').first().json.data.defaultDatasetId }}/items",
        "method": "GET",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "typeVersion": 4.2
    },
    {
      "id": "split-scenes",
      "name": "Split Detected Scenes",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1232,
        -112
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "scenes"
      },
      "typeVersion": 1
    },
    {
      "id": "fetch-scene-keyframe",
      "name": "Fetch Scene Keyframe",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1440,
        -112
      ],
      "parameters": {
        "url": "=https://api.apify.com/v2/key-value-stores/{{ $('Check Scene Detection Status').first().json.data.defaultKeyValueStoreId }}/records/{{ $json.keyframeKey }}",
        "method": "GET",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file",
              "outputPropertyName": "data"
            }
          }
        },
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "typeVersion": 4.2
    },
    {
      "id": "prepare-gemini-analysis-request",
      "name": "Prepare Gemini Analysis Request",
      "type": "n8n-nodes-base.code",
      "position": [
        1664,
        -112
      ],
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "const cfg = $('Set Source Reel And Target Product').first().json;\nconst scenes = $('Split Detected Scenes').all().map(i => i.json);\nconst parts = [];\nparts.push({ text: [\n  'You are a shot-list analyst. The attached still frames are ONE frame per detected scene cut of a short-form video, given in order.',\n  '',\n  'Scene timings:',\n  scenes.map(s => 'Scene ' + (s.index + 1) + ': ' + s.startSeconds + 's to ' + s.endSeconds + 's (' + s.durationSeconds + 's)').join('\\n'),\n  '',\n  'For EACH scene, read its frame and report shot_size, camera_angle, camera_movement (infer from framing, blur and subject position) and composition (subject placement, framing, lighting, background, colour palette).',\n  '',\n  'Then write two prompts per scene that recreate THAT EXACT SHOT but replace the subject or product with: \"' + cfg.target_product + '\".',\n  '- image_prompt: a still-image prompt reproducing the same shot size, angle, framing, lighting and colour palette, featuring the replacement product.',\n  '- motion_prompt: a short camera and subject motion instruction matching this scene movement, to animate that still for its exact duration.',\n  '',\n  'Return exactly ' + scenes.length + ' scenes, in order. Do not merge, split or invent scenes.'\n].join('\\n') });\nfor (let i = 0; i < scenes.length; i++) {\n  const buf = await this.helpers.getBinaryDataBuffer(i, 'data');\n  parts.push({ text: '--- Scene ' + (scenes[i].index + 1) + ' frame (' + scenes[i].durationSeconds + 's) ---' });\n  parts.push({ inline_data: { mime_type: 'image/jpeg', data: buf.toString('base64') } });\n}\nconst responseSchema = { type:'OBJECT', properties:{ scenes:{ type:'ARRAY', items:{ type:'OBJECT', properties:{\n  scene_index:{type:'INTEGER'}, shot_size:{type:'STRING'}, camera_angle:{type:'STRING'},\n  camera_movement:{type:'STRING'}, composition:{type:'STRING'}, image_prompt:{type:'STRING'}, motion_prompt:{type:'STRING'}\n}, required:['scene_index','shot_size','camera_angle','camera_movement','composition','image_prompt','motion_prompt'] } } }, required:['scenes'] };\nreturn [{ json: { body: { contents:[{ parts }], generationConfig:{ responseMimeType:'application/json', responseSchema, temperature:0.4 } } } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "analyse-shots-with-gemini-flash",
      "name": "Analyse Shots With Gemini Flash",
      "type": "n8n-nodes-base.httpRequest",
      "notes": "Model pinned on purpose. The gemini-flash-latest alias tracks the newest Flash, which carries the tightest free-tier quota and the heaviest load.",
      "maxTries": 5,
      "position": [
        1872,
        -112
      ],
      "parameters": {
        "url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.6-flash:generateContent",
        "method": "POST",
        "options": {
          "timeout": 120000
        },
        "jsonBody": "={{ JSON.stringify($json.body) }}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "notesInFlow": true,
      "retryOnFail": true,
      "typeVersion": 4.2,
      "waitBetweenTries": 5000
    },
    {
      "id": "extract-scene-prompts",
      "name": "Extract Scene Prompts",
      "type": "n8n-nodes-base.code",
      "position": [
        2064,
        -112
      ],
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "const cfg = $('Set Source Reel And Target Product').first().json;\nconst timings = $('Split Detected Scenes').all().map(i => i.json);\nconst analysed = JSON.parse($json.candidates[0].content.parts[0].text).scenes;\nreturn timings.map((t, i) => {\n  const a = analysed[i] || {};\n  return { json: {\n    scene_index: t.index,\n    scene_number: t.index + 1,\n    start_seconds: t.startSeconds,\n    end_seconds: t.endSeconds,\n    duration_seconds: t.durationSeconds,\n    duration_ms: Math.round(t.durationSeconds * 1000),\n    clip_seconds: t.durationSeconds > 5 ? '10' : '5',\n    shot_size: a.shot_size,\n    camera_angle: a.camera_angle,\n    camera_movement: a.camera_movement,\n    composition: a.composition,\n    image_prompt: a.image_prompt,\n    motion_prompt: a.motion_prompt,\n    target_product: cfg.target_product,\n    clip_aspect_ratio: cfg.clip_aspect_ratio\n  } };\n});"
      },
      "typeVersion": 2
    },
    {
      "id": "loop-scenes",
      "name": "Loop Over Scenes",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        2288,
        64
      ],
      "parameters": {
        "options": {},
        "batchSize": 1
      },
      "typeVersion": 3
    },
    {
      "id": "generate-scene-image-with-fal-ai",
      "name": "Generate Scene Image With fal.ai",
      "type": "n8n-nodes-base.httpRequest",
      "maxTries": 3,
      "position": [
        2560,
        64
      ],
      "parameters": {
        "url": "https://fal.run/fal-ai/flux/schnell",
        "method": "POST",
        "options": {
          "timeout": 120000
        },
        "jsonBody": "={{ JSON.stringify({ prompt: $json.image_prompt, image_size: $json.clip_aspect_ratio, num_images: 1, output_format: \"jpeg\" }) }}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "retryOnFail": true,
      "typeVersion": 4.2,
      "waitBetweenTries": 5000
    },
    {
      "id": "submit-scene-animation-to-fal-ai",
      "name": "Submit Scene Animation To fal.ai",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2752,
        64
      ],
      "parameters": {
        "url": "https://queue.fal.run/fal-ai/kling-video/v1.6/standard/image-to-video",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ JSON.stringify({ prompt: $('Loop Over Scenes').item.json.motion_prompt, image_url: $json.images[0].url, duration: $('Loop Over Scenes').item.json.clip_seconds }) }}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "typeVersion": 4.2
    },
    {
      "id": "wait-20-seconds-for-animation",
      "name": "Wait 20 Seconds For Animation",
      "type": "n8n-nodes-base.wait",
      "position": [
        2992,
        64
      ],
      "parameters": {
        "unit": "seconds",
        "amount": 20
      },
      "typeVersion": 1.1
    },
    {
      "id": "check-animation-status",
      "name": "Check Animation Status",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3184,
        64
      ],
      "parameters": {
        "url": "={{ $('Submit Scene Animation To fal.ai').item.json.status_url }}",
        "method": "GET",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "typeVersion": 4.2
    },
    {
      "id": "if-animation-is-ready",
      "name": "If Animation Is Ready",
      "type": "n8n-nodes-base.if",
      "position": [
        3392,
        64
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "c1",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "COMPLETED"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "fetch-scene-clip",
      "name": "Fetch Scene Clip",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3584,
        64
      ],
      "parameters": {
        "url": "={{ $('Submit Scene Animation To fal.ai').item.json.response_url }}",
        "method": "GET",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "typeVersion": 4.2
    },
    {
      "id": "construct-scene-timeline",
      "name": "Construct Scene Timeline",
      "type": "n8n-nodes-base.code",
      "position": [
        2288,
        -336
      ],
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "// Rebuild the timeline in the SOURCE order, trimming every generated clip\n// back to the exact duration of the scene it replaces. This is what keeps\n// the output's shot count and pacing identical to the source reel.\nconst plan = $('Extract Scene Prompts').all().map(i => i.json);\nconst clips = $('Fetch Scene Clip').all().map(i => i.json);\nlet cursor = 0;\nconst keyframes = plan.map((scene, i) => {\n  const clip = clips[i];\n  const frame = {\n    timestamp: cursor,\n    duration: scene.duration_ms,\n    url: clip.video ? clip.video.url : clip.url\n  };\n  cursor += scene.duration_ms;\n  return frame;\n});\nreturn [{ json: { tracks: [{ id: 'reconstructed_scenes', type: 'video', keyframes }],\n  scene_count: plan.length, total_ms: cursor } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "submit-final-assembly-to-fal-ai",
      "name": "Submit Final Assembly To fal.ai",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2512,
        -336
      ],
      "parameters": {
        "url": "https://queue.fal.run/fal-ai/ffmpeg-api/compose",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ JSON.stringify({ tracks: $json.tracks }) }}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "typeVersion": 4.2
    },
    {
      "id": "wait-20-seconds-for-final-video",
      "name": "Wait 20 Seconds For Final Video",
      "type": "n8n-nodes-base.wait",
      "position": [
        2736,
        -304
      ],
      "parameters": {
        "unit": "seconds",
        "amount": 20
      },
      "typeVersion": 1.1
    },
    {
      "id": "check-final-video-status",
      "name": "Check Final Video Status",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2944,
        -304
      ],
      "parameters": {
        "url": "={{ $('Submit Final Assembly To fal.ai').item.json.status_url }}",
        "method": "GET",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "typeVersion": 4.2
    },
    {
      "id": "if-final-video-is-ready",
      "name": "If Final Video Is Ready",
      "type": "n8n-nodes-base.if",
      "position": [
        3136,
        -304
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "c1",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "COMPLETED"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "fetch-final-video",
      "name": "Fetch Final Video",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3360,
        -304
      ],
      "parameters": {
        "url": "={{ $('Submit Final Assembly To fal.ai').item.json.response_url }}",
        "method": "GET",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "typeVersion": 4.2
    },
    {
      "id": "respond",
      "name": "Return Final Video",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        3552,
        -304
      ],
      "parameters": {
        "options": {},
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify({ video_url: $json.video_url, thumbnail_url: $json.thumbnail_url }) }}"
      },
      "typeVersion": 1.1
    }
  ],
  "settings": {
    "executionOrder": "v1"
  },
  "connections": {
    "Fetch Scene Clip": {
      "main": [
        [
          {
            "node": "Loop Over Scenes",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Scenes": {
      "main": [
        [
          {
            "node": "Construct Scene Timeline",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Generate Scene Image With fal.ai",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Final Video": {
      "main": [
        [
          {
            "node": "Return Final Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Scene Report": {
      "main": [
        [
          {
            "node": "Split Detected Scenes",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Scene Keyframe": {
      "main": [
        [
          {
            "node": "Prepare Gemini Analysis Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Scene Prompts": {
      "main": [
        [
          {
            "node": "Loop Over Scenes",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If Animation Is Ready": {
      "main": [
        [
          {
            "node": "Fetch Scene Clip",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait 20 Seconds For Animation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Workflow Manually": {
      "main": [
        [
          {
            "node": "Set Source Reel And Target Product",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Detected Scenes": {
      "main": [
        [
          {
            "node": "Fetch Scene Keyframe",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start Scene Detection": {
      "main": [
        [
          {
            "node": "Wait 10 Seconds For Detection",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Animation Status": {
      "main": [
        [
          {
            "node": "If Animation Is Ready",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If Final Video Is Ready": {
      "main": [
        [
          {
            "node": "Fetch Final Video",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait 20 Seconds For Final Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Final Video Status": {
      "main": [
        [
          {
            "node": "If Final Video Is Ready",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Construct Scene Timeline": {
      "main": [
        [
          {
            "node": "Submit Final Assembly To fal.ai",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Receive Reel Via Webhook": {
      "main": [
        [
          {
            "node": "Set Source Reel And Target Product",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If Scene Detection Complete": {
      "main": [
        [
          {
            "node": "Fetch Scene Report",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait 10 Seconds For Detection",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Scene Detection Status": {
      "main": [
        [
          {
            "node": "If Scene Detection Complete",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 10 Seconds For Detection": {
      "main": [
        [
          {
            "node": "Check Scene Detection Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 20 Seconds For Animation": {
      "main": [
        [
          {
            "node": "Check Animation Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyse Shots With Gemini Flash": {
      "main": [
        [
          {
            "node": "Extract Scene Prompts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Source Reel With Apify": {
      "main": [
        [
          {
            "node": "Start Scene Detection",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Gemini Analysis Request": {
      "main": [
        [
          {
            "node": "Analyse Shots With Gemini Flash",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Submit Final Assembly To fal.ai": {
      "main": [
        [
          {
            "node": "Wait 20 Seconds For Final Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 20 Seconds For Final Video": {
      "main": [
        [
          {
            "node": "Check Final Video Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Scene Image With fal.ai": {
      "main": [
        [
          {
            "node": "Submit Scene Animation To fal.ai",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Submit Scene Animation To fal.ai": {
      "main": [
        [
          {
            "node": "Wait 20 Seconds For Animation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Source Reel And Target Product": {
      "main": [
        [
          {
            "node": "Download Source Reel With Apify",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
