{
  "name": "VIVID v5.0 \u2014 Master Pipeline",
  "nodes": [
    {
      "id": "trigger-webhook",
      "name": "Webhook \u2014 Pipeline Trigger",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        200,
        400
      ],
      "parameters": {
        "httpMethod": "POST",
        "path": "vivid-pipeline",
        "responseMode": "lastNode",
        "options": {}
      }
    },
    {
      "id": "node-01-load",
      "name": "Load Files",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        440,
        400
      ],
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "// \uacfc\uc81c 26: node1_load_files.js \ub0b4\uc6a9\uc744 \uc5ec\uae30\uc5d0 \ubd99\uc5ec\ub123\uae30.\n// \ucf54\ub4dc \ubcf8\uccb4\ub294 n8n_workflow/nodes/node1_load_files.js\uc5d0\uc11c \uad00\ub9ac.\n// Node 1 + Node 1.1 + Node 1.2 \ud1b5\ud569 (\ub300\ubcf8 \uccad\ud0b9 \u2192 \ubc94\ud37c \ubd84\uae30 \u2192 FFmpeg \uc624\ub514\uc624 \ubd84\ud560).\n// \ucd9c\ub825: \ucc55\ud130\ubcc4 n8n \uc544\uc774\ud15c \ubc30\uc5f4 (type: INTRO|BUMPER_TRIGGER|CHAPTER).\nthrow new Error('[Master] node1_load_files.js \ucf54\ub4dc\ub97c \uc774 Code Node\uc5d0 \ubd99\uc5ec\ub123\uc73c\uc138\uc694.');"
      }
    },
    {
      "id": "node-01-filter-bumper",
      "name": "IF \u2014 Bumper Filter",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        680,
        400
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.type }}",
              "operation": "equals",
              "value2": "BUMPER_TRIGGER"
            }
          ]
        }
      }
    },
    {
      "id": "node-01-bumper-passthrough",
      "name": "Bumper \u2014 Concat Entry",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3,
      "position": [
        920,
        260
      ],
      "parameters": {
        "mode": "manual",
        "duplicateItem": false,
        "assignments": {
          "assignments": [
            {
              "name": "concat_type",
              "value": "bumper",
              "type": "string"
            },
            {
              "name": "concat_path",
              "value": "={{ $json.bumper_path }}",
              "type": "string"
            },
            {
              "name": "chapter_id",
              "value": "={{ $json.chapter_id }}",
              "type": "string"
            },
            {
              "name": "chapter_index",
              "value": "={{ $json.chapter_index }}",
              "type": "number"
            }
          ]
        }
      }
    },
    {
      "id": "node-dispatch-chapter",
      "name": "Execute Sub-workflow (Chapter)",
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1,
      "position": [
        920,
        540
      ],
      "parameters": {
        "workflowId": "={{ $env.VIVID_CHAPTER_SUBWORKFLOW_ID }}",
        "options": {}
      },
      "_comment": "\ucc55\ud130\ubcc4 Sub-workflow \ube44\ub3d9\uae30 \ub514\uc2a4\ud328\uce58. \ud658\uacbd\ubcc0\uc218 VIVID_CHAPTER_SUBWORKFLOW_ID\uc5d0 pipeline_chapter \uc6cc\ud06c\ud50c\ub85c\uc6b0 ID \uc124\uc815 \ud544\uc694."
    },
    {
      "id": "node-aggregate",
      "name": "Aggregate \u2014 All Chapters",
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3,
      "position": [
        1200,
        400
      ],
      "parameters": {
        "mode": "append"
      },
      "_comment": "Bumper passthrough + \ubaa8\ub4e0 \ucc55\ud130 Sub-workflow \uacb0\uacfc\ub97c \ud569\uce68. chapter_index \uae30\uc900 \uc815\ub82c \ud6c4 Node 12\ub85c."
    },
    {
      "id": "node-sort-chapters",
      "name": "Sort by Chapter Index",
      "type": "n8n-nodes-base.sort",
      "typeVersion": 1,
      "position": [
        1440,
        400
      ],
      "parameters": {
        "sortFieldsUi": {
          "sortField": [
            {
              "fieldName": "chapter_index",
              "order": "ascending"
            }
          ]
        }
      }
    },
    {
      "id": "node-12-merge",
      "name": "Node 12 \u2014 Final Merge",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1680,
        400
      ],
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "// \uacfc\uc81c \uae30\uad6c\ud604: n8n_workflow/nodes/node12_final_merge.js \ub0b4\uc6a9 \ubd99\uc5ec\ub123\uae30.\n// FFmpeg concat + \uc778\ucf54\ub529 \uc9c0\ubb38 \ubd84\uc0b0 (CRF 19-21, GOP 90-150, h264_qsv).\n// \uc785\ub825: \uc815\ub82c\ub41c \ucc55\ud130/\ubc94\ud37c \uc544\uc774\ud15c. concat_type='bumper'\u2192bumper.mp4, 'chapter'\u2192render/chapter_NN.mp4.\nthrow new Error('[Master] node12_final_merge.js \ucf54\ub4dc\ub97c \uc774 Code Node\uc5d0 \ubd99\uc5ec\ub123\uc73c\uc138\uc694.');"
      }
    },
    {
      "id": "node-13-vrew",
      "name": "Node 13 \u2014 Vrew Builder",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1920,
        400
      ],
      "parameters": {
        "mode": "runOnceForAllItems",
        "jsCode": "// \uacfc\uc81c \uae30\uad6c\ud604: n8n_workflow/nodes/node13_vrew_builder.js \ub0b4\uc6a9 \ubd99\uc5ec\ub123\uae30.\n// \uc6d0\ubcf8 .vrew\uc5d0 \ube44\ub514\uc624 \ud2b8\ub799 \uc8fc\uc785 \u2192 \ucd5c\uc885_hf_vN.vrew \ud328\ud0a4\uc9d5.\n// EF-8: \ubc18\ub4dc\uc2dc \ubaa8\ub4e0 \ucc55\ud130 \uc644\ub8cc \ud6c4 1\ud68c\ub9cc \ud638\ucd9c.\nthrow new Error('[Master] node13_vrew_builder.js \ucf54\ub4dc\ub97c \uc774 Code Node\uc5d0 \ubd99\uc5ec\ub123\uc73c\uc138\uc694.');"
      }
    },
    {
      "id": "node-error-telegram",
      "name": "Error \u2014 Telegram Alert",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1,
      "position": [
        1920,
        640
      ],
      "parameters": {
        "chatId": "={{ $env.TELEGRAM_CHAT_ID }}",
        "text": "\ud83d\udea8 VIVID Pipeline \uc2e4\ud328\n\n{{ $json.error_message || '\uc54c \uc218 \uc5c6\ub294 \uc624\ub958' }}\n\n\ucc55\ud130: {{ $json.chapter_id || 'N/A' }}\n\uc2dc\uac04: {{ $now.toISO() }}",
        "additionalFields": {}
      }
    }
  ],
  "connections": {
    "Webhook \u2014 Pipeline Trigger": {
      "main": [
        [
          {
            "node": "Load Files",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Load Files": {
      "main": [
        [
          {
            "node": "IF \u2014 Bumper Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF \u2014 Bumper Filter": {
      "main": [
        [
          {
            "node": "Bumper \u2014 Concat Entry",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Execute Sub-workflow (Chapter)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Bumper \u2014 Concat Entry": {
      "main": [
        [
          {
            "node": "Aggregate \u2014 All Chapters",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Sub-workflow (Chapter)": {
      "main": [
        [
          {
            "node": "Aggregate \u2014 All Chapters",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Aggregate \u2014 All Chapters": {
      "main": [
        [
          {
            "node": "Sort by Chapter Index",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sort by Chapter Index": {
      "main": [
        [
          {
            "node": "Node 12 \u2014 Final Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Node 12 \u2014 Final Merge": {
      "main": [
        [
          {
            "node": "Node 13 \u2014 Vrew Builder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1",
    "saveManualExecutions": true,
    "callerPolicy": "workflowsFromSameOwner"
  },
  "staticData": null,
  "id": "vivid-master-pipeline-v45",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "tags": [
    {
      "name": "vivid"
    },
    {
      "name": "v4.5"
    },
    {
      "name": "master"
    }
  ],
  "_vivid_meta": {
    "version": "5.0.0",
    "description": "Master Pipeline \u2014 Node 1/1.1/1.2 \uc785\uad6c \u2192 IF(Bumper) \ubd84\uae30 \u2192 \ucc55\ud130\ubcc4 Sub-workflow \ube44\ub3d9\uae30 \ub514\uc2a4\ud328\uce58 \u2192 Aggregate \u2192 Node 12 Merge \u2192 Node 13 Vrew. GPU/CPU \uc774\uc885 \ud30c\uc774\ud504\ub77c\uc774\ub2dd\uc740 Sub-workflow \ub514\uc2a4\ud328\uce58 \ud0c0\uc774\ubc0d\uc73c\ub85c \uad6c\ud604.",
    "env_requirements": {
      "NODE_FUNCTION_ALLOW_BUILTIN": "*",
      "NODE_FUNCTION_ALLOW_EXTERNAL": "adm-zip",
      "VIVID_CHAPTER_SUBWORKFLOW_ID": "pipeline_chapter \uc6cc\ud06c\ud50c\ub85c\uc6b0 ID",
      "TELEGRAM_CHAT_ID": "\uc5d0\ub7ec \uc54c\ub9bc \uc218\uc2e0 Telegram \ucc44\ud305 ID",
      "PEXELS_API_KEY": "Pexels API \ud0a4 (V5.0 b_roll_video \ube44\ub514\uc624 \uac80\uc0c9\uc6a9)",
      "PIXABAY_API_KEY": "Pixabay API \ud0a4 (V5.0 real_photo \uc774\ubbf8\uc9c0 \uac80\uc0c9\uc6a9)"
    },
    "node_code_files": {
      "Load Files": "n8n_workflow/nodes/node1_load_files.js",
      "Node 12 \u2014 Final Merge": "n8n_workflow/nodes/node12_final_merge.js",
      "Node 13 \u2014 Vrew Builder": "n8n_workflow/nodes/node13_vrew_builder.js"
    }
  }
}