Add audio generation, auto mode, MCP server, and comprehensive documentation

Features:
- Audio generation: TTS via Bark/Edge-TTS, music via MusicGen
- Audio sync: stretch, trim, pad, loop modes
- Lip sync: Wav2Lip and SadTalker integration
- Auto mode: automatic model selection with NSFW detection
- MCP server: AI agent integration via Model Context Protocol
- Model management: external config, search, validation
- T2I/I2I support: static image and image-to-image generation
- Time estimation: detailed timing breakdown for each step

Documentation:
- README.md: comprehensive installation and usage guide
- EXAMPLES.md: 100+ command-line examples
- SKILL.md: AI agent integration guide
- LICENSE.md: GPLv3 license

Copyleft © 2026 Stefy <stefy@nexlab.net>
parents
Pipeline #222 canceled with stages
# VideoGen Examples
This document contains comprehensive examples for using the VideoGen toolkit, covering all modes, model sizes, and features.
---
## Table of Contents
1. [Basic Usage](#basic-usage)
2. [Auto Mode](#auto-mode)
3. [Text-to-Video (T2V)](#text-to-video-t2v)
4. [Image-to-Video (I2V)](#image-to-video-i2v)
5. [Text-to-Image (T2I)](#text-to-image-t2i)
6. [Image-to-Image (I2I)](#image-to-image-i2i)
7. [Audio Generation](#audio-generation)
8. [Lip Sync](#lip-sync)
9. [Distributed Multi-GPU](#distributed-multi-gpu)
10. [Model Management](#model-management)
11. [VRAM Management](#vram-management)
12. [Upscaling](#upscaling)
13. [NSFW Content](#nsfw-content)
14. [Advanced Combinations](#advanced-combinations)
---
## Basic Usage
### Simple Text-to-Video
```bash
# Basic video generation with default settings
python3 videogen --model wan_1.3b_t2v --prompt "a cat playing piano" --output cat_piano
# Specify duration and resolution
python3 videogen --model wan_1.3b_t2v --prompt "sunset over mountains" \
--length 10 --width 1280 --height 720 --output sunset
# Set specific seed for reproducibility
python3 videogen --model wan_1.3b_t2v --prompt "ocean waves" \
--seed 42 --output ocean
```
### Quick Start with Auto Mode
```bash
# Let the script decide everything
python3 videogen --auto --prompt "a beautiful woman walking on the beach"
# Auto mode with custom output
python3 videogen --auto --prompt "epic space battle" --output space_battle
# Auto mode preferring speed over quality
python3 videogen --auto --prefer-speed --prompt "quick animation test"
```
---
## Auto Mode
Auto mode analyzes your prompt and automatically:
- Detects the generation type (T2V, I2V, T2I, I2I)
- Detects NSFW content and enables appropriate settings
- Selects the best model for your VRAM
- Splits prompts for I2V mode
- Configures audio if needed
### Basic Auto Mode
```bash
# Simple auto generation
python3 videogen --auto --prompt "a dog running in the park"
# Auto with custom duration
python3 videogen --auto --prompt "cinematic drone shot of city" --length 15
# Auto with custom resolution
python3 videogen --auto --prompt "portrait of a woman" \
--width 1024 --height 1024
```
### Auto Mode with Audio
```bash
# Auto mode detects speech and enables TTS
python3 videogen --auto --prompt "a woman speaking to camera"
# Auto mode with music for action scene
python3 videogen --auto --prompt "epic battle scene with warriors fighting"
# Auto mode for nature documentary style
python3 videogen --auto --prompt "wildlife footage of lions hunting"
```
### Auto Mode for Different Content Types
```bash
# Static scene (will use T2I)
python3 videogen --auto --prompt "beautiful landscape photograph of mountains"
# Animated scene (will use T2V)
python3 videogen --auto --prompt "flowing river with fish jumping"
# Portrait with motion (will use I2V)
python3 videogen --auto --prompt "a woman with flowing hair in the wind"
# Action sequence (will use T2V with fast motion)
python3 videogen --auto --prompt "car chase through city streets"
```
### Auto Mode Output
When you run auto mode, it prints a command line you can use to reproduce the result:
```bash
# Example output from auto mode:
# 📝 COMMAND LINE (to reproduce without --auto):
# python3 videogen \
# --model wan_14b_t2v \
# --prompt "epic battle scene" \
# --length 10 \
# --fps 18 \
# --generate_audio \
# --audio_type music \
# --sync_audio
```
---
## Text-to-Video (T2V)
### Small Models (<16GB VRAM)
```bash
# Wan 1.3B - Fast, good for testing
python3 videogen --model wan_1.3b_t2v --prompt "a bird flying" --length 5
# Zeroscope - Lightweight T2V
python3 videogen --model zeroscope_v2_576w --prompt "robot dancing" \
--width 576 --height 320
# ModelScope - Basic T2V
python3 videogen --model modelscope_t2v --prompt "fireworks in night sky"
```
### Medium Models (16-30GB VRAM)
```bash
# Wan 14B - High quality T2V
python3 videogen --model wan_14b_t2v --prompt "cinematic shot of ancient ruins" \
--length 10 --width 1280 --height 720
# CogVideoX 2B - Good balance
python3 videogen --model cogvideox_2b --prompt "underwater coral reef scene" \
--length 8
# CogVideoX 5B - Higher quality
python3 videogen --model cogvideox_5b --prompt "northern lights over snowy landscape" \
--length 12 --width 1280 --height 720
# Mochi - High quality
python3 videogen --model mochi_1_preview --prompt "slow motion water droplet" \
--length 6 --fps 24
```
### Large Models (30-50GB VRAM)
```bash
# Allegro - Very high quality
python3 videogen --model allegro --prompt "epic fantasy battle" \
--length 15 --width 1920 --height 1080 \
--vram_limit 45 --offload_strategy sequential
# HunyuanVideo - Tencent's model
python3 videogen --model hunyuanvideo --prompt "photorealistic city street" \
--length 10 --vram_limit 50
```
### Huge Models (50GB+ VRAM)
```bash
# Open-Sora - Open source Sora alternative
python3 videogen --model open_sora_1_2 --prompt "detailed nature documentary" \
--length 20 --width 1920 --height 1080 \
--vram_limit 60 --offload_strategy sequential
# Step-Video - Extreme quality (90-140GB VRAM)
python3 videogen --model step_video_t2v --prompt "cinematic masterpiece" \
--length 30 --vram_limit 120 --offload_strategy sequential
```
### T2V with Custom Settings
```bash
# High FPS for smooth motion
python3 videogen --model wan_14b_t2v --prompt "sports action replay" \
--fps 30 --length 5
# Low FPS for choppy/artistic effect
python3 videogen --model wan_14b_t2v --prompt "vintage film look" \
--fps 12 --length 8
# Custom resolution (landscape)
python3 videogen --model wan_14b_t2v --prompt "panoramic mountain view" \
--width 1920 --height 480
# Custom resolution (portrait)
python3 videogen --model wan_14b_t2v --prompt "vertical phone video" \
--width 720 --height 1280
# Square format
python3 videogen --model wan_14b_t2v --prompt "instagram reel" \
--width 1080 --height 1080
```
---
## Image-to-Video (I2V)
### I2V with Auto-Generated Image
```bash
# Basic I2V - generates image first, then animates
python3 videogen --image_to_video --model svd_xt_1.1 \
--image_model flux_dev \
--prompt "a beautiful woman in a red dress" \
--prompt_animation "gentle wind blowing her hair" \
--output woman_dress
# I2V with different image model
python3 videogen --image_to_video --model svd_xt_1.1 \
--image_model pony_v6 \
--prompt "anime girl with blue hair" \
--prompt_animation "blinking and smiling" \
--output anime_girl
# I2V with SDXL image model
python3 videogen --image_to_video --model svd_xt_1.1 \
--image_model sdxl_base \
--prompt "cyberpunk city street at night" \
--prompt_animation "neon lights flickering, cars passing" \
--output cyberpunk
```
### I2V with Existing Image
```bash
# Animate a photo
python3 videogen --model svd_xt_1.1 \
--image my_photo.jpg \
--prompt "add subtle motion to this scene" \
--output animated_photo
# I2V with specific animation prompt
python3 videogen --model svd_xt_1.1 \
--image portrait.png \
--prompt "person turns head slightly and smiles" \
--output portrait_animated
# I2V with custom resolution (must match image aspect ratio)
python3 videogen --model svd_xt_1.1 \
--image landscape.jpg \
--prompt "clouds moving across sky" \
--width 1920 --height 1080 \
--output landscape_motion
```
### I2V with Different Models
```bash
# SVD XT 1.1 - Standard I2V
python3 videogen --image_to_video --model svd_xt_1.1 \
--image_model flux_dev --prompt "forest scene" \
--prompt_animation "leaves rustling in wind"
# SVD XT - Original version
python3 videogen --image_to_video --model svd_xt \
--image_model sdxl_base --prompt "ocean sunset" \
--prompt_animation "waves gently rolling"
# Wan I2V - Alternative I2V model
python3 videogen --image_to_video --model wan_14b_i2v \
--image_model flux_dev --prompt "mountain landscape" \
--prompt_animation "clouds drifting, birds flying"
# LTX Video - Fast I2V
python3 videogen --image_to_video --model ltx_video \
--image_model sdxl_base --prompt "city street" \
--prompt_animation "people walking, cars moving"
```
### I2V with LoRA Adapters
```bash
# I2V with NSFW LoRA
python3 videogen --image_to_video \
--model wan_i2v_nsfw_lora \
--image_model flux_nsfw \
--prompt "intimate scene" \
--prompt_animation "passionate motion" \
--no_filter --output intimate
# I2V with style LoRA
python3 videogen --image_to_video \
--model wan_i2v_anime_lora \
--image_model pony_v6 \
--prompt "anime character" \
--prompt_animation "dramatic pose change"
```
---
## Text-to-Image (T2I)
### Basic T2I
```bash
# Generate single image (auto-detected by .png extension)
python3 videogen --model flux_dev --prompt "beautiful landscape" --output landscape.png
# Generate with SDXL
python3 videogen --model sdxl_base --prompt "cyberpunk city" \
--width 1024 --height 1024 --output cyberpunk.png
# Generate with Pony (anime style)
python3 videogen --model pony_v6 --prompt "anime girl with pink hair" \
--output anime_girl.jpg
# Generate with custom steps
python3 videogen --model flux_dev --prompt "portrait of a woman" \
--image-steps 50 --guidance-scale 3.5 --output portrait.png
```
### T2I with Different Sizes
```bash
# Square
python3 videogen --model sdxl_base --prompt "abstract art" \
--width 1024 --height 1024 --output square.png
# Portrait
python3 videogen --model flux_dev --prompt "full body portrait" \
--width 768 --height 1024 --output portrait.png
# Landscape
python3 videogen --model sdxl_base --prompt "panoramic view" \
--width 1280 --height 720 --output landscape.png
# Ultra-wide
python3 videogen --model flux_dev --prompt "cinematic wide shot" \
--width 1920 --height 540 --output ultrawide.png
```
### T2I for I2V Preparation
```bash
# Generate image for later I2V use
python3 videogen --model flux_dev \
--prompt "cinematic shot of a woman in evening gown, dramatic lighting" \
--width 832 --height 480 --output i2v_source.png
# Then animate it
python3 videogen --model svd_xt_1.1 --image i2v_source.png \
--prompt "subtle elegant movement" --output animated_scene
```
---
## Image-to-Image (I2I)
### Basic I2I
```bash
# Modify existing image
python3 videogen --model flux_dev --image-to-image \
--image photo.jpg \
--prompt "make it look like an oil painting" \
--output painted.png
# I2I with SDXL
python3 videogen --model sdxl_base --image-to-image \
--image input.png \
--prompt "add dramatic sunset lighting" \
--output sunset.png
# I2I with Pony
python3 videogen --model pony_v6 --image-to-image \
--image photo.jpg \
--prompt "convert to anime style" \
--output anime_version.png
```
### I2I with Strength Control
```bash
# Low strength - subtle changes
python3 videogen --model flux_dev --image-to-image \
--image photo.jpg \
--prompt "add slight blur effect" \
--strength 0.3 --output subtle.png
# Medium strength - balanced
python3 videogen --model flux_dev --image-to-image \
--image photo.jpg \
--prompt "change to winter scene" \
--strength 0.5 --output winter.png
# High strength - major changes
python3 videogen --model flux_dev --image-to-image \
--image photo.jpg \
--prompt "transform into fantasy art" \
--strength 0.8 --output fantasy.png
# Maximum strength - almost complete reimagining
python3 videogen --model sdxl_base --image-to-image \
--image sketch.png \
--prompt "highly detailed realistic rendering" \
--strength 0.95 --output detailed.png
```
### I2I Style Transfers
```bash
# Photo to painting
python3 videogen --model flux_dev --image-to-image \
--image photo.jpg --prompt "impressionist oil painting style" \
--strength 0.7 --output impressionist.png
# Realistic to anime
python3 videogen --model pony_v6 --image-to-image \
--image portrait.jpg --prompt "anime style illustration" \
--strength 0.75 --output anime.png
# Day to night
python3 videogen --model sdxl_base --image-to-image \
--image daytime.jpg --prompt "night time scene with moon" \
--strength 0.6 --output nighttime.png
# Add weather effects
python3 videogen --model flux_dev --image-to-image \
--image sunny.jpg --prompt "rainy weather, wet surfaces" \
--strength 0.5 --output rainy.png
```
---
## Audio Generation
### Text-to-Speech (TTS)
```bash
# Basic TTS with default voice
python3 videogen --model wan_14b_t2v --prompt "woman speaking" \
--generate_audio --audio_type tts \
--audio_text "Hello, welcome to my channel" \
--output speaker
# TTS with male voice
python3 videogen --model wan_14b_t2v --prompt "man giving presentation" \
--generate_audio --audio_type tts \
--audio_text "Today we will discuss the future of technology" \
--tts_voice edge_male_us --output presentation
# TTS with British accent
python3 videogen --model wan_14b_t2v --prompt "british narrator" \
--generate_audio --audio_type tts \
--audio_text "In this episode, we explore ancient mysteries" \
--tts_voice edge_male_uk --output documentary
# TTS with Australian accent
python3 videogen --model wan_14b_t2v --prompt "australian guide" \
--generate_audio --audio_type tts \
--audio_text "Welcome to the outback adventure tour" \
--tts_voice edge_male_au --output australia
# TTS with female voice
python3 videogen --model wan_14b_t2v --prompt "woman telling story" \
--generate_audio --audio_type tts \
--audio_text "Once upon a time in a land far away" \
--tts_voice edge_female_us --output story
```
### TTS with Bark (Suno AI)
```bash
# Bark male voice
python3 videogen --model wan_14b_t2v --prompt "dramatic reading" \
--generate_audio --audio_type tts \
--audio_text "To be or not to be, that is the question" \
--tts_voice bark_male --output hamlet
# Bark female voice
python3 videogen --model wan_14b_t2v --prompt "singing performance" \
--generate_audio --audio_type tts \
--audio_text "La la la, singing a beautiful melody" \
--tts_voice bark_female --output singing
# Bark narrator
python3 videogen --model wan_14b_t2v --prompt "audiobook narrator" \
--generate_audio --audio_type tts \
--audio_text "Chapter one: The beginning of our journey" \
--tts_voice bark_narrator --output audiobook
```
### Music Generation
```bash
# Epic orchestral music
python3 videogen --model wan_14b_t2v --prompt "epic battle scene" \
--generate_audio --audio_type music \
--audio_text "epic orchestral battle music with drums and brass, cinematic" \
--music_model medium --output battle
# Ambient music
python3 videogen --model wan_14b_t2v --prompt "peaceful nature" \
--generate_audio --audio_type music \
--audio_text "calm ambient music with soft piano and nature sounds" \
--music_model small --output nature
# Electronic music
python3 videogen --model wan_14b_t2v --prompt "cyberpunk city" \
--generate_audio --audio_type music \
--audio_text "dark electronic synthwave, futuristic beats" \
--music_model medium --output cyberpunk
# High quality music (large model)
python3 videogen --model wan_14b_t2v --prompt "music video" \
--generate_audio --audio_type music \
--audio_text "upbeat pop music with catchy melody" \
--music_model large --output pop_music
```
### Audio Sync Options
```bash
# Stretch audio to match video
python3 videogen --model wan_14b_t2v --prompt "sunset timelapse" \
--generate_audio --audio_type music \
--audio_text "peaceful ambient music" \
--sync_audio --sync_mode stretch --output timelapse
# Trim audio to video length
python3 videogen --model wan_14b_t2v --prompt "short clip" \
--length 3 --generate_audio --audio_type music \
--audio_text "energetic rock music" \
--sync_audio --sync_mode trim --output short_clip
# Loop audio for longer video
python3 videogen --model wan_14b_t2v --prompt "long sequence" \
--length 30 --generate_audio --audio_type music \
--audio_text "short drum beat" \
--sync_audio --sync_mode loop --output long_video
# Pad with silence
python3 videogen --model wan_14b_t2v --prompt "documentary" \
--length 15 --generate_audio --audio_type tts \
--audio_text "Short narration" \
--sync_audio --sync_mode pad --output doc
```
### Using External Audio File
```bash
# Use existing audio file
python3 videogen --model wan_14b_t2v --prompt "music video" \
--audio_file my_song.mp3 \
--sync_audio --output music_video
# External audio with lip sync
python3 videogen --image_to_video --model svd_xt_1.1 \
--image_model flux_dev --prompt "person singing" \
--audio_file vocals.wav \
--lip_sync --output singing
```
---
## Lip Sync
### Basic Lip Sync
```bash
# TTS with lip sync
python3 videogen --image_to_video --model svd_xt_1.1 \
--image_model flux_dev --prompt "news anchor speaking" \
--generate_audio --audio_type tts \
--audio_text "Breaking news tonight at eleven" \
--tts_voice edge_male_us \
--lip_sync --output news
# Lip sync with female voice
python3 videogen --image_to_video --model svd_xt_1.1 \
--image_model flux_dev --prompt "woman giving speech" \
--generate_audio --audio_type tts \
--audio_text "Thank you all for coming today" \
--tts_voice edge_female_us \
--lip_sync --output speech
```
### Lip Sync with Specific Method
```bash
# Force Wav2Lip
python3 videogen --image_to_video --model svd_xt_1.1 \
--image_model flux_dev --prompt "interview subject" \
--generate_audio --audio_type tts \
--audio_text "I've been working on this project for years" \
--lip_sync --lip_sync_method wav2lip --output interview
# Force SadTalker
python3 videogen --image_to_video --model svd_xt_1.1 \
--image_model flux_dev --prompt "talking head" \
--generate_audio --audio_type tts \
--audio_text "Welcome to my tutorial" \
--lip_sync --lip_sync_method sadtalker --output tutorial
```
### Complete Lip Sync Pipeline
```bash
# Full pipeline: I2V + TTS + Sync + Lip Sync
python3 videogen --image_to_video --model svd_xt_1.1 \
--image_model flux_dev \
--prompt "professional presenter" \
--prompt_animation "natural speaking gestures" \
--generate_audio --audio_type tts \
--audio_text "Hello and welcome to our comprehensive guide on video generation" \
--tts_voice edge_male_us \
--sync_audio \
--lip_sync \
--output presenter
# NSFW content with lip sync
python3 videogen --image_to_video --model svd_xt_1.1 \
--image_model flux_nsfw \
--prompt "intimate scene" \
--prompt_animation "passionate movement" \
--generate_audio --audio_type tts \
--audio_text "I've been waiting for you" \
--tts_voice edge_female_us \
--lip_sync \
--no_filter \
--output intimate
```
---
## Distributed Multi-GPU
### Basic Distributed Setup
```bash
# Distribute across multiple GPUs
python3 videogen --model wan_14b_t2v \
--prompt "epic space battle with thousands of ships" \
--length 20 --distribute --output space_battle
# Distributed with specific network interface
python3 videogen --model mochi_1_preview \
--prompt "complex nature scene" \
--length 15 --distribute --interface eth0 --output nature
# Distributed with VRAM limit per GPU
python3 videogen --model hunyuanvideo \
--prompt "cinematic masterpiece" \
--length 30 --distribute --vram_limit 20 --output masterpiece
```
### Distributed with Large Models
```bash
# Open-Sora distributed
python3 videogen --model open_sora_1_2 \
--prompt "detailed fantasy world" \
--length 60 --width 1920 --height 1080 \
--distribute --vram_limit 30 --output fantasy_world
# Step-Video distributed (extreme VRAM)
python3 videogen --model step_video_t2v \
--prompt "feature film quality scene" \
--length 120 \
--distribute --vram_limit 40 --offload_strategy sequential \
--output feature_film
```
### Distributed I2V
```bash
# Distributed I2V generation
python3 videogen --image_to_video --model svd_xt_1.1 \
--image_model flux_dev \
--prompt "complex animated scene" \
--prompt_animation "multiple characters moving" \
--length 20 --distribute --output complex_i2v
```
---
## Model Management
### Listing Models
```bash
# List all models
python3 videogen --model-list
# List only I2V models
python3 videogen --model-list --i2v-only
# List only T2V models
python3 videogen --model-list --t2v-only
# List NSFW-friendly models
python3 videogen --model-list --nsfw-friendly
# List low VRAM models (≤16GB)
python3 videogen --model-list --low-vram
# List high VRAM models (>30GB)
python3 videogen --model-list --high-vram
# List extreme VRAM models (>55GB)
python3 videogen --model-list --huge-vram
# Combine filters
python3 videogen --model-list --i2v-only --low-vram
python3 videogen --model-list --nsfw-friendly --high-vram
```
### Model Details
```bash
# Show details by numeric ID
python3 videogen --show-model 1
# Show details by name
python3 videogen --show-model wan_14b_t2v
python3 videogen --show-model svd_xt_1.1
```
### Searching for Models
```bash
# Search HuggingFace for models
python3 videogen --search-models "video generation"
python3 videogen --search-models "stable video diffusion"
python3 videogen --search-models "nsfw video"
python3 videogen --search-models "anime"
# Search with limit
python3 videogen --search-models "flux" --search-limit 50
```
### Adding Models
```bash
# Add model by ID
python3 videogen --add-model stabilityai/stable-video-diffusion-img2vid-xt-1.1 \
--name svd_xt_1.1
# Add model by URL
python3 videogen --add-model "https://huggingface.co/stabilityai/stable-video-diffusion-img2vid-xt-1.1" \
--name svd_xt_1.1
# Add model (name auto-generated)
python3 videogen --add-model Wan-AI/Wan2.1-T2V-14B-Diffusers
# Validate model exists
python3 videogen --validate-model stabilityai/stable-video-diffusion-img2vid-xt-1.1
```
### Updating Model Database
```bash
# Update from HuggingFace
python3 videogen --update-models
# Update with HuggingFace token (for gated models)
export HF_TOKEN=your_token_here
python3 videogen --update-models
```
### Listing TTS Voices
```bash
# List available TTS voices
python3 videogen --tts-list
```
---
## VRAM Management
### Offloading Strategies
```bash
# No offloading (fastest, needs most VRAM)
python3 videogen --model wan_14b_t2v --prompt "test" \
--offload_strategy none
# Model offloading (balanced)
python3 videogen --model wan_14b_t2v --prompt "test" \
--offload_strategy model
# Sequential offloading (slower, less VRAM)
python3 videogen --model wan_14b_t2v --prompt "test" \
--offload_strategy sequential
# Group offloading
python3 videogen --model wan_14b_t2v --prompt "test" \
--offload_strategy group --offload_group_size 8
# Auto map (let accelerate decide)
python3 videogen --model wan_14b_t2v --prompt "test" \
--offload_strategy auto_map
```
### VRAM Limits
```bash
# Limit VRAM usage
python3 videogen --model wan_14b_t2v --prompt "test" \
--vram_limit 16
# Very limited VRAM
python3 videogen --model wan_1.3b_t2v --prompt "test" \
--vram_limit 8 --offload_strategy sequential
# High VRAM system
python3 videogen --model hunyuanvideo --prompt "test" \
--vram_limit 48
```
### Low RAM Mode
```bash
# Enable low CPU RAM mode
python3 videogen --model wan_14b_t2v --prompt "test" \
--low_ram_mode
# Low RAM with offloading
python3 videogen --model wan_14b_t2v --prompt "test" \
--low_ram_mode --offload_strategy sequential
# Offload to disk
python3 videogen --model wan_14b_t2v --prompt "test" \
--low_ram_mode --offload_dir ./offload_cache
```
### System RAM Limit
```bash
# Limit system RAM usage
python3 videogen --model wan_14b_t2v --prompt "test" \
--system_ram_limit 32
```
---
## Upscaling
### Basic Upscaling
```bash
# 2x upscale
python3 videogen --model wan_14b_t2v --prompt "beautiful scene" \
--upscale --output upscaled
# 4x upscale
python3 videogen --model wan_14b_t2v --prompt "detailed landscape" \
--upscale --upscale_factor 4.0 --output high_res
# 1.5x upscale
python3 videogen --model wan_14b_t2v --prompt "portrait" \
--upscale --upscale_factor 1.5 --output medium_res
```
### Upscaling with I2V
```bash
# I2V with upscale
python3 videogen --image_to_video --model svd_xt_1.1 \
--image_model flux_dev --prompt "cinematic scene" \
--prompt_animation "slow camera movement" \
--upscale --upscale_factor 2.0 --output cinematic_hd
```
### Upscaling Considerations
```bash
# Upscaling takes significant time, use for final output
# Original: 832x480 -> Upscaled 2x: 1664x960
python3 videogen --model wan_14b_t2v \
--prompt "high quality nature footage" \
--width 832 --height 480 \
--upscale --upscale_factor 2.0 \
--output nature_hd
# For 4K output (from 1080p base)
python3 videogen --model wan_14b_t2v \
--prompt "4K ready content" \
--width 1920 --height 1080 \
--upscale --upscale_factor 2.0 \
--output 4k_output
```
---
## NSFW Content
### Basic NSFW Generation
```bash
# NSFW T2V
python3 videogen --model wan_14b_t2v \
--prompt "intimate romantic scene" \
--no_filter --output romantic
# NSFW I2V
python3 videogen --image_to_video --model svd_xt_1.1 \
--image_model flux_nsfw \
--prompt "adult content scene" \
--prompt_animation "passionate movement" \
--no_filter --output adult
```
### NSFW with Specific Models
```bash
# Pony NSFW
python3 videogen --model pony_v6 \
--prompt "explicit anime content" \
--no_filter --output anime_adult.png
# Flux NSFW
python3 videogen --model flux_nsfw \
--prompt "adult photography style" \
--no_filter --output adult.png
# SDXL NSFW
python3 videogen --model sdxl_nsfw \
--prompt "explicit content" \
--no_filter --output explicit.png
```
### NSFW with Audio
```bash
# NSFW with TTS
python3 videogen --image_to_video --model svd_xt_1.1 \
--image_model flux_nsfw \
--prompt "intimate scene" \
--generate_audio --audio_type tts \
--audio_text "I want you so bad" \
--tts_voice edge_female_us \
--no_filter --output intimate_audio
# NSFW with lip sync
python3 videogen --image_to_video --model svd_xt_1.1 \
--image_model flux_nsfw \
--prompt "adult scene with dialogue" \
--generate_audio --audio_type tts \
--audio_text "Explicit dialogue here" \
--lip_sync \
--no_filter --output adult_lipsync
```
### Auto Mode NSFW Detection
```bash
# Auto mode will detect NSFW and enable --no_filter automatically
python3 videogen --auto --prompt "explicit adult scene with nudity"
# Auto mode with NSFW I2V
python3 videogen --auto --prompt "passionate intimate scene between lovers"
```
---
## Advanced Combinations
### Complete Production Pipeline
```bash
# Full pipeline: I2V + Audio + Sync + Lip Sync + Upscale
python3 videogen --image_to_video --model svd_xt_1.1 \
--image_model flux_dev \
--prompt "professional news anchor" \
--prompt_animation "natural speaking gestures and expressions" \
--width 1280 --height 720 \
--length 15 --fps 24 \
--generate_audio --audio_type tts \
--audio_text "Good evening, I'm your host for tonight's broadcast. We have some breaking news to share with you." \
--tts_voice edge_male_us \
--sync_audio \
--lip_sync \
--upscale --upscale_factor 2.0 \
--output news_broadcast
```
### Multi-Stage Workflow
```bash
# Stage 1: Generate base image
python3 videogen --model flux_dev \
--prompt "cinematic portrait of a woman, dramatic lighting" \
--width 832 --height 480 \
--output stage1_image.png
# Stage 2: Modify with I2I
python3 videogen --model flux_dev --image-to-image \
--image stage1_image.png \
--prompt "add rain effects, wet skin" \
--strength 0.4 \
--output stage2_modified.png
# Stage 3: Animate with I2V
python3 videogen --model svd_xt_1.1 \
--image stage2_modified.png \
--prompt "rain falling, subtle head movement" \
--output stage3_animated
# Stage 4: Add audio
python3 videogen --model svd_xt_1.1 \
--image stage2_modified.png \
--prompt "rain falling, subtle head movement" \
--generate_audio --audio_type music \
--audio_text "melancholic piano with rain sounds" \
--sync_audio \
--output stage4_with_audio
```
### Batch Processing Script
```bash
#!/bin/bash
# batch_generate.sh
PROMPTS=(
"sunset over ocean"
"mountain landscape"
"city street at night"
"forest in autumn"
"desert dunes"
)
MODELS=(
"wan_1.3b_t2v"
"wan_14b_t2v"
)
for prompt in "${PROMPTS[@]}"; do
for model in "${MODELS[@]}"; do
safe_name=$(echo "$prompt" | tr ' ' '_')
python3 videogen --model "$model" \
--prompt "$prompt" \
--length 5 \
--output "${model}_${safe_name}"
done
done
```
### Comparison Generation
```bash
# Generate same prompt with different models
python3 videogen --model wan_1.3b_t2v --prompt "epic battle" --output battle_small
python3 videogen --model wan_14b_t2v --prompt "epic battle" --output battle_medium
python3 videogen --model mochi_1_preview --prompt "epic battle" --output battle_large
python3 videogen --model hunyuanvideo --prompt "epic battle" --output battle_huge
```
### Resolution Testing
```bash
# Test different resolutions
for res in "640x360" "832x480" "1280x720" "1920x1080"; do
w=$(echo $res | cut -dx -f1)
h=$(echo $res | cut -dx -f2)
python3 videogen --model wan_14b_t2v \
--prompt "test scene" \
--width $w --height $h \
--output "test_${w}x${h}"
done
```
### Seed Exploration
```bash
# Generate multiple variations with different seeds
for seed in 1 42 123 456 789; do
python3 videogen --model wan_14b_t2v \
--prompt "beautiful woman portrait" \
--seed $seed \
--output "portrait_seed_$seed"
done
```
### Style Variations
```bash
# Same subject, different styles
STYLES=(
"photorealistic"
"oil painting"
"watercolor"
"anime"
"cyberpunk"
"fantasy art"
)
for style in "${STYLES[@]}"; do
python3 videogen --model wan_14b_t2v \
--prompt "woman in red dress, $style style" \
--output "woman_$style"
done
```
---
## Quick Reference
### Common Flags
| Flag | Description | Example |
|------|-------------|---------|
| `--model` | Model to use | `--model wan_14b_t2v` |
| `--prompt` | Main prompt | `--prompt "a cat"` |
| `--length` | Duration in seconds | `--length 10` |
| `--width` | Video width | `--width 1280` |
| `--height` | Video height | `--height 720` |
| `--fps` | Frames per second | `--fps 24` |
| `--output` | Output filename | `--output my_video` |
| `--seed` | Random seed | `--seed 42` |
| `--no_filter` | Disable NSFW filter | `--no_filter` |
| `--upscale` | Enable upscaling | `--upscale` |
### Audio Flags
| Flag | Description | Example |
|------|-------------|---------|
| `--generate_audio` | Enable audio | `--generate_audio` |
| `--audio_type` | tts or music | `--audio_type tts` |
| `--audio_text` | Audio prompt | `--audio_text "Hello"` |
| `--tts_voice` | TTS voice | `--tts_voice edge_male_us` |
| `--sync_audio` | Sync to video | `--sync_audio` |
| `--lip_sync` | Enable lip sync | `--lip_sync` |
### Model Management
| Flag | Description | Example |
|------|-------------|---------|
| `--model-list` | List models | `--model-list` |
| `--show-model` | Show details | `--show-model 1` |
| `--search-models` | Search HF | `--search-models "video"` |
| `--add-model` | Add model | `--add-model org/model` |
| `--update-models` | Update database | `--update-models` |
### VRAM Management
| Flag | Description | Example |
|------|-------------|---------|
| `--vram_limit` | GPU VRAM limit | `--vram_limit 20` |
| `--offload_strategy` | Offload mode | `--offload_strategy sequential` |
| `--low_ram_mode` | Low CPU RAM | `--low_ram_mode` |
---
## Troubleshooting
### Out of Memory
```bash
# Reduce resolution
python3 videogen --model wan_14b_t2v --prompt "test" \
--width 640 --height 360
# Use smaller model
python3 videogen --model wan_1.3b_t2v --prompt "test"
# Enable aggressive offloading
python3 videogen --model wan_14b_t2v --prompt "test" \
--offload_strategy sequential --low_ram_mode
# Limit VRAM
python3 videogen --model wan_14b_t2v --prompt "test" \
--vram_limit 16
```
### Slow Generation
```bash
# Use smaller model
python3 videogen --model wan_1.3b_t2v --prompt "test"
# Reduce length
python3 videogen --model wan_14b_t2v --prompt "test" --length 3
# Lower FPS
python3 videogen --model wan_14b_t2v --prompt "test" --fps 12
# Skip upscaling
python3 videogen --model wan_14b_t2v --prompt "test"
# (don't add --upscale)
```
### Model Not Found
```bash
# Update model database
python3 videogen --update-models
# Search for model
python3 videogen --search-models "model name"
# Add manually
python3 videogen --add-model "org/model-name" --name my_model
```
### Audio Issues
```bash
# Check audio dependencies
pip install scipy soundfile librosa edge-tts
pip install git+https://github.com/suno-ai/bark.git
pip install audiocraft
# Use simpler TTS
python3 videogen --model wan_14b_t2v --prompt "test" \
--generate_audio --audio_type tts \
--tts_voice edge_female_us # Edge-TTS is most reliable
```
---
## Environment Variables
```bash
# Set HuggingFace token for gated models
export HF_TOKEN=your_token_here
# Set custom cache directory
export HF_HOME=/path/to/cache
# Set CUDA device
export CUDA_VISIBLE_DEVICES=0,1
```
---
## Configuration Files
Models are stored in `~/.config/videogen/models.json`
You can edit this file directly to:
- Add custom models
- Modify VRAM estimates
- Change default settings
- Add model aliases
\ No newline at end of file
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright © 2026 Stefy <stefy@nexlab.net>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
---
The full text of the GNU General Public License v3 follows:
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the work is being offered to the
public at no charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part that is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide whether future
versions of the GNU General Public License shall apply, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
VideoGen - Universal Video Generation Toolkit
Copyright (C) 2026 Stefy <stefy@nexlab.net>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
VideoGen Copyright (C) 2026 Stefy <stefy@nexlab.net>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
\ No newline at end of file
# VideoGen - Universal Video Generation Toolkit
**Copyleft © 2026 Stefy <stefy@nexlab.net>**
A comprehensive, GPU-accelerated video generation toolkit supporting Text-to-Video (T2V), Image-to-Video (I2V), Text-to-Image (T2I), and Image-to-Image (I2I) generation with audio synthesis, synchronization, and lip-sync capabilities.
---
## Features
### Video Generation
- **Text-to-Video (T2V)**: Generate videos from text prompts
- **Image-to-Video (I2V)**: Animate static images
- **Text-to-Image (T2I)**: Generate high-quality images
- **Image-to-Image (I2I)**: Transform existing images
### Audio Capabilities
- **Text-to-Speech (TTS)**: Multiple voices via Bark and Edge-TTS
- **Music Generation**: MusicGen integration for background music
- **Audio Sync**: Match audio duration to video (stretch, trim, pad, loop)
- **Lip Sync**: Wav2Lip and SadTalker integration
### Model Support
- **Small Models** (<16GB VRAM): Wan 1.3B, Zeroscope, ModelScope
- **Medium Models** (16-30GB VRAM): Wan 14B, CogVideoX, Mochi
- **Large Models** (30-50GB VRAM): Allegro, HunyuanVideo
- **Huge Models** (50GB+ VRAM): Open-Sora, Step-Video, Lumina
### Smart Features
- **Auto Mode**: Automatic model selection and configuration
- **NSFW Detection**: Automatic content classification
- **Prompt Splitting**: Intelligent I2V prompt separation
- **Time Estimation**: Predict generation time before starting
- **Multi-GPU**: Distributed generation across multiple GPUs
### AI Integration
- **MCP Server**: Model Context Protocol wrapper for AI agents
- **Skill Documentation**: Comprehensive AI agent integration guide
---
## Installation
### Core Dependencies
```bash
pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu121 --break-system-packages
pip install git+https://github.com/huggingface/diffusers.git --break-system-packages
pip install git+https://github.com/huggingface/transformers.git --break-system-packages
pip install --upgrade accelerate xformers spandrel psutil ffmpeg-python ftfy --break-system-packages
```
### Audio Features (Optional)
```bash
pip install scipy soundfile librosa --break-system-packages
pip install git+https://github.com/suno-ai/bark.git --break-system-packages
pip install edge-tts --break-system-packages
pip install audiocraft
```
### Lip Sync (Optional)
```bash
pip install opencv-python face-recognition dlib --break-system-packages
git clone https://github.com/Rudrabha/Wav2Lip.git
```
### MCP Server (For AI Agents)
```bash
pip install mcp
```
---
## Quick Start
### First-Time Setup
**IMPORTANT**: Before using VideoGen, update the model database:
```bash
python3 videogen --update-models
```
This fetches the latest model list from HuggingFace and populates the local database.
### Basic Usage
```bash
# Simple video generation
python3 videogen --model wan_1.3b_t2v --prompt "a cat playing piano" --output cat_piano
# Auto mode - let the script decide everything
python3 videogen --auto --prompt "a beautiful sunset over the ocean"
# Generate with audio
python3 videogen --model wan_14b_t2v --prompt "epic battle scene" \
--generate_audio --audio_type music --sync_audio --output battle
```
### Image-to-Video
```bash
# Animate an existing image
python3 videogen --model svd_xt_1.1 --image my_photo.jpg \
--prompt "add subtle motion" --output animated
# I2V with auto-generated image
python3 videogen --image_to_video --model svd_xt_1.1 \
--image_model flux_dev --prompt "cinematic portrait" \
--prompt_animation "gentle head movement" --output portrait
```
### With Lip Sync
```bash
python3 videogen --image_to_video --model svd_xt_1.1 \
--image_model flux_dev --prompt "person speaking" \
--generate_audio --audio_type tts \
--audio_text "Hello, welcome to my channel" \
--lip_sync --output speaker
```
---
## AI Agent Integration
### MCP Server
VideoGen includes an MCP (Model Context Protocol) server for seamless integration with AI agents like Claude:
```bash
# Start the MCP server
python3 videogen_mcp_server.py
```
Add to Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
```json
{
"mcpServers": {
"videogen": {
"command": "python3",
"args": ["/path/to/videogen_mcp_server.py"]
}
}
}
```
### Available MCP Tools
| Tool | Description |
|------|-------------|
| `videogen_generate` | Generate video with auto mode |
| `videogen_generate_video` | Text-to-Video generation |
| `videogen_generate_image` | Text-to-Image generation |
| `videogen_animate_image` | Image-to-Video animation |
| `videogen_transform_image` | Image-to-Image transformation |
| `videogen_generate_with_audio` | Video with TTS or music |
| `videogen_list_models` | List available models |
| `videogen_show_model` | Show model details |
| `videogen_update_models` | Update model database |
| `videogen_search_models` | Search HuggingFace |
| `videogen_add_model` | Add model to database |
| `videogen_list_tts_voices` | List TTS voices |
### Skill Documentation
See [SKILL.md](SKILL.md) for comprehensive AI agent integration guide including:
- Quick reference commands
- Common use cases
- Model selection guide
- Error handling
- Programmatic usage examples
---
## Documentation
- **[EXAMPLES.md](EXAMPLES.md)**: Comprehensive command-line examples for all features
- **[SKILL.md](SKILL.md)**: AI agent integration guide
- **Built-in help**: `python3 videogen --help`
- **Model list**: `python3 videogen --model-list`
- **TTS voices**: `python3 videogen --tts-list`
---
## Model Management
```bash
# Update model database (run this first!)
python3 videogen --update-models
# List available models
python3 videogen --model-list
# List models by VRAM requirement
python3 videogen --model-list --low-vram # ≤16GB
python3 videogen --model-list --high-vram # >30GB
python3 videogen --model-list --huge-vram # >55GB
# Search HuggingFace for models
python3 videogen --search-models "video generation"
# Add a model
python3 videogen --add-model stabilityai/stable-video-diffusion-img2vid-xt-1.1 --name svd_xt
# Show model details
python3 videogen --show-model 1
```
---
## VRAM Management
```bash
# Limit VRAM usage
python3 videogen --model wan_14b_t2v --prompt "test" --vram_limit 16
# Offloading strategies
python3 videogen --model wan_14b_t2v --prompt "test" --offload_strategy sequential
# Low RAM mode
python3 videogen --model wan_14b_t2v --prompt "test" --low_ram_mode
```
---
## Distributed Generation
```bash
# Multi-GPU distributed generation
python3 videogen --model hunyuanvideo --prompt "epic scene" \
--length 30 --distribute --vram_limit 20
```
---
## Configuration
Models are stored in `~/.config/videogen/models.json`
Set environment variables:
```bash
export HF_TOKEN=your_token_here # For gated models
export HF_HOME=/path/to/cache # Custom cache directory
export CUDA_VISIBLE_DEVICES=0,1 # GPU selection
```
---
## Project Structure
```
videogen/
├── videogen # Main script
├── videogen_mcp_server.py # MCP server for AI agents
├── README.md # This file
├── EXAMPLES.md # Comprehensive examples
├── SKILL.md # AI agent integration guide
├── LICENSE.md # GPLv3 License
└── requirements.txt # Python dependencies
```
---
## License
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
See [LICENSE.md](LICENSE.md) for the full license text.
---
## Copyleft
**VideoGen - Universal Video Generation Toolkit**
Copyright © 2026 Stefy <stefy@nexlab.net>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
---
## Contributing
Contributions are welcome! Please feel free to submit pull requests.
---
## Support
For issues and questions, please open an issue on the repository or contact stefy@nexlab.net.
\ No newline at end of file
# VideoGen AI Agent Skill
**Copyleft © 2026 Stefy <stefy@nexlab.net>**
This skill enables AI agents to use the VideoGen toolkit for video, image, and audio generation.
---
## Overview
VideoGen is a universal video generation toolkit that supports:
- **Text-to-Video (T2V)**: Generate videos from text prompts
- **Image-to-Video (I2V)**: Animate static images
- **Text-to-Image (T2I)**: Generate images from text
- **Image-to-Image (I2I)**: Transform existing images
- **Audio Generation**: TTS and music generation
- **Lip Sync**: Synchronize lip movements with audio
---
## ⚠️ IMPORTANT: First-Time Setup
Before using VideoGen, you MUST update the model database:
```bash
python3 videogen --update-models
```
This command:
- Fetches the latest model list from HuggingFace
- Populates the local model database
- Enables model discovery and selection
**Run this command once before using any other VideoGen features.**
---
## Quick Reference for AI Agents
### Basic Commands
```bash
# ⚠️ FIRST: Update model database (required on first use)
python3 videogen --update-models
# Simple video generation
python3 videogen --model <model_name> --prompt "<prompt>" --output <output_name>
# Auto mode (recommended for AI agents)
python3 videogen --auto --prompt "<prompt>" --output <output_name>
# List available models
python3 videogen --model-list
# Show model details
python3 videogen --show-model <model_id_or_name>
```
### Generation Types
| Type | Command Pattern | Use Case |
|------|-----------------|----------|
| T2V | `--model t2v_model --prompt "..."` | Generate video from text |
| I2V | `--image_to_video --model i2v_model --prompt "..."` | Animate an image |
| T2I | `--model t2i_model --prompt "..." --output image.png` | Generate image |
| I2I | `--image-to-image --image input.png --prompt "..."` | Transform image |
### Auto Mode
Auto mode is the easiest way for AI agents to generate content:
```bash
# First, ensure models are updated
python3 videogen --update-models
# Then use auto mode
python3 videogen --auto --prompt "<description>"
```
Auto mode automatically:
1. Detects the generation type from the prompt
2. Detects NSFW content
3. Selects the best model for available VRAM
4. Configures all settings
5. Prints the command line for reproduction
---
## Common Use Cases
### 1. Generate a Simple Video
```bash
python3 videogen --auto --prompt "a cat playing piano" --output cat_piano
```
### 2. Generate a Video with Narration
```bash
python3 videogen --auto --prompt "a woman speaking to camera" \
--generate_audio --audio_type tts \
--audio_text "Welcome to my channel" \
--output speaker
```
### 3. Animate an Existing Image
```bash
python3 videogen --model svd_xt_1.1 --image photo.jpg \
--prompt "add subtle motion" --output animated
```
### 4. Generate an Image
```bash
python3 videogen --model flux_dev --prompt "beautiful landscape" \
--output landscape.png
```
### 5. Transform an Image
```bash
python3 videogen --model flux_dev --image-to-image \
--image photo.jpg --prompt "make it look like a painting" \
--output painted.png
```
### 6. Generate Video with Music
```bash
python3 videogen --model wan_14b_t2v --prompt "epic battle scene" \
--generate_audio --audio_type music \
--audio_text "epic orchestral music" \
--sync_audio --output battle
```
### 7. Generate Video with Lip Sync
```bash
python3 videogen --image_to_video --model svd_xt_1.1 \
--image_model flux_dev --prompt "person speaking" \
--generate_audio --audio_type tts \
--audio_text "Hello world" \
--lip_sync --output speaker
```
---
## Model Selection Guide
### By VRAM
| VRAM | Recommended Models |
|------|-------------------|
| <16GB | `wan_1.3b_t2v`, `zeroscope_v2_576w` |
| 16-30GB | `wan_14b_t2v`, `cogvideox_2b`, `mochi_1_preview` |
| 30-50GB | `allegro`, `hunyuanvideo` |
| 50GB+ | `open_sora_1_2`, `step_video_t2v` |
### By Task
| Task | Recommended Models |
|------|-------------------|
| Fast T2V | `wan_1.3b_t2v` |
| Quality T2V | `wan_14b_t2v`, `mochi_1_preview` |
| I2V | `svd_xt_1.1`, `wan_14b_i2v` |
| T2I | `flux_dev`, `sdxl_base` |
| Anime | `pony_v6` |
---
## Output Files
VideoGen creates these output files:
| File | Description |
|------|-------------|
| `<output>.mp4` | Generated video |
| `<output>.png` | Generated image (if T2I mode) |
| `<output>_init.png` | Initial image (I2V mode) |
| `<output>_tts.wav` | TTS audio |
| `<output>_music.wav` | Generated music |
| `<output>_synced.mp4` | Audio-synced video |
| `<output>_lipsync.mp4` | Lip-synced video |
| `<output>_upscaled.mp4` | Upscaled video |
---
## Error Handling
### Common Errors
1. **Model not found**
- Run `python3 videogen --update-models` to update the database
- Use `--model-list` to see available models
2. **Out of memory**
- Use a smaller model
- Add `--offload_strategy sequential`
- Reduce resolution with `--width` and `--height`
3. **Pipeline class not found**
- Update diffusers: `pip install --upgrade git+https://github.com/huggingface/diffusers.git`
---
## AI Agent Integration Tips
### 1. Always Use Auto Mode First
Auto mode handles most cases automatically:
```bash
python3 videogen --auto --prompt "<user's request>"
```
### 2. Parse the Output
Auto mode prints:
- Detection results (type, NSFW, motion)
- Selected model
- Full command line for reproduction
### 3. Handle User Preferences
If the user specifies:
- **Quality**: Use larger models like `wan_14b_t2v`, `mochi_1_preview`
- **Speed**: Use smaller models like `wan_1.3b_t2v`
- **Resolution**: Set `--width` and `--height`
- **Duration**: Set `--length`
### 4. NSFW Content
Auto mode detects NSFW content automatically. For explicit requests:
```bash
python3 videogen --model <model> --prompt "<prompt>" --no_filter
```
### 5. Reproducibility
Always capture and store the seed for reproducibility:
```bash
python3 videogen --model <model> --prompt "<prompt>" --seed 42
```
---
## Example Workflows
### Workflow 1: Content Creator
```bash
# Step 1: Generate intro video with narration
python3 videogen --auto --prompt "professional intro animation with logo" \
--generate_audio --audio_type tts \
--audio_text "Welcome to my channel" \
--output intro
# Step 2: Generate main content
python3 videogen --auto --prompt "tutorial scene with presenter" \
--length 30 --output main_content
# Step 3: Generate outro
python3 videogen --auto --prompt "end screen with subscribe button" \
--output outro
```
### Workflow 2: Social Media
```bash
# Generate short vertical video
python3 videogen --model wan_14b_t2v \
--prompt "trending dance move" \
--width 720 --height 1280 \
--length 10 --fps 30 \
--output social_clip
```
### Workflow 3: Music Video
```bash
# Generate video with synchronized music
python3 videogen --model wan_14b_t2v \
--prompt "cinematic music video scene" \
--generate_audio --audio_type music \
--audio_text "upbeat pop song with catchy melody" \
--music_model large \
--sync_audio \
--output music_video
```
---
## Programmatic Usage
### Python Integration
```python
import subprocess
import json
def generate_video(prompt, output="output", model=None, auto=True):
"""Generate a video using VideoGen"""
cmd = ["python3", "videogen"]
if auto:
cmd.append("--auto")
elif model:
cmd.extend(["--model", model])
cmd.extend(["--prompt", prompt, "--output", output])
result = subprocess.run(cmd, capture_output=True, text=True)
return result.stdout, result.returncode
def list_models(filter_type=None):
"""List available models"""
cmd = ["python3", "videogen", "--model-list"]
if filter_type == "i2v":
cmd.append("--i2v-only")
elif filter_type == "low_vram":
cmd.append("--low-vram")
result = subprocess.run(cmd, capture_output=True, text=True)
return result.stdout
def get_model_info(model_id):
"""Get details for a specific model"""
cmd = ["python3", "videogen", "--show-model", str(model_id)]
result = subprocess.run(cmd, capture_output=True, text=True)
return result.stdout
def update_models():
"""Update model database from HuggingFace"""
cmd = ["python3", "videogen", "--update-models"]
result = subprocess.run(cmd, capture_output=True, text=True)
return result.stdout
```
### JSON Output (Future Feature)
VideoGen can be extended to output JSON for easier parsing:
```python
# Future: Add --json flag for machine-readable output
cmd = ["python3", "videogen", "--auto", "--prompt", prompt, "--json"]
result = subprocess.run(cmd, capture_output=True, text=True)
data = json.loads(result.stdout)
print(f"Video saved to: {data['output_file']}")
print(f"Seed: {data['seed']}")
print(f"Model: {data['model']}")
```
---
## Best Practices for AI Agents
1. **Update models first** - Run `--update-models` before first use
2. **Start with auto mode** - It handles most cases well
3. **Check VRAM** - Use `--model-list --low-vram` for limited hardware
4. **Set seeds** - For reproducibility, always specify `--seed`
5. **Handle errors gracefully** - Check return codes and stderr
6. **Store command lines** - Auto mode prints reproducible commands
7. **Respect user preferences** - Quality vs speed, resolution, duration
8. **Use appropriate models** - Match model size to task complexity
---
## Troubleshooting
### Command Fails
```bash
# First: Update model database
python3 videogen --update-models
# Check if model exists
python3 videogen --model-list | grep <model_name>
# Check dependencies
pip install -r requirements.txt
```
### No Models Available
```bash
# This means the model database hasn't been initialized
python3 videogen --update-models
# Wait for it to complete (may take a few minutes)
# Then verify
python3 videogen --model-list
```
### Slow Generation
```bash
# Use smaller model
python3 videogen --model wan_1.3b_t2v --prompt "test"
# Reduce length
python3 videogen --model wan_14b_t2v --prompt "test" --length 3
```
### Quality Issues
```bash
# Use larger model
python3 videogen --model wan_14b_t2v --prompt "detailed scene"
# Increase steps (for image models)
python3 videogen --model flux_dev --prompt "test" --image-steps 50
# Use upscale
python3 videogen --model wan_14b_t2v --prompt "test" --upscale
```
---
## Support
For issues and questions:
- Email: stefy@nexlab.net
- Repository: git.nexlab.net:nexlab/videogen.git
- Documentation: See EXAMPLES.md for comprehensive examples
\ No newline at end of file
# VideoGen - Universal Video Generation Toolkit
# Copyleft © 2026 Stefy <stefy@nexlab.net>
# Core Dependencies (Required)
torch>=2.0.0
torchvision>=0.15.0
torchaudio>=2.0.0
diffusers>=0.30.0
transformers>=4.35.0
accelerate>=0.24.0
xformers>=0.0.22
spandrel>=0.1.0
psutil>=5.9.0
ffmpeg-python>=0.2.0
ftfy>=6.1.0
Pillow>=10.0.0
safetensors>=0.4.0
huggingface-hub>=0.19.0
# Audio Dependencies (Optional - for TTS and music generation)
scipy>=1.11.0
soundfile>=0.12.0
librosa>=0.10.0
edge-tts>=6.1.0
# bark # Install with: pip install git+https://github.com/suno-ai/bark.git
# audiocraft # Install with: pip install audiocraft
# Lip Sync Dependencies (Optional)
opencv-python>=4.8.0
face-recognition>=1.14.0
# dlib # Install with: pip install dlib (requires cmake)
# Model Management
requests>=2.31.0
urllib3>=2.0.0
# Progress and UI
tqdm>=4.66.0
rich>=13.0.0
# Configuration
pydantic>=2.0.0
# Distributed Processing
# accelerate # Already listed above
# Optional: NSFW Classification
# onnxruntime>=1.16.0
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
#!/usr/bin/env python3
"""
VideoGen MCP Server - Model Context Protocol wrapper for VideoGen
Copyleft © 2026 Stefy <stefy@nexlab.net>
This MCP server exposes VideoGen functionality to AI agents through the
Model Context Protocol, enabling seamless integration with Claude and other
MCP-compatible AI systems.
Installation:
pip install mcp
Usage:
python3 videogen_mcp_server.py
Or add to Claude Desktop config:
{
"mcpServers": {
"videogen": {
"command": "python3",
"args": ["/path/to/videogen_mcp_server.py"]
}
}
}
"""
import asyncio
import json
import os
import subprocess
import sys
from pathlib import Path
from typing import Any, Optional
from mcp.server import Server
from mcp.server.stdio import stdio_server
from mcp.types import Tool, TextContent
# Create server instance
server = Server("videogen")
# Path to videogen script
VIDEOGEN_PATH = Path(__file__).parent / "videogen"
def run_videogen_command(args: list, timeout: int = 3600):
"""Run a videogen command and return output and return code"""
cmd = [sys.executable, str(VIDEOGEN_PATH)] + args
try:
result = subprocess.run(
cmd,
capture_output=True,
text=True,
timeout=timeout,
cwd=str(VIDEOGEN_PATH.parent)
)
return result.stdout + result.stderr, result.returncode
except subprocess.TimeoutExpired:
return "Error: Command timed out", 1
except Exception as e:
return f"Error: {str(e)}", 1
def parse_model_list(output: str) -> list:
"""Parse model list output into structured data"""
models = []
lines = output.strip().split('\n')
for line in lines:
if line.startswith('ID') or line.startswith('-') or not line.strip():
continue
if 'Total shown' in line or 'Use --model' in line:
continue
parts = line.split()
if len(parts) >= 8:
try:
model = {
"id": int(parts[0]),
"name": parts[1],
"vram": parts[2],
"i2v": parts[3] == "Yes",
"t2v": parts[4] == "Yes",
"t2i": parts[5] == "Yes",
"i2i": parts[6] == "Yes",
"nsfw": parts[7] == "Yes",
}
if len(parts) >= 9:
model["lora"] = parts[8] == "Yes"
models.append(model)
except (ValueError, IndexError):
continue
return models
@server.list_tools()
async def list_tools() -> list:
"""List available VideoGen tools"""
return [
Tool(
name="videogen_generate",
description="Generate a video using VideoGen with automatic mode selection. This is the primary tool for video generation. It automatically detects the best generation type, selects the appropriate model, configures settings, and handles NSFW content detection.",
inputSchema={
"type": "object",
"properties": {
"prompt": {
"type": "string",
"description": "The main prompt describing what to generate"
},
"output": {
"type": "string",
"description": "Output filename (without extension)",
"default": "output"
},
"model": {
"type": "string",
"description": "Specific model to use (optional, auto-selected if not provided)"
},
"length": {
"type": "number",
"description": "Video duration in seconds",
"default": 5.0
},
"width": {
"type": "integer",
"description": "Video width in pixels",
"default": 832
},
"height": {
"type": "integer",
"description": "Video height in pixels",
"default": 480
},
"fps": {
"type": "integer",
"description": "Frames per second",
"default": 15
},
"seed": {
"type": "integer",
"description": "Random seed for reproducibility (-1 for random)",
"default": -1
},
"auto": {
"type": "boolean",
"description": "Use automatic mode (recommended)",
"default": True
},
"no_filter": {
"type": "boolean",
"description": "Disable NSFW filter",
"default": False
}
},
"required": ["prompt"]
}
),
Tool(
name="videogen_generate_video",
description="Generate a video from text (Text-to-Video). Use this when you specifically want T2V generation without auto-detection.",
inputSchema={
"type": "object",
"properties": {
"prompt": {
"type": "string",
"description": "Description of the video to generate"
},
"model": {
"type": "string",
"description": "Model name (use videogen_list_models to see options)"
},
"output": {
"type": "string",
"description": "Output filename",
"default": "output"
},
"length": {
"type": "number",
"description": "Duration in seconds",
"default": 5.0
},
"width": {
"type": "integer",
"default": 832
},
"height": {
"type": "integer",
"default": 480
},
"fps": {
"type": "integer",
"default": 15
},
"seed": {
"type": "integer",
"default": -1
}
},
"required": ["prompt", "model"]
}
),
Tool(
name="videogen_generate_image",
description="Generate an image from text (Text-to-Image). Use this for static image generation.",
inputSchema={
"type": "object",
"properties": {
"prompt": {
"type": "string",
"description": "Description of the image to generate"
},
"model": {
"type": "string",
"description": "Model name (e.g., flux_dev, sdxl_base, pony_v6)"
},
"output": {
"type": "string",
"description": "Output filename (should end with .png or .jpg)",
"default": "output.png"
},
"width": {
"type": "integer",
"default": 1024
},
"height": {
"type": "integer",
"default": 1024
},
"steps": {
"type": "integer",
"description": "Inference steps",
"default": 30
},
"seed": {
"type": "integer",
"default": -1
}
},
"required": ["prompt", "model"]
}
),
Tool(
name="videogen_animate_image",
description="Animate an existing image (Image-to-Video). Use this to add motion to a static image.",
inputSchema={
"type": "object",
"properties": {
"image": {
"type": "string",
"description": "Path to the input image file"
},
"prompt": {
"type": "string",
"description": "Description of the desired animation"
},
"model": {
"type": "string",
"description": "I2V model name (e.g., svd_xt_1.1, wan_14b_i2v)"
},
"output": {
"type": "string",
"default": "output"
},
"length": {
"type": "number",
"default": 5.0
},
"fps": {
"type": "integer",
"default": 15
}
},
"required": ["image", "prompt", "model"]
}
),
Tool(
name="videogen_transform_image",
description="Transform an existing image (Image-to-Image). Use this to modify or restyle an image.",
inputSchema={
"type": "object",
"properties": {
"image": {
"type": "string",
"description": "Path to the input image file"
},
"prompt": {
"type": "string",
"description": "Description of the desired transformation"
},
"model": {
"type": "string",
"description": "Model name (e.g., flux_dev, sdxl_base)"
},
"output": {
"type": "string",
"default": "output.png"
},
"strength": {
"type": "number",
"description": "Transformation strength (0.0-1.0)",
"default": 0.75
}
},
"required": ["image", "prompt", "model"]
}
),
Tool(
name="videogen_generate_with_audio",
description="Generate a video with audio (TTS or music). Use this for videos with narration or background music.",
inputSchema={
"type": "object",
"properties": {
"prompt": {
"type": "string",
"description": "Description of the video to generate"
},
"audio_type": {
"type": "string",
"enum": ["tts", "music"],
"description": "Type of audio: tts for speech, music for background music"
},
"audio_text": {
"type": "string",
"description": "Text for TTS or prompt for music generation"
},
"model": {
"type": "string",
"description": "Model name (optional, auto-selected if not provided)"
},
"output": {
"type": "string",
"default": "output"
},
"tts_voice": {
"type": "string",
"description": "TTS voice name (e.g., edge_male_us, edge_female_us)",
"default": "edge_female_us"
},
"sync_audio": {
"type": "boolean",
"description": "Sync audio duration to video",
"default": True
},
"lip_sync": {
"type": "boolean",
"description": "Apply lip sync (for TTS with I2V)",
"default": False
}
},
"required": ["prompt", "audio_type", "audio_text"]
}
),
Tool(
name="videogen_list_models",
description="List all available models. Use this to see what models are available for generation.",
inputSchema={
"type": "object",
"properties": {
"filter": {
"type": "string",
"enum": ["all", "i2v", "t2v", "low_vram", "high_vram", "huge_vram", "nsfw"],
"description": "Filter models by type or VRAM requirement",
"default": "all"
}
}
}
),
Tool(
name="videogen_show_model",
description="Show detailed information about a specific model.",
inputSchema={
"type": "object",
"properties": {
"model": {
"type": "string",
"description": "Model ID (number) or model name"
}
},
"required": ["model"]
}
),
Tool(
name="videogen_update_models",
description="Update the model database from HuggingFace. Use this to get the latest available models. IMPORTANT: Run this before using videogen for the first time, or when you need new models.",
inputSchema={
"type": "object",
"properties": {}
}
),
Tool(
name="videogen_search_models",
description="Search HuggingFace for models matching a query.",
inputSchema={
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "Search query (e.g., 'video generation', 'nsfw', 'anime')"
},
"limit": {
"type": "integer",
"description": "Maximum number of results",
"default": 20
}
},
"required": ["query"]
}
),
Tool(
name="videogen_add_model",
description="Add a model from HuggingFace to the local database.",
inputSchema={
"type": "object",
"properties": {
"model_id": {
"type": "string",
"description": "HuggingFace model ID (e.g., stabilityai/stable-video-diffusion-img2vid-xt-1.1)"
},
"name": {
"type": "string",
"description": "Short name for the model (optional, auto-generated if not provided)"
}
},
"required": ["model_id"]
}
),
Tool(
name="videogen_list_tts_voices",
description="List all available TTS voices for audio generation.",
inputSchema={
"type": "object",
"properties": {}
}
),
]
@server.call_tool()
async def call_tool(name: str, arguments: dict) -> list:
"""Handle tool calls"""
if name == "videogen_generate":
args = []
if arguments.get("auto", True):
args.append("--auto")
if arguments.get("model"):
args.extend(["--model", arguments["model"]])
args.extend(["--prompt", arguments["prompt"]])
args.extend(["--output", arguments.get("output", "output")])
if arguments.get("length"):
args.extend(["--length", str(arguments["length"])])
if arguments.get("width"):
args.extend(["--width", str(arguments["width"])])
if arguments.get("height"):
args.extend(["--height", str(arguments["height"])])
if arguments.get("fps"):
args.extend(["--fps", str(arguments["fps"])])
if arguments.get("seed", -1) >= 0:
args.extend(["--seed", str(arguments["seed"])])
if arguments.get("no_filter"):
args.append("--no_filter")
output, code = run_videogen_command(args)
return [TextContent(type="text", text=output)]
elif name == "videogen_generate_video":
args = [
"--model", arguments["model"],
"--prompt", arguments["prompt"],
"--output", arguments.get("output", "output"),
"--length", str(arguments.get("length", 5.0)),
"--width", str(arguments.get("width", 832)),
"--height", str(arguments.get("height", 480)),
"--fps", str(arguments.get("fps", 15)),
]
if arguments.get("seed", -1) >= 0:
args.extend(["--seed", str(arguments["seed"])])
output, code = run_videogen_command(args)
return [TextContent(type="text", text=output)]
elif name == "videogen_generate_image":
args = [
"--model", arguments["model"],
"--prompt", arguments["prompt"],
"--output", arguments.get("output", "output.png"),
"--width", str(arguments.get("width", 1024)),
"--height", str(arguments.get("height", 1024)),
"--image-steps", str(arguments.get("steps", 30)),
]
if arguments.get("seed", -1) >= 0:
args.extend(["--seed", str(arguments["seed"])])
output, code = run_videogen_command(args)
return [TextContent(type="text", text=output)]
elif name == "videogen_animate_image":
args = [
"--model", arguments["model"],
"--image", arguments["image"],
"--prompt", arguments["prompt"],
"--output", arguments.get("output", "output"),
"--length", str(arguments.get("length", 5.0)),
"--fps", str(arguments.get("fps", 15)),
]
output, code = run_videogen_command(args)
return [TextContent(type="text", text=output)]
elif name == "videogen_transform_image":
args = [
"--model", arguments["model"],
"--image-to-image",
"--image", arguments["image"],
"--prompt", arguments["prompt"],
"--output", arguments.get("output", "output.png"),
"--strength", str(arguments.get("strength", 0.75)),
]
output, code = run_videogen_command(args)
return [TextContent(type="text", text=output)]
elif name == "videogen_generate_with_audio":
args = []
if arguments.get("model"):
args.extend(["--model", arguments["model"]])
else:
args.append("--auto")
args.extend([
"--prompt", arguments["prompt"],
"--output", arguments.get("output", "output"),
"--generate_audio",
"--audio_type", arguments["audio_type"],
"--audio_text", arguments["audio_text"],
])
if arguments.get("tts_voice"):
args.extend(["--tts_voice", arguments["tts_voice"]])
if arguments.get("sync_audio", True):
args.append("--sync_audio")
if arguments.get("lip_sync"):
args.append("--lip_sync")
output, code = run_videogen_command(args)
return [TextContent(type="text", text=output)]
elif name == "videogen_list_models":
args = ["--model-list"]
filter_type = arguments.get("filter", "all")
if filter_type == "i2v":
args.append("--i2v-only")
elif filter_type == "t2v":
args.append("--t2v-only")
elif filter_type == "low_vram":
args.append("--low-vram")
elif filter_type == "high_vram":
args.append("--high-vram")
elif filter_type == "huge_vram":
args.append("--huge-vram")
elif filter_type == "nsfw":
args.append("--nsfw-friendly")
output, code = run_videogen_command(args)
return [TextContent(type="text", text=output)]
elif name == "videogen_show_model":
args = ["--show-model", arguments["model"]]
output, code = run_videogen_command(args)
return [TextContent(type="text", text=output)]
elif name == "videogen_update_models":
args = ["--update-models"]
output, code = run_videogen_command(args, timeout=600)
return [TextContent(type="text", text=output)]
elif name == "videogen_search_models":
args = [
"--search-models", arguments["query"],
"--search-limit", str(arguments.get("limit", 20))
]
output, code = run_videogen_command(args)
return [TextContent(type="text", text=output)]
elif name == "videogen_add_model":
args = ["--add-model", arguments["model_id"]]
if arguments.get("name"):
args.extend(["--name", arguments["name"]])
output, code = run_videogen_command(args)
return [TextContent(type="text", text=output)]
elif name == "videogen_list_tts_voices":
args = ["--tts-list"]
output, code = run_videogen_command(args)
return [TextContent(type="text", text=output)]
else:
return [TextContent(type="text", text=f"Unknown tool: {name}")]
async def main():
"""Main entry point"""
async with stdio_server() as (read_stream, write_stream):
await server.run(
read_stream,
write_stream,
server.create_initialization_options()
)
if __name__ == "__main__":
asyncio.run(main())
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment