Video Background Removal, Composition, and Google Drive Upload - n8n Workflow

Use this powerful n8n workflow to automatically remove video backgrounds, composite the resulting foreground onto custom scene videos, manage job polling, and save the final MP4 output directly to Google Drive. Find more advanced n8n templates here.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Markdown-formatted:
AI UGC creators using tools like HeyGen or Synthesia who need to place avatars on specific backgrounds.
E-commerce marketers automating product video creation with branded scenes.
Technical users looking for robust n8n workflow templates involving complex API polling and file handling.
Developers needing an automated service triggered by a webhook n8n node.

Overview

This comprehensive n8n workflow solves the challenge of automating high-fidelity video processing tasks, specifically background removal and composition, which typically require dedicated software. Leveraging the VideoBgRemover API, this n8n automation accepts foreground and background video URLs, submits the job, and manages the asynchronous processing through a structured polling loop. The final composed video is retrieved and securely stored in your Google Drive. This n8n workflow demonstrates advanced concepts in API interaction, conditional flow control, and cloud storage integration, making it one of the most powerful available n8n templates for media automation.

How it Works

This n8n workflow can be initiated in two ways: via the Webhook Trigger n8n node or manually for testing.


  1. Trigger & Input: The process starts when the n8n trigger (either manual or webhook) is activated. The subsequent Set nodes parse the input URLs for the foreground video (subject) and the custom background video.

  2. Job Creation (API Step 1): The first HTTP Request n8n node creates a new processing job by uploading the foreground video URL to the external API, securing the API key via an environment variable (VIDEOBGREMOVERKEY). This returns a unique Job ID.

  3. Start Composition (API Step 2): A second HTTP Request n8n node uses the Job ID and composition parameters (e.g., aiugc_ad template, audio mixing levels, background video URL) to instruct the API to begin background removal and compositing.

  4. Polling Loop (Status Check): The n8n workflow enters a complex polling loop. The '3. Check Job Status' n8n node repeatedly queries the API for the job status.

  5. Flow Control: The 'Is Complete?' If n8n node checks if the status is completed. If not, the 'Has Failed?' If n8n node checks for failure. If still processing, the 'Wait 20s' n8n node pauses the flow before looping back to check the status again.

  6. Final Actions: Upon completion, the '4. Download Video' n8n node downloads the processed video file. The '5. Upload to Google Drive' n8n node then uploads the binary file to the specified Google Drive folder.

  7. Response: The final 'Build Success Response' or 'Build Error Response' Set n8n node prepares the output, which is either returned instantly via the 'Respond to Webhook' n8n node (if triggered by a webhook) or displayed as a result for manual executions.

Installation Guide

Markdown-formatted:


  1. Import the n8n workflow: Copy the entire JSON code provided and import it into your n8n instance via the 'Workflows' section.

  2. API Key Setup: This n8n template requires an API key from VideoBgRemover. Go to your n8n settings, navigate to 'Variables', and add a new environment variable named VIDEOBGREMOVERKEY. Set its value to your copied API key.

  3. Google Drive Credentials: Click the '5. Upload to Google Drive' n8n node. Select 'Credentials' and connect your Google Drive account, granting n8n the necessary permissions to upload files.

  4. Input Configuration: If running manually, edit the 'Sample Video URLs (Edit Here)' n8n node to replace the placeholder URLs with your desired foreground and background video links. If using the webhook n8n trigger, ensure your calling application sends the foregroundvideourl and backgroundvideo_url in the POST body.

Node Details

Markdown-formatted:

Webhook Trigger / Manual Trigger: These nodes serve as the n8n trigger for the entire automation, allowing for both ad-hoc testing and production webhook integration.
Extract Webhook Data / Sample Video URLs (Set n8n node): Gathers and standardizes the required input variables (foregroundvideourl, backgroundvideourl) from either the webhook body or pre-configured manual values.
1. Create Job (Upload Foreground) (HTTP Request n8n node): Sends the initial API request to start the video processing job. Crucially, it sends the X-API-Key header using the secure $vars.VIDEOBGREMOVERKEY variable.
2. Start Composition (HTTP Request n8n node): Defines the exact composition parameters, including the template (ai
ugc_ad), background URL, and audio mixing configuration. This step activates the composition stage of the n8n workflow.
3. Check Job Status (HTTP Request n8n node): Polls the API endpoint, retrieving the current status (processing, completed, or failed). This is central to the polling logic of this n8n workflow.
Is Complete? / Has Failed? (If n8n node): These conditional n8n nodes manage the asynchronous flow, determining whether to proceed to download, build an error response, or re-enter the loop.
Wait 20s (Wait n8n node): Controls the polling frequency, preventing API rate limiting by pausing the n8n workflow for 20 seconds before the next status check.
5. Upload to Google Drive (Google Drive n8n node): Takes the binary video file received from the download step and uploads it to the configured Google Drive location, providing the final shareable link.

Related n8n Workflows

Free

Nodes: 10 Nodes
Updated: December 26 2025
View all
Created by
Paul Roussel
Paul Roussel

Featured*