Video Extension¶
Extend existing videos with AI-generated content.
Overview¶
Video extension allows you to continue an existing video with new AI-generated content. The AI analyzes the last frames and generates continuation based on your prompt.
Requirements¶
Critical Requirements¶
| Requirement | Details |
|---|---|
| Frame Rate | Source video MUST be 24fps |
| Model | veo-2.0, veo-2.0-exp, or veo-3.1-generate-preview |
| Source | Local file or GCS URI (NOT external URLs) |
Why 24fps?¶
The Veo API only accepts 24fps videos for extension. Videos with different frame rates will fail with "fps mismatch" error.
Basic Usage¶
# Extend a local video
python video_gen.py "The cat runs faster" \
--extend-video previous_video.mp4 \
--model veo-2.0
# Extend with GCS storage
python video_gen.py "Continue the scene" \
--extend-video previous_video.mp4 \
--storage-uri gs://my-bucket/videos \
--model veo-2.0
Source Options¶
Local File¶
python video_gen.py "Continue scene" \
--extend-video /path/to/video.mp4
The script will:
- Check if video is 24fps
- Upload to GCS if
--storage-uriprovided - Use base64 encoding if no GCS
GCS URI¶
python video_gen.py "Continue scene" \
--extend-video gs://my-bucket/videos/source.mp4
Direct GCS URI is faster - no upload needed.
With Reference Images¶
Combine extension with reference images:
python video_gen.py "The person continues walking" \
--extend-video previous.mp4 \
--reference-image avatar.png:asset \
--model veo-2.0
With Last Frame¶
Specify where the video should end:
python video_gen.py "Transform to sunset" \
--extend-video daytime.mp4 \
--last-frame sunset.jpg \
--model veo-2.0
Workflow: Creating Long Videos¶
Chain multiple extensions to create longer videos:
# Step 1: Generate initial video
python video_gen.py "A person walking" --preset quality
# Output: video_001.mp4
# Step 2: Extend first video
python video_gen.py "The person starts running" \
--extend-video video_001.mp4 --model veo-2.0
# Output: video_002.mp4
# Step 3: Extend again
python video_gen.py "The person jumps over obstacle" \
--extend-video video_002.mp4 --model veo-2.0
# Output: video_003.mp4
# Combine with ffmpeg
ffmpeg -i "concat:video_001.mp4|video_002.mp4|video_003.mp4" -c copy final.mp4
Common Issues¶
"fps mismatch"¶
Problem: Source video is not 24fps
Solution: Convert to 24fps using ffmpeg:
ffmpeg -i input.mp4 -r 24 -c:v libx264 output_24fps.mp4
"video is empty"¶
Problem: External URL used (not supported)
Solution: Download video first, then use local file:
# Download video
curl -o local_video.mp4 "https://example.com/video.mp4"
# Convert to 24fps if needed
ffmpeg -i local_video.mp4 -r 24 local_24fps.mp4
# Use local file
python video_gen.py "Continue" --extend-video local_24fps.mp4
"Model does not support video_extension"¶
Problem: Using unsupported model (e.g., veo-3.0)
Solution: Use supported models:
python video_gen.py "Continue" \
--extend-video input.mp4 \
--model veo-3.1-generate-preview # or veo-2.0
Supported models for video extension: - veo-3.1-generate-preview ✅ - veo-2.0 ✅ - veo-2.0-exp ✅
Smart Defaults (New in v2.25.1)¶
When extending a video, settings are automatically inherited from the source video's metadata:
How It Works¶
# Original video was created with:
# - model: veo-2.0
# - resolution: 1080p
# - storage-uri: gs://my-bucket/videos
# Just specify the prompt - settings are inherited
python video_gen.py "Continue the scene" --extend-video video_20260201_123456_0.mp4
# Output:
# ℹ Found source metadata for inheritance
# ℹ Inherited model from metadata: veo-2.0
# ℹ Inherited resolution from metadata: 1080p
# ℹ Inherited storage_uri from metadata: gs://my-bucket/videos
Priority Chain¶
Settings are resolved in this order:
- CLI Arguments (highest) - What you type
- Source Metadata - From the source video
- config.json - Your project settings
- Code Defaults (lowest) - Built-in fallbacks
Override When Needed¶
You can always override inherited values:
# Override model (ignore metadata)
python video_gen.py "Continue" \
--extend-video video.mp4 \
--model veo-2.0-exp
# Override resolution
python video_gen.py "Continue" \
--extend-video video.mp4 \
--resolution 720p
Chained Extensions
Smart Defaults work perfectly for chained extensions. Each video inherits from its predecessor:
video_001.mp4 → video_002.mp4 → video_003.mp4
# All use same model, resolution, storage settings
Auto-Upload Feature¶
When --storage-uri is provided, local files are automatically uploaded:
python video_gen.py "Continue scene" \
--extend-video local_video.mp4 \
--storage-uri gs://my-bucket/uploads
Flow:
Local file → Upload to GCS → Use gcsUri in API → Generate → Download
Best Practices¶
Do¶
Use Veo-generated videos (always 24fps)
Use
--storage-urifor reliable uploadsUse supported models (
veo-2.0,veo-2.0-exp, orveo-3.1-generate-preview)Keep prompts consistent with source video
Don't¶
Use external URLs directly
Use unsupported models (e.g., veo-3.0)
Use videos with non-24fps frame rate
Create drastic scene changes
Planned Features (v2.25)¶
Future version will support:
# Planned: Auto-download and convert external URLs
python video_gen.py "Continue" \
--extend-video-from-url "https://example.com/video.mp4"
This will:
- Download video from URL
- Convert to 24fps using ffmpeg
- Upload to GCS
- Proceed with extension
Learn More¶
- Generation Modes - All generation modes
- Video Models - Model comparison
- Reference Images - Using references with extension
- GCS Storage - Setting up GCS