{
"nodes": [
{
"parameters": {
"content": "## Input Settings",
"height": 972,
"width": 484,
"color": 5
},
"type": "n8n-nodes-base.stickyNote",
"position": [
-368,
848
],
"typeVersion": 1,
"id": "4c04b771-8f59-433f-82a4-fb265e691413",
"name": "Sticky Note"
},
{
"parameters": {
"content": "## Download TikTok + Analyze Video",
"height": 992,
"width": 424,
"color": 6
},
"type": "n8n-nodes-base.stickyNote",
"position": [
256,
832
],
"typeVersion": 1,
"id": "7c5cef10-79dc-40fb-aa79-b0e0e0781168",
"name": "Sticky Note2"
},
{
"parameters": {
"content": "## Generate Image",
"height": 1020,
"width": 360,
"color": 4
},
"type": "n8n-nodes-base.stickyNote",
"position": [
1264,
832
],
"typeVersion": 1,
"id": "2f795970-da42-4b7d-87c3-43caa07f1967",
"name": "Sticky Note3"
},
{
"parameters": {
"fieldToSplitOut": "scenes",
"options": {}
},
"type": "n8n-nodes-base.splitOut",
"typeVersion": 1,
"position": [
976,
1232
],
"id": "349b104d-cdee-44f5-87fe-b056191159f1",
"name": "Split Out"
},
{
"parameters": {
"method": "POST",
"url": "<https://api.kie.ai/api/v1/jobs/createTask>",
"authentication": "genericCredentialType",
"genericAuthType": "httpBearerAuth",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\\n \\"model\\": \\"google/nano-banana\\",\\n \\"input\\": {\\n \\"prompt\\": \\"{{ $json.image_generation_prompt }}\\",\\n \\"output_format\\": \\"png\\",\\n \\"image_size\\": \\"9:16\\"\\n }\\n}",
"options": {
"batching": {
"batch": {
"batchSize": 1
}
}
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1392,
992
],
"id": "624ce382-3278-48f3-9b39-fa3c77547644",
"name": "Generate Images",
"retryOnFail": true,
"waitBetweenTries": 5000,
"credentials": {
"httpHeaderAuth": {
"id": "kgMgZwMC6DC9c3ZK",
"name": "Uazapi Auth account - 5511966655481"
},
"httpBearerAuth": {
"id": "3l9Ostq7CAoKo0t7",
"name": "Kie AI"
}
}
},
{
"parameters": {
"amount": 40
},
"type": "n8n-nodes-base.wait",
"typeVersion": 1.1,
"position": [
1392,
1168
],
"id": "a19a84f0-2326-4965-bf92-bb659657e414",
"name": "Wait",
"webhookId": "b4be0b66-48e7-4c61-9b62-e733b54b2ff9"
},
{
"parameters": {
"amount": 60
},
"type": "n8n-nodes-base.wait",
"typeVersion": 1.1,
"position": [
1920,
1184
],
"id": "d4186043-dbe7-4136-82e1-3ddd18695a7b",
"name": "Wait1",
"webhookId": "f6c38e9e-7fb3-4886-9fd7-a752d2414610"
},
{
"parameters": {
"method": "POST",
"url": "<https://queue.fal.run/fal-ai/pixverse/v5/image-to-video>",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\\n \\"prompt\\": \\"{{ $('Split Out').item.json.animation_prompt }}\\",\\n \\"aspect_ratio\\": \\"9:16\\",\\n \\"resolution\\": \\"540p\\",\\n \\"duration\\": \\"5\\",\\n \\"negative_prompt\\": \\"blurry, low quality, low resolution, pixelated, noisy, grainy, out of focus, poorly lit, poorly exposed, poorly composed, poorly framed, poorly cropped, poorly color corrected, poorly color graded\\",\\n \\"image_url\\": \\"{{ $json.data.resultJson.parseJson().resultUrls[0] }}\\"\\n}",
"options": {
"batching": {
"batch": {
"batchSize": 1
}
}
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1920,
1008
],
"id": "e8e5e052-992b-42c7-bbd1-63790e13c351",
"name": "Generate Animations",
"retryOnFail": true,
"waitBetweenTries": 5000,
"credentials": {
"httpBearerAuth": {
"id": "3l9Ostq7CAoKo0t7",
"name": "Kie AI"
},
"httpHeaderAuth": {
"id": "yUoSIpVN78MDAu36",
"name": "Fal Header Auth account"
}
}
},
{
"parameters": {
"url": "<https://api.kie.ai/api/v1/jobs/recordInfo>",
"authentication": "genericCredentialType",
"genericAuthType": "httpBearerAuth",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "taskId",
"value": "={{ $('Generate Images').item.json.data.taskId }}"
}
]
},
"options": {
"batching": {
"batch": {
"batchSize": 1
}
}
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1392,
1312
],
"id": "6badf41c-446a-4b73-b348-639f57b172bf",
"name": "Get Status Image",
"retryOnFail": true,
"waitBetweenTries": 5000,
"credentials": {
"httpBearerAuth": {
"id": "3l9Ostq7CAoKo0t7",
"name": "Kie AI"
}
}
},
{
"parameters": {
"url": "=https://queue.fal.run/fal-ai/pixverse/requests/{{ $json.request_id }}/status",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"options": {
"batching": {
"batch": {
"batchSize": 1
}
}
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1920,
1328
],
"id": "9462f90a-c3a7-4cfa-b25a-5fd932982c37",
"name": "Get Status Animation",
"retryOnFail": true,
"waitBetweenTries": 5000,
"credentials": {
"httpBearerAuth": {
"id": "3l9Ostq7CAoKo0t7",
"name": "Kie AI"
},
"httpHeaderAuth": {
"id": "yUoSIpVN78MDAu36",
"name": "Fal Header Auth account"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "9c94b8f4-3480-468a-8d9e-e108da83feb8",
"leftValue": "={{ $json.status }}",
"rightValue": "COMPLETED",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
1920,
1520
],
"id": "c030dad8-8d91-4251-ab61-d1a58d8e03df",
"name": "If - Animations"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "e787df07-8cf1-4f65-9429-b1cbc47af60b",
"leftValue": "={{ $('Get Status Image').item.json.data.state }}",
"rightValue": "success",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
1392,
1520
],
"id": "3b67394c-f4c9-435b-bfd4-9f6c975936c8",
"name": "If - Images"
},
{
"parameters": {
"method": "POST",
"url": "<https://queue.fal.run/fal-ai/mmaudio-v2/text-to-audio>",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\\n \\"prompt\\": \\"{{ $('Split Out').item.json.sound_effects_prompt }}\\",\\n \\"num_steps\\": 25,\\n \\"duration\\": 5,\\n \\"cfg_strength\\": 4.5\\n}",
"options": {
"batching": {
"batch": {
"batchSize": 1
}
}
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
2960,
1056
],
"id": "76fc43fd-c13e-4ffb-a7e0-26f30caae29a",
"name": "Generate Sound Effects",
"retryOnFail": true,
"waitBetweenTries": 5000,
"credentials": {
"httpHeaderAuth": {
"id": "yUoSIpVN78MDAu36",
"name": "Fal Header Auth account"
}
}
},
{
"parameters": {
"amount": 40
},
"type": "n8n-nodes-base.wait",
"typeVersion": 1.1,
"position": [
3136,
1056
],
"id": "a37d3673-9316-43d9-8bd1-5e64f16637df",
"name": "Wait2",
"webhookId": "74b18378-f3eb-4839-8049-6a1d81196359"
},
{
"parameters": {
"url": "=https://queue.fal.run/fal-ai/mmaudio-v2/requests/{{ $json.request_id }}/status ",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"options": {
"batching": {
"batch": {
"batchSize": 1
}
}
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
3312,
1056
],
"id": "f274a2ac-54fb-4201-8d1e-6b0d6cc4b410",
"name": "Get Status Sound",
"retryOnFail": true,
"waitBetweenTries": 5000,
"credentials": {
"httpHeaderAuth": {
"id": "yUoSIpVN78MDAu36",
"name": "Fal Header Auth account"
}
}
},
{
"parameters": {
"url": "=https://queue.fal.run/fal-ai/mmaudio-v2/requests/{{ $json.request_id }}",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"options": {
"batching": {
"batch": {
"batchSize": 1
}
}
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
3712,
1040
],
"id": "86b6e21f-9fa8-490a-a3c8-bdade1acb9f7",
"name": "Get Sounds Effects",
"retryOnFail": true,
"waitBetweenTries": 5000,
"credentials": {
"httpBearerAuth": {
"id": "qQXEwHoOMI42O3oS",
"name": "Tavily Bearer Auth account"
},
"httpHeaderAuth": {
"id": "yUoSIpVN78MDAu36",
"name": "Fal Header Auth account"
}
}
},
{
"parameters": {
"method": "POST",
"url": "<https://queue.fal.run/fal-ai/ffmpeg-api/merge-audio-video>",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\\n \\"video_url\\": \\"{{ $('Get Animations').item.json.video.url }}\\",\\n \\"audio_url\\": \\"{{ $json.audio.url }}\\"\\n}",
"options": {
"batching": {
"batch": {
"batchSize": 1
}
}
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
4192,
1040
],
"id": "96b55ce6-3e91-4c7d-95a5-e92bdf696162",
"name": "Merge Video & Audio",
"retryOnFail": true,
"waitBetweenTries": 5000,
"credentials": {
"httpHeaderAuth": {
"id": "yUoSIpVN78MDAu36",
"name": "Fal Header Auth account"
}
}
},
{
"parameters": {
"amount": 60
},
"type": "n8n-nodes-base.wait",
"typeVersion": 1.1,
"position": [
4384,
1040
],
"id": "63331568-c152-4bff-9d7c-3dfd7e06997a",
"name": "Wait3",
"webhookId": "cc0a9a3f-ab90-4d4b-a1b8-6a421cce4ad0"
},
{
"parameters": {
"url": "=https://queue.fal.run/fal-ai/ffmpeg-api/requests/{{ $json.request_id }}/status",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
4560,
1040
],
"id": "2fcb9f96-8467-45a5-877d-0cf3e9064c88",
"name": "Merge Status",
"retryOnFail": true,
"waitBetweenTries": 5000,
"credentials": {
"httpHeaderAuth": {
"id": "yUoSIpVN78MDAu36",
"name": "Fal Header Auth account"
}
}
},
{
"parameters": {
"url": "=https://queue.fal.run/fal-ai/ffmpeg-api/requests/{{ $json.request_id }}",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"options": {
"batching": {
"batch": {
"batchSize": 1
}
}
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
5056,
1024
],
"id": "3ac12fca-e68c-4932-84b3-8fcfe1274440",
"name": "Get Video + Sound",
"retryOnFail": true,
"waitBetweenTries": 5000,
"credentials": {
"httpHeaderAuth": {
"id": "yUoSIpVN78MDAu36",
"name": "Fal Header Auth account"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "c264e033-e859-4456-94f9-85c19fbe0a2c",
"leftValue": "={{ $json.status }}",
"rightValue": "COMPLETED",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
4736,
1040
],
"id": "72f71897-cf09-447f-9350-3c4ee5cfc264",
"name": "If - Merge"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "d64aaf87-4dfc-4c21-a1e7-880a62d9dc27",
"leftValue": "={{ $json.status }}",
"rightValue": "COMPLETED",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
3488,
1056
],
"id": "a62aa046-353b-4be3-bdf0-3d43efdce9df",
"name": "If - Sound"
},
{
"parameters": {
"fieldsToAggregate": {
"fieldToAggregate": [
{
"fieldToAggregate": "video.url",
"renameField": true,
"outputFieldName": "video_url"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.aggregate",
"typeVersion": 1,
"position": [
5472,
1296
],
"id": "eb3177f7-b867-4dfa-a38f-337b5543e360",
"name": "Aggregate"
},
{
"parameters": {
"amount": "=40.00"
},
"type": "n8n-nodes-base.wait",
"typeVersion": 1.1,
"position": [
6384,
960
],
"id": "606346ef-7dd3-4748-86a2-cf2ee29ac2b6",
"name": "Wait4",
"webhookId": "b741a262-75d1-49d7-a34f-9164f3af8f8c"
},
{
"parameters": {
"url": "=https://queue.fal.run/fal-ai/ffmpeg-api/requests/{{ $json.request_id }}/status",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
6576,
960
],
"id": "812094f6-6ed0-40c8-9a04-b0e070595d79",
"name": "Get Merge Status",
"retryOnFail": true,
"waitBetweenTries": 5000,
"credentials": {
"httpHeaderAuth": {
"id": "yUoSIpVN78MDAu36",
"name": "Fal Header Auth account"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "71f6ea29-4010-4bc7-a656-687b694d647b",
"leftValue": "={{ $json.status }}",
"rightValue": "COMPLETED",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
6768,
960
],
"id": "3193e5d0-712e-427d-897f-a37b41eeb22f",
"name": "If - Final Video"
},
{
"parameters": {
"url": "=https://queue.fal.run/fal-ai/ffmpeg-api/requests/{{ $json.request_id }}",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
6224,
1168
],
"id": "3769a72a-70c6-4943-b8e9-5d91d10e9148",
"name": "Get Final Video",
"retryOnFail": true,
"waitBetweenTries": 5000,
"credentials": {
"httpHeaderAuth": {
"id": "yUoSIpVN78MDAu36",
"name": "Fal Header Auth account"
}
}
},
{
"parameters": {
"method": "POST",
"url": "<https://queue.fal.run/fal-ai/mmaudio-v2/text-to-audio>",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\\n \\"prompt\\": \\"{{ $('Code').item.json.background_music_prompt }}\\",\\n \\"num_steps\\": 25,\\n \\"duration\\": 20,\\n \\"cfg_strength\\": 4.5\\n}",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
2960,
1504
],
"id": "6b90c521-1b26-4a3c-addf-c957962281dc",
"name": "Generate Background Music",
"credentials": {
"httpHeaderAuth": {
"id": "yUoSIpVN78MDAu36",
"name": "Fal Header Auth account"
}
}
},
{
"parameters": {
"content": "## Generate Animations",
"height": 1020,
"width": 360,
"color": 4
},
"type": "n8n-nodes-base.stickyNote",
"position": [
1792,
832
],
"typeVersion": 1,
"id": "63e1f07e-b611-492a-8370-21536eb2817c",
"name": "Sticky Note4"
},
{
"parameters": {
"content": "## Generate Sound Effects",
"height": 396,
"width": 1112,
"color": 7
},
"type": "n8n-nodes-base.stickyNote",
"position": [
2848,
928
],
"typeVersion": 1,
"id": "4ea8dd34-c38b-44c0-a10d-db3e112eca5c",
"name": "Sticky Note5"
},
{
"parameters": {
"content": "## Merge Clips & Sounds",
"height": 396,
"width": 1176,
"color": 7
},
"type": "n8n-nodes-base.stickyNote",
"position": [
4128,
928
],
"typeVersion": 1,
"id": "06bad9b5-bea2-4971-b92c-f0576e682173",
"name": "Sticky Note6"
},
{
"parameters": {
"content": "## Create Final Video",
"height": 428,
"width": 904,
"color": 4
},
"type": "n8n-nodes-base.stickyNote",
"position": [
6096,
896
],
"typeVersion": 1,
"id": "4a766fb3-65cf-446b-b02f-2d7b5c696744",
"name": "Sticky Note7"
},
{
"parameters": {
"amount": 40
},
"type": "n8n-nodes-base.wait",
"typeVersion": 1.1,
"position": [
3136,
1504
],
"id": "3a13b742-afe6-449f-b950-3ff49101efe5",
"name": "Wait5",
"webhookId": "e764673e-4349-4e82-87a6-c362b7bc8778"
},
{
"parameters": {
"url": "=https://queue.fal.run/fal-ai/mmaudio-v2/requests/{{ $json.request_id }}/status ",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
3312,
1504
],
"id": "6634d74e-a052-4fb6-afe8-6c77f003ab23",
"name": "Get Status Bg Sound",
"credentials": {
"httpHeaderAuth": {
"id": "yUoSIpVN78MDAu36",
"name": "Fal Header Auth account"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "d64aaf87-4dfc-4c21-a1e7-880a62d9dc27",
"leftValue": "={{ $json.status }}",
"rightValue": "COMPLETED",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
3472,
1504
],
"id": "69414c21-513f-43a1-a315-a3c0f778eb8e",
"name": "If - Sound1"
},
{
"parameters": {
"url": "=https://queue.fal.run/fal-ai/mmaudio-v2/requests/{{ $json.request_id }}",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"options": {
"batching": {
"batch": {
"batchSize": 1
}
}
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
3696,
1488
],
"id": "9b5c8baa-564c-4828-afad-9478d9f36092",
"name": "Get Bg Sound",
"credentials": {
"httpBearerAuth": {
"id": "qQXEwHoOMI42O3oS",
"name": "Tavily Bearer Auth account"
},
"httpHeaderAuth": {
"id": "yUoSIpVN78MDAu36",
"name": "Fal Header Auth account"
}
}
},
{
"parameters": {
"method": "POST",
"url": "<https://queue.fal.run/fal-ai/ffmpeg-api/merge-audio-video>",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\\n \\"video_url\\": \\"{{ $('Get Animations').item.json.video.url }}\\",\\n \\"audio_url\\": \\"{{ $json.audio.url }}\\"\\n}",
"options": {
"batching": {
"batch": {
"batchSize": 1
}
}
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
4192,
1488
],
"id": "84718671-207c-4ba2-bb66-20ee3f286aeb",
"name": "Merge Video & Background Sound",
"credentials": {
"httpHeaderAuth": {
"id": "yUoSIpVN78MDAu36",
"name": "Fal Header Auth account"
}
}
},
{
"parameters": {
"amount": 60
},
"type": "n8n-nodes-base.wait",
"typeVersion": 1.1,
"position": [
4416,
1488
],
"id": "68f78b9a-409c-4fdd-996d-591dd02f0528",
"name": "Wait6",
"webhookId": "cc0a9a3f-ab90-4d4b-a1b8-6a421cce4ad0"
},
{
"parameters": {
"url": "=https://queue.fal.run/fal-ai/ffmpeg-api/requests/{{ $json.request_id }}/status",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
4624,
1488
],
"id": "f628b346-3e36-4a00-b339-56278098f71a",
"name": "Merge Video & Bg Sound Status",
"credentials": {
"httpHeaderAuth": {
"id": "yUoSIpVN78MDAu36",
"name": "Fal Header Auth account"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "c264e033-e859-4456-94f9-85c19fbe0a2c",
"leftValue": "={{ $json.status }}",
"rightValue": "COMPLETED",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
4832,
1488
],
"id": "58c7ea19-6d8a-46d0-9df2-19d2e2fddac7",
"name": "If - Merge1"
},
{
"parameters": {
"jsCode": "let jsonString = $input.first().json.analysis_result;\\n\\n// Remove all markdown code block markers and clean up\\njsonString = jsonString\\n .replace(/^```json\\\\n?/g, '') // Remove opening ```json\\n .replace(/\\\\n?```$/g, '') // Remove closing ```\\n .replace(/^\\\\n+|\\\\n+$/g, '') // Remove leading/trailing newlines\\n .trim(); // Remove any remaining whitespace\\n\\nconst jsonObject = JSON.parse(jsonString);\\n\\nreturn {\\n json: jsonObject\\n};"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
768,
1232
],
"id": "7254e968-66d1-4ece-83fd-5dd57b5699e4",
"name": "Code"
},
{
"parameters": {
"url": "=https://queue.fal.run/fal-ai/ffmpeg-api/requests/{{ $json.request_id }}",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
5072,
1472
],
"id": "69f1a5cb-9a26-41f1-9c45-0c0dea36a3bd",
"name": "Get Final Video With Bg Sound",
"credentials": {
"httpHeaderAuth": {
"id": "yUoSIpVN78MDAu36",
"name": "Fal Header Auth account"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "f302b2c5-43cb-41f0-91f5-e91f72397ae4",
"name": "prompt",
"value": "=You are a creative director for a TikTok account that specializes in AI-generated videos. Your task is to analyze an original video and create a comprehensive set of AI prompts that will allow you to recreate videos with similar visual and technical qualities using different AI generation models.\\n\\nYour goal is to extract all essential elements from the original video and translate them into specific prompts for different AI systems: image generation, animation generation, sound effects generation, and background music generation.\\n\\nYou will work through this systematically in three steps:\\n\\n## Step 1: Comprehensive Video Analysis\\n\\nBegin your analysis by carefully reading through the original video information. First, quote the most important and specific details from the original video info that will be crucial for recreating the video - these are the key elements you'll need to reference throughout your work.\\n\\nThen systematically work through each of these seven categories and extract every specific detail you can identify. It's OK for this section to be quite long.\\n\\n1. **Visual Aesthetics**: Colors (palette, saturation, temperature), lighting setup (natural/artificial, direction, intensity), overall mood and tone\\n2. **Technical Specifications**: Camera angles, shot types (wide, medium, close-up), camera movement (static, panning, tracking), frame composition and aspect ratio\\n3. **Subject & Characters**: Number of people/objects, positioning, clothing/appearance, actions and movements, facial expressions or gestures, character transitions throughout the scene\\n4. **Environmental Details**: Location type (indoor/outdoor), background elements, props, set design, weather conditions if applicable\\n5. **Timing & Pacing**: Duration of shots, rhythm of cuts, speed of movements, any slow-motion or time-lapse effects\\n6. **Physics & Realism**: How objects move and interact, gravity effects, material properties, realistic vs stylized elements\\n7. **Audio-Visual Elements**: Visual elements that suggest specific sounds, music beats, or audio cues\\n\\nFinally, list the 5-10 most critical elements that must be preserved to maintain the video's essential character and appeal.\\n\\nWrite your detailed analysis in <analysis> tags. This section should be thorough, as comprehensive analysis is crucial for creating accurate AI prompts.\\n\\n## Step 2: Scene Breakdown\\n\\nDivide the video into a maximum of 4 distinct scenes, with each scene being exactly 5 seconds long. For each scene, identify:\\n- Duration (5 seconds each)\\n- Key visual elements that would need to be generated as images\\n- Movement and animation requirements\\n- Implied sound effects\\n- How each scene contributes to the overall mood for background music\\n\\nWrite your scene breakdown in <scene_breakdown> tags.\\n\\n## Step 3: Generate Multi-Modal AI Prompts\\n\\nCreate a JSON structure that contains specific prompts for each AI generation task. Your JSON output must follow this exact structure:\\n\\n```json\\n{\\n \\"video_title\\": \\"[descriptive title for the video]\\",\\n \\"overall_style\\": {\\n \\"visual_theme\\": \\"[overall aesthetic description]\\",\\n \\"mood\\": \\"[emotional tone and atmosphere]\\", \\n \\"technical_approach\\": \\"[general technical specifications]\\"\\n },\\n \\"scenes\\": [\\n {\\n \\"scene_number\\": 1,\\n \\"duration\\": \\"5 seconds\\",\\n \\"aspect_ratio\\": \\"[aspect ratio for this scene, e.g., 9:16 for TikTok vertical]\\",\\n \\"image_generation_prompt\\": \\"[detailed prompt for generating the key frame/image for this scene]\\",\\n \\"animation_prompt\\": \\"[specific instructions for animating the scene elements]\\",\\n \\"sound_effects_prompt\\": \\"[description of sound effects needed for this scene]\\"\\n }\\n ],\\n \\"background_music_prompt\\": \\"[comprehensive prompt for generating background music that fits the entire video's mood and pacing]\\"\\n}\\n```\\n\\n## Requirements for Your Prompts:\\n\\n- Each image generation prompt must be detailed enough to recreate the visual style and composition\\n- Animation prompts must be specific about movement types, speeds, and directions\\n- Sound effects prompts must capture both obvious and subtle audio elements \\n- Background music prompt must complement the overall video rhythm and mood\\n- Include the aspect_ratio parameter for each scene (typically 9:16 for TikTok vertical format)\\n- Maintain consistency across all scenes while allowing for natural progression\\n- Optimize all prompts for TikTok platform requirements (vertical format, engaging content, appropriate pacing)\\n- Limit to maximum 4 scenes of 5 seconds each\\n- Each scene duration must be exactly \\"5 seconds\\" in the JSON\\n\\nAfter completing your analysis and scene breakdown, *RETURN JUST THE JSON OUTPUT* without analysis text.",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-80,
1264
],
"id": "2b330b62-2352-4012-810a-c67dc75b854a",
"name": "Set System Prompt"
},
{
"parameters": {
"method": "POST",
"url": "<https://api.apify.com/v2/acts/clockworks~free-tiktok-scraper/run-sync-get-dataset-items>",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\\n \\"excludePinnedPosts\\": false,\\n \\"oldestPostDateUnified\\": \\"30 days\\",\\n \\"postURLs\\": [\\n \\"{{ $('Form Trigger').item.json.Url }}\\"\\n ],\\n \\"profileScrapeSections\\": [\\n \\"videos\\"\\n ],\\n \\"profileSorting\\": \\"popular\\",\\n \\"resultsPerPage\\": 10,\\n \\"shouldDownloadCovers\\": false,\\n \\"shouldDownloadSlideshowImages\\": false,\\n \\"shouldDownloadSubtitles\\": false,\\n \\"shouldDownloadVideos\\": true\\n}",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
416,
960
],
"id": "abcca578-819f-4349-b3ac-1899fb6b6ee5",
"name": "Scrape TikTok",
"retryOnFail": true,
"maxTries": 3,
"waitBetweenTries": 5000,
"credentials": {
"httpHeaderAuth": {
"id": "arYBovrDtwxa2uLB",
"name": "Apify Auth account"
}
}
},
{
"parameters": {
"url": "={{ $('Scrape TikTok').item.json.videoMeta.downloadAddr }}",
"options": {
"response": {
"response": {
"responseFormat": "file"
}
}
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
416,
1152
],
"id": "ff8fd8d1-c6bb-4a38-809e-1e5e4f05e406",
"name": "Download TikTok"
},
{
"parameters": {
"operation": "binaryToPropery",
"options": {}
},
"type": "n8n-nodes-base.extractFromFile",
"typeVersion": 1,
"position": [
416,
1312
],
"id": "643cc6d3-214a-4fbd-a11f-a58efe360613",
"name": "TikTok to base64"
},
{
"parameters": {
"method": "POST",
"url": "<https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-pro:generateContent>",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\\n \\"contents\\": [\\n {\\n \\"parts\\": [\\n {\\n \\"inline_data\\": {\\n \\"mime_type\\": \\"video/mp4\\",\\n \\"data\\": \\"{{ $json.data }}\\"\\n }\\n },\\n {\\n \\"text\\": {{ JSON.stringify($('Set System Prompt').item.json.prompt) }}\\n }\\n ]\\n }\\n ]\\n}",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
416,
1472
],
"id": "cf93f407-2839-48ea-a03b-52b994329d7b",
"name": "Analyze TikTok Video",
"retryOnFail": true,
"waitBetweenTries": 5000,
"credentials": {
"httpHeaderAuth": {
"id": "XlKxzFd8Mgz5rBje",
"name": "Google Gemini Auth"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "eccbeb92-af90-4244-8e23-2cd3e2616a07",
"name": "analysis_result",
"value": "={{ $json.candidates[0].content.parts[0].text }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
416,
1632
],
"id": "73f753d5-9649-4fd1-b179-27614efe4f36",
"name": "TikTok Analysis Result"
},
{
"parameters": {
"content": "## Generate Background Music",
"height": 364,
"width": 1112,
"color": 7
},
"type": "n8n-nodes-base.stickyNote",
"position": [
2848,
1392
],
"typeVersion": 1,
"id": "5cc70e0b-3b47-4a03-9cb2-30e648bac9ab",
"name": "Sticky Note8"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "ecc3de67-9575-4b98-b1ba-da1b6384cd12",
"leftValue": "={{ $('Form Trigger').item.json['Tipo de Som'] }}",
"rightValue": "Efeitos Sonoros",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
2528,
1312
],
"id": "cf60e458-f55e-4f5f-a52a-c8e7c3d92206",
"name": "If"
},
{
"parameters": {
"content": "## Merge Clips & Music",
"height": 364,
"width": 1176,
"color": 7
},
"type": "n8n-nodes-base.stickyNote",
"position": [
4128,
1392
],
"typeVersion": 1,
"id": "799cafcb-5c15-4e3b-b517-ce236649b65f",
"name": "Sticky Note9"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "19de1c02-3b04-43a5-8078-bf9f7eddaee1",
"leftValue": "={{ $json.video_url.length }}",
"rightValue": 1,
"operator": {
"type": "number",
"operation": "gt"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
5744,
1296
],
"id": "edfee8f0-c5d4-4aea-8455-556458167a97",
"name": "If - Check Number of Videos"
},
{
"parameters": {
"operation": "completion",
"completionTitle": "URL do Vídeo",
"completionMessage": "={{ $json.video.url }}",
"options": {}
},
"type": "n8n-nodes-base.form",
"typeVersion": 2.3,
"position": [
6464,
1536
],
"id": "eda0c7b4-8432-4203-b06b-050f5fe18ebb",
"name": "Form",
"webhookId": "943050c1-fc11-47f4-b54a-8da0e2557cd8"
},
{
"parameters": {
"content": "## Video URL",
"height": 396,
"width": 904,
"color": 4
},
"type": "n8n-nodes-base.stickyNote",
"position": [
6096,
1360
],
"typeVersion": 1,
"id": "55b66a2e-93c6-475e-a2ce-b595eeff5697",
"name": "Sticky Note10"
},
{
"parameters": {
"method": "POST",
"url": "<https://queue.fal.run/fal-ai/ffmpeg-api/merge-videos>",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendBody": true,
"specifyBody": "=json",
"bodyParameters": {
"parameters": [
{}
]
},
"jsonBody": "={\\n \\"video_urls\\": [\\n {{ $('Aggregate').item.json.video_url.map(item => `\\"${item}\\"`) }}\\n ],\\n \\"target_fps\\": 30,\\n \\"resolution\\": \\"portrait_16_9\\"\\n}",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
6208,
960
],
"id": "5d70f4a1-b9a6-4bc5-bc17-eef630e13d76",
"name": "Create Final Video",
"retryOnFail": true,
"waitBetweenTries": 5000,
"credentials": {
"httpHeaderAuth": {
"id": "yUoSIpVN78MDAu36",
"name": "Fal Header Auth account"
}
}
},
{
"parameters": {
"url": "=https://queue.fal.run/fal-ai/pixverse/requests/{{ $json.request_id }}",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"options": {
"batching": {
"batch": {
"batchSize": 1
}
}
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
2272,
1312
],
"id": "3578863d-0efe-4535-89ad-121d4dc72d9b",
"name": "Get Animations",
"retryOnFail": true,
"waitBetweenTries": 5000,
"credentials": {
"httpBearerAuth": {
"id": "3l9Ostq7CAoKo0t7",
"name": "Kie AI"
},
"httpHeaderAuth": {
"id": "yUoSIpVN78MDAu36",
"name": "Fal Header Auth account"
}
}
},
{
"parameters": {
"formTitle": "Criar Vídeo Curto para TikTok",
"formDescription": "Forneça a URL de um vídeo do TikTok",
"formFields": {
"values": [
{
"fieldLabel": "Url",
"requiredField": true
},
{
"fieldLabel": "Tipo de Som",
"fieldType": "dropdown",
"fieldOptions": {
"values": [
{
"option": "Música de Fundo"
},
{
"option": "Efeitos Sonoros"
}
]
},
"requiredField": true
}
]
},
"options": {}
},
"type": "n8n-nodes-base.formTrigger",
"typeVersion": 2.2,
"position": [
-304,
1264
],
"id": "709f8be2-d6de-4573-a203-e07ac28e01f0",
"name": "Form Trigger",
"webhookId": "8db8f807-4b93-4a74-81b6-290cc1d459e8"
}
],
"connections": {
"Split Out": {
"main": [
[
{
"node": "Generate Images",
"type": "main",
"index": 0
}
]
]
},
"Generate Images": {
"main": [
[
{
"node": "Wait",
"type": "main",
"index": 0
}
]
]
},
"Wait": {
"main": [
[
{
"node": "Get Status Image",
"type": "main",
"index": 0
}
]
]
},
"Wait1": {
"main": [
[
{
"node": "Get Status Animation",
"type": "main",
"index": 0
}
]
]
},
"Generate Animations": {
"main": [
[
{
"node": "Wait1",
"type": "main",
"index": 0
}
]
]
},
"Get Status Image": {
"main": [
[
{
"node": "If - Images",
"type": "main",
"index": 0
}
]
]
},
"Get Status Animation": {
"main": [
[
{
"node": "If - Animations",
"type": "main",
"index": 0
}
]
]
},
"If - Animations": {
"main": [
[
{
"node": "Get Animations",
"type": "main",
"index": 0
}
],
[
{
"node": "Wait1",
"type": "main",
"index": 0
}
]
]
},
"If - Images": {
"main": [
[
{
"node": "Generate Animations",
"type": "main",
"index": 0
}
],
[
{
"node": "Wait",
"type": "main",
"index": 0
}
]
]
},
"Generate Sound Effects": {
"main": [
[
{
"node": "Wait2",
"type": "main",
"index": 0
}
]
]
},
"Wait2": {
"main": [
[
{
"node": "Get Status Sound",
"type": "main",
"index": 0
}
]
]
},
"Get Status Sound": {
"main": [
[
{
"node": "If - Sound",
"type": "main",
"index": 0
}
]
]
},
"Get Sounds Effects": {
"main": [
[
{
"node": "Merge Video & Audio",
"type": "main",
"index": 0
}
]
]
},
"Merge Video & Audio": {
"main": [
[
{
"node": "Wait3",
"type": "main",
"index": 0
}
]
]
},
"Wait3": {
"main": [
[
{
"node": "Merge Status",
"type": "main",
"index": 0
}
]
]
},
"Merge Status": {
"main": [
[
{
"node": "If - Merge",
"type": "main",
"index": 0
}
]
]
},
"Get Video + Sound": {
"main": [
[
{
"node": "Aggregate",
"type": "main",
"index": 0
}
]
]
},
"If - Merge": {
"main": [
[
{
"node": "Get Video + Sound",
"type": "main",
"index": 0
}
],
[
{
"node": "Wait3",
"type": "main",
"index": 0
}
]
]
},
"If - Sound": {
"main": [
[
{
"node": "Get Sounds Effects",
"type": "main",
"index": 0
}
],
[
{
"node": "Wait2",
"type": "main",
"index": 0
}
]
]
},
"Aggregate": {
"main": [
[
{
"node": "If - Check Number of Videos",
"type": "main",
"index": 0
}
]
]
},
"Wait4": {
"main": [
[
{
"node": "Get Merge Status",
"type": "main",
"index": 0
}
]
]
},
"Get Merge Status": {
"main": [
[
{
"node": "If - Final Video",
"type": "main",
"index": 0
}
]
]
},
"If - Final Video": {
"main": [
[
{
"node": "Get Final Video",
"type": "main",
"index": 0
}
],
[
{
"node": "Wait4",
"type": "main",
"index": 0
}
]
]
},
"Get Final Video": {
"main": [
[
{
"node": "Form",
"type": "main",
"index": 0
}
]
]
},
"Generate Background Music": {
"main": [
[
{
"node": "Wait5",
"type": "main",
"index": 0
}
]
]
},
"Wait5": {
"main": [
[
{
"node": "Get Status Bg Sound",
"type": "main",
"index": 0
}
]
]
},
"Get Status Bg Sound": {
"main": [
[
{
"node": "If - Sound1",
"type": "main",
"index": 0
}
]
]
},
"If - Sound1": {
"main": [
[
{
"node": "Get Bg Sound",
"type": "main",
"index": 0
}
],
[
{
"node": "Wait5",
"type": "main",
"index": 0
}
]
]
},
"Get Bg Sound": {
"main": [
[
{
"node": "Merge Video & Background Sound",
"type": "main",
"index": 0
}
]
]
},
"Merge Video & Background Sound": {
"main": [
[
{
"node": "Wait6",
"type": "main",
"index": 0
}
]
]
},
"Wait6": {
"main": [
[
{
"node": "Merge Video & Bg Sound Status",
"type": "main",
"index": 0
}
]
]
},
"Merge Video & Bg Sound Status": {
"main": [
[
{
"node": "If - Merge1",
"type": "main",
"index": 0
}
]
]
},
"If - Merge1": {
"main": [
[
{
"node": "Get Final Video With Bg Sound",
"type": "main",
"index": 0
}
],
[
{
"node": "Wait6",
"type": "main",
"index": 0
}
]
]
},
"Code": {
"main": [
[
{
"node": "Split Out",
"type": "main",
"index": 0
}
]
]
},
"Get Final Video With Bg Sound": {
"main": [
[
{
"node": "Aggregate",
"type": "main",
"index": 0
}
]
]
},
"Set System Prompt": {
"main": [
[
{
"node": "Scrape TikTok",
"type": "main",
"index": 0
}
]
]
},
"Scrape TikTok": {
"main": [
[
{
"node": "Download TikTok",
"type": "main",
"index": 0
}
]
]
},
"Download TikTok": {
"main": [
[
{
"node": "TikTok to base64",
"type": "main",
"index": 0
}
]
]
},
"TikTok to base64": {
"main": [
[
{
"node": "Analyze TikTok Video",
"type": "main",
"index": 0
}
]
]
},
"Analyze TikTok Video": {
"main": [
[
{
"node": "TikTok Analysis Result",
"type": "main",
"index": 0
}
]
]
},
"TikTok Analysis Result": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
},
"If": {
"main": [
[
{
"node": "Generate Sound Effects",
"type": "main",
"index": 0
}
],
[
{
"node": "Generate Background Music",
"type": "main",
"index": 0
}
]
]
},
"If - Check Number of Videos": {
"main": [
[
{
"node": "Create Final Video",
"type": "main",
"index": 0
}
],
[
{
"node": "Form",
"type": "main",
"index": 0
}
]
]
},
"Create Final Video": {
"main": [
[
{
"node": "Wait4",
"type": "main",
"index": 0
}
]
]
},
"Get Animations": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"Form Trigger": {
"main": [
[
{
"node": "Set System Prompt",
"type": "main",
"index": 0
}
]
]
}
},
"pinData": {},
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "8fd950fde1d0c8a982e2646b0a5c997b58a25137131408902febf7df066da10f"
}
}