What This Workflow Does
AI Background Generation
Generate photorealistic backgrounds from text prompts using Gemini's native image generation (Nano Banana). Create any scene you can imagine.
Automatic Composition
Remove video background and composite on AI-generated scene automatically. Centered positioning for professional, polished results.
Flexible Aspect Ratios
Support for all Gemini aspect ratios: square (1:1), landscape (16:9, 4:3), and portrait (9:16, 3:4). Match your video orientation or platform requirements.
Google Drive Integration
Automatically save both the generated background image and final composed video to Google Drive with shareable links.
How It Works
1. Describe Your Background
- Provide video URL (your foreground subject)
- Write text prompt describing desired background
- Optionally specify aspect ratio (default 1:1)
- Be descriptive: lighting, mood, colors, style
2. AI Generates Background
- Gemini 2.5 Flash creates image from prompt
- High-quality, photorealistic results (~1024px)
- Processing: ~10-20 seconds per image
- Supports detailed, creative prompts
3. Composition & Export
- Background removal on foreground video
- Composite on AI-generated background
- Centered template with aspect ratio preservation
- Uploads both image and video to Google Drive
AI Background Generation FAQ
What is Nano Banana (Gemini native image generation)?
Nano Banana is the codename for Gemini's built-in image generation capabilities. It's integrated directly into Gemini 2.5 Flash, allowing you to generate high-quality, photorealistic images from text prompts in the same API call. Unlike separate image generation models, Nano Banana understands context conversationally and can generate images with accurate text rendering and detailed scenes.
How do I write effective background prompts?
Be descriptive and specific. Instead of 'office background,' try: 'A modern minimalist office with floor-to-ceiling windows overlooking a city skyline at golden hour. Warm sunlight, polished concrete floors, sleek wooden desks, green plants. Professional, inviting atmosphere.' Use photography terms (lighting, mood, camera angle) for photorealistic results. Describe the scene, not just keywords.
What aspect ratios are supported?
The workflow supports all Gemini image generation aspect ratios. Most common: 1:1 (square, default), 16:9 and 4:3 (landscape for YouTube/presentations), 9:16 and 3:4 (vertical for TikTok/Instagram). Full list of 10 supported ratios with exact resolutions: https://ai.google.dev/gemini-api/docs/image-generation#aspect_ratios. Match your video's aspect ratio or choose based on your target platform for best results.
How much does it cost per video?
Pricing is split between Gemini and VideoBGRemover: Gemini charges $0.03 per generated image (~$0.039 per 1290 tokens for image output). VideoBGRemover charges $0.50-$2.00 per minute of video processed. Total cost: approximately $0.53-$2.03 per video depending on video length. Gemini API has free tier quotas; VideoBGRemover offers free trial credits.
Can I save the generated background images for reuse?
Yes! The workflow automatically uploads the AI-generated background image to your Google Drive before compositing. You can download and reuse these images for multiple videos, brand assets, or other projects. The images are high-resolution PNGs (up to 1536px depending on aspect ratio) and include SynthID watermarks for provenance.
How do I install this workflow?
Installation takes about 5 minutes: 1) In n8n, go to Workflows → Import from URL, 2) Paste the template URL and import, 3) Add your Gemini API key to n8n environment variables as GEMINI_KEY (get from https://aistudio.google.com/apikey), 4) Add your VideoBGRemover API key as VIDEOBGREMOVER_KEY, 5) Connect your Google Drive account, 6) Test with the sample inputs provided in the workflow.
Can I generate multiple background variations for one video?
Yes! You can run the workflow multiple times with different prompts for the same video URL. Each run will generate a new background image and create a new composed video. This is perfect for A/B testing different backgrounds, creating variations for different platforms, or exploring creative options before choosing your favorite.
What types of scenes can Gemini generate?
Gemini can generate virtually any scene you can describe: modern offices, tropical beaches, minimalist studios, cozy coffee shops, futuristic cityscapes, professional home offices, branded environments, abstract patterns, and more. It excels at photorealistic scenes, architectural photography styles, and detailed environments. The model understands lighting, perspective, and composition.
Can I batch process multiple videos with different prompts?
Yes! Connect the workflow to Google Sheets or Airtable with columns for video_url, background_prompt, and aspect_ratio. Each row will be processed sequentially, generating a unique background for each video. Perfect for creating series content, client projects with different branding, or variations of the same video with different scenes.
What if the generated background doesn't match my prompt?
Refine your prompt with more specific details. Add terms like 'photorealistic,' mention camera angles (wide-angle, close-up), specify lighting (golden hour, soft diffused light), and describe colors/mood explicitly. If results are consistently off, try breaking complex scenes into simpler descriptions. You can also iterate by describing what to change: 'same scene but with warmer lighting.'
Does this work with n8n Cloud or self-hosted only?
Both! The workflow works on n8n Cloud and self-hosted instances. Requirements: 1) Gemini API key (get from Google AI Studio), 2) VideoBGRemover API key, 3) Google Drive connection (OAuth), 4) n8n environment variables configured. All API calls are made from n8n to external services, so no special hosting setup is needed.
What happens if image generation fails?
The workflow includes error handling. If Gemini fails to generate an image (invalid prompt, API error, quota exceeded), the workflow captures the error and returns it in a structured response. For webhook triggers, the error is returned to the caller. For manual runs, check the execution log. Common fixes: simplify prompt, check API key, verify Gemini API quotas.
