{
  "name": "Brand-Pipe: format, brand and normalise a video",
  "nodes": [
    {
      "parameters": {},
      "id": "a1b2c3d4-0001-4000-8000-000000000001",
      "name": "Run",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [0, 0]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {"id": "f1", "name": "video_url", "value": "https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_1MB.mp4", "type": "string"},
            {"id": "f2", "name": "logo_url", "value": "https://www.python.org/static/community_logos/python-logo.png", "type": "string"},
            {"id": "f3", "name": "format", "value": "vertical", "type": "string"},
            {"id": "f4", "name": "audio_normalize", "value": true, "type": "boolean"}
          ]
        },
        "options": {}
      },
      "id": "a1b2c3d4-0002-4000-8000-000000000002",
      "name": "Set video",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [220, 0],
      "notes": "Replace these values with the output of your video generator node."
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://brand-pipe-api-zpvrfqoxuq-ey.a.run.app/v1/process",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ video_url: $json.video_url, logo_url: $json.logo_url, format: $json.format, audio_normalize: $json.audio_normalize }) }}",
        "options": {"timeout": 300000}
      },
      "id": "a1b2c3d4-0003-4000-8000-000000000003",
      "name": "Brand-Pipe process",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [440, 0],
      "credentials": {"httpHeaderAuth": {"id": "", "name": "Brand-Pipe API Key"}},
      "notes": "Credential: Header Auth, name X-API-Key, value your key. Timeout 5 min covers long clips."
    },
    {
      "parameters": {
        "conditions": {
          "options": {"caseSensitive": true, "leftValue": "", "typeValidation": "strict"},
          "conditions": [{"id": "c1", "leftValue": "={{ $json.success }}", "rightValue": true, "operator": {"type": "boolean", "operation": "true", "singleValue": true}}],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "a1b2c3d4-0004-4000-8000-000000000004",
      "name": "Success?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [660, 0]
    },
    {
      "parameters": {
        "url": "={{ $json.data.result_url }}",
        "options": {"response": {"response": {"responseFormat": "file", "outputPropertyName": "video"}}}
      },
      "id": "a1b2c3d4-0005-4000-8000-000000000005",
      "name": "Download result",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [880, -100],
      "notes": "Binary property 'video' holds the finished MP4. Connect your YouTube / TikTok / storage node here."
    },
    {
      "parameters": {
        "errorMessage": "=Brand-Pipe error: {{ $json.error }}"
      },
      "id": "a1b2c3d4-0006-4000-8000-000000000006",
      "name": "Stop with error",
      "type": "n8n-nodes-base.stopAndError",
      "typeVersion": 1,
      "position": [880, 100]
    }
  ],
  "connections": {
    "Run": {"main": [[{"node": "Set video", "type": "main", "index": 0}]]},
    "Set video": {"main": [[{"node": "Brand-Pipe process", "type": "main", "index": 0}]]},
    "Brand-Pipe process": {"main": [[{"node": "Success?", "type": "main", "index": 0}]]},
    "Success?": {"main": [[{"node": "Download result", "type": "main", "index": 0}], [{"node": "Stop with error", "type": "main", "index": 0}]]}
  },
  "settings": {"executionOrder": "v1"},
  "meta": {"templateCredsSetupCompleted": false}
}
