{
  "id": "yse1mAc8808uJEDV",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Generate Audio from Video & Produce Final Video with New Sound",
  "tags": [],
  "nodes": [
    {
      "id": "47f0b7ce-b304-443c-9c41-8ec40b58028f",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -16,
        352
      ],
      "parameters": {
        "width": 480,
        "height": 592,
        "content": "## Generate Audio from Video & Produce Final Video with New Sound\n\n### How it works\n\nThis workflow accepts a video through a form, sends it to FAL's Sonilo API to generate replacement audio, and polls until the audio job is complete. It then uses a FAL FFmpeg API job to merge the generated audio with the original video, polling again until the final video is ready. The completed video is downloaded and uploaded to Google Drive.\n\n### Setup steps\n\n- Configure the form trigger fields so the workflow receives the source video input expected by the HTTP request nodes.\n- Add the required FAL API authentication or headers to all FAL HTTP Request nodes for the Sonilo and FFmpeg queue endpoints.\n- Verify the expressions that pass request IDs, audio URLs, and video URLs between the status, result, and merge nodes.\n- Connect Google Drive credentials in the upload node and choose the destination folder for the final video.\n\n### Customization\n\nAdjust the 60-second and 30-second wait nodes to change polling frequency, update the FAL model or FFmpeg parameters to control audio generation and merge behavior, and change the Google Drive destination or filename pattern for saved outputs."
      },
      "typeVersion": 1
    },
    {
      "id": "44fe831e-10ec-4171-a700-69e6e0a230a9",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        496,
        560
      ],
      "parameters": {
        "color": 7,
        "width": 416,
        "height": 384,
        "content": "## Submit video job\n\nReceives the form submission and starts a FAL Sonilo video-to-audio generation request using the submitted video input."
      },
      "typeVersion": 1
    },
    {
      "id": "a795adb8-e055-4b0c-9c51-e0b981c40c63",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        944,
        560
      ],
      "parameters": {
        "color": 7,
        "width": 640,
        "height": 384,
        "content": "## Poll audio conversion\n\nWaits for the video-to-audio job, checks its queue status, and loops until the audio generation is complete."
      },
      "typeVersion": 1
    },
    {
      "id": "727021d2-0200-4886-b18e-6523db34055a",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1616,
        560
      ],
      "parameters": {
        "color": 7,
        "width": 640,
        "height": 384,
        "content": "## Start audio video merge\n\nFetches the generated audio result, submits an FFmpeg merge job to combine it with the original video, and begins the wait cycle for that merge process."
      },
      "typeVersion": 1
    },
    {
      "id": "0c8e484d-5dba-45c4-846e-83e4759b4447",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2288,
        560
      ],
      "parameters": {
        "color": 7,
        "width": 416,
        "height": 384,
        "content": "## Poll merge completion\n\nChecks the FFmpeg merge job status and either loops back to wait longer or proceeds once the final video is ready."
      },
      "typeVersion": 1
    },
    {
      "id": "306ba32a-df47-401a-adf8-6a2829c29cb3",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2736,
        560
      ],
      "parameters": {
        "color": 7,
        "width": 640,
        "height": 384,
        "content": "## Save final video\n\nRetrieves the completed video result, downloads the video file from its URL, and uploads the final file to Google Drive."
      },
      "typeVersion": 1
    },
    {
      "id": "8813fcf0-fdc2-4af5-bb2e-b54031525da1",
      "name": "When Form Submitted",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        544,
        768
      ],
      "parameters": {
        "options": {},
        "formTitle": "Video to audio",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Video Url"
            }
          ]
        }
      },
      "typeVersion": 2.5
    },
    {
      "id": "6a2714ab-426c-4eb7-830f-fd2011dc7119",
      "name": "Check Merge Status",
      "type": "n8n-nodes-base.if",
      "position": [
        2560,
        768
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "383d112e-2cc6-4dd4-8985-f09ce0bd1781",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "COMPLETED"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "8cba6b97-e905-48f2-a5e3-651553724b37",
      "name": "Upload to Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        3232,
        768
      ],
      "parameters": {
        "name": "={{$binary.data.fileName}}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "root",
          "cachedResultName": "/ (Root folder)"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "2e5fcf84-1057-4cc4-99a3-5a4ab115f5c7",
      "name": "Convert Video to Sound",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        768,
        768
      ],
      "parameters": {
        "url": "https://queue.fal.run/sonilo/v1.1/video-to-music",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"video_url\": \"{{ $json[\"Video Url\"] }}\",\n  \"num_samples\": 1\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "9eb0e5e6-edf6-47e8-bea0-e3e3b0fdad2b",
      "name": "Check Audio Conversion Status",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1216,
        688
      ],
      "parameters": {
        "url": "=https://queue.fal.run/sonilo/v1.1/requests/{{ $('Convert Video to Sound').item.json.request_id }}/status ",
        "options": {},
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "d8383864-aefe-4d51-ae0b-2b8a7eaa8451",
      "name": "Check Sound Status",
      "type": "n8n-nodes-base.if",
      "position": [
        1440,
        768
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "383d112e-2cc6-4dd4-8985-f09ce0bd1781",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "COMPLETED"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "dfaed558-287b-46aa-ac46-d8cdd70e736f",
      "name": "Fetch Converted Audio",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1664,
        768
      ],
      "parameters": {
        "url": "=https://queue.fal.run/sonilo/v1.1/requests/{{ $json.request_id }}",
        "options": {},
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "45346e53-4b17-40ef-bf8c-10268b9eb6e2",
      "name": "Wait 30 Seconds for Merge",
      "type": "n8n-nodes-base.wait",
      "position": [
        2112,
        768
      ],
      "parameters": {
        "amount": 30
      },
      "typeVersion": 1.1
    },
    {
      "id": "f8fa7771-f5ed-4721-9ab5-a34d0865da9c",
      "name": "Wait 60 Seconds for Conversion",
      "type": "n8n-nodes-base.wait",
      "position": [
        992,
        768
      ],
      "parameters": {
        "amount": 60
      },
      "typeVersion": 1.1
    },
    {
      "id": "c594d108-dfd2-4fe3-acfc-5d933d977da1",
      "name": "Merge Audio with Video",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1888,
        768
      ],
      "parameters": {
        "url": "https://queue.fal.run/fal-ai/ffmpeg-api/merge-audio-video",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"video_url\":\"{{ $('When Form Submitted').item.json[\"Video Url\"] }}\",\n  \"audio_url\":\"{{ $json.audio.url }}\"\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "7603324d-6d66-4122-b57e-5cb84c817c42",
      "name": "Check Video Merge Status",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2336,
        688
      ],
      "parameters": {
        "url": "=https://queue.fal.run/fal-ai/ffmpeg-api/requests/{{ $('Merge Audio with Video').item.json.request_id }}/status ",
        "options": {},
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "f3acc83a-b874-4c59-af92-868cd9c3197a",
      "name": "Fetch Final Video",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2784,
        768
      ],
      "parameters": {
        "url": "=https://queue.fal.run/fal-ai/ffmpeg-api/requests/{{ $json.request_id }}",
        "options": {},
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "f4977d60-94bd-413c-9724-2323270ffab3",
      "name": "Fetch Video File from URL",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3008,
        768
      ],
      "parameters": {
        "url": "={{ $json.video.url }}",
        "options": {}
      },
      "typeVersion": 4.4
    },
    {
      "id": "b2f26102-c07a-47d7-852e-56879c7fb638",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -752,
        224
      ],
      "parameters": {
        "color": 7,
        "width": 704,
        "height": 720,
        "content": "## MY NEW YOUTUBE CHANNEL\n\ud83d\udc49 [Subscribe to my new **YouTube channel**](https://youtube.com/@n3witalia). Here I\u2019ll share videos and Shorts with practical tutorials and **FREE templates for n8n**.\n\n[![image](https://n3wstorage.b-cdn.net/n3witalia/youtube-n8n-cover.jpg)](https://youtube.com/@n3witalia)"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "executionOrder": "v1"
  },
  "versionId": "173550bc-b850-4075-98a7-9730f849d285",
  "nodeGroups": [],
  "connections": {
    "Fetch Final Video": {
      "main": [
        [
          {
            "node": "Fetch Video File from URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Merge Status": {
      "main": [
        [
          {
            "node": "Fetch Final Video",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait 30 Seconds for Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Sound Status": {
      "main": [
        [
          {
            "node": "Fetch Converted Audio",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait 60 Seconds for Conversion",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Form Submitted": {
      "main": [
        [
          {
            "node": "Convert Video to Sound",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Converted Audio": {
      "main": [
        [
          {
            "node": "Merge Audio with Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert Video to Sound": {
      "main": [
        [
          {
            "node": "Wait 60 Seconds for Conversion",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Audio with Video": {
      "main": [
        [
          {
            "node": "Wait 30 Seconds for Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Video Merge Status": {
      "main": [
        [
          {
            "node": "Check Merge Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Video File from URL": {
      "main": [
        [
          {
            "node": "Upload to Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 30 Seconds for Merge": {
      "main": [
        [
          {
            "node": "Check Video Merge Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Audio Conversion Status": {
      "main": [
        [
          {
            "node": "Check Sound Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 60 Seconds for Conversion": {
      "main": [
        [
          {
            "node": "Check Audio Conversion Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}