forked from LiveCarta/ContentGeneration
5.2 KiB
5.2 KiB
ContentGeneration Pipeline
This project runs a 3-step video pipeline:
- Generate shot videos from images + prompts.
- Merge each generated video with its audio.
- Concatenate merged clips into one final output.
The pipeline entrypoint is run_video_pipeline.py.
Quick Start
Local Python:
cp .env.example .env
python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
python run_video_pipeline.py
Docker (GPU):
cp .env.example .env
docker build -t content-generation:latest .
docker run --rm --gpus all --env-file .env -v "$(pwd)":/app -w /app content-generation:latest
First run (skip S3 upload):
python run_video_pipeline.py --skip-s3-upload
Docker first run (skip S3 upload):
docker run --rm --gpus all --env-file .env -v "$(pwd)":/app -w /app content-generation:latest \
python run_video_pipeline.py --skip-s3-upload
Project Layout
run_video_pipeline.py: main entrypoint.src/: helper scripts used by the pipeline.HunyuanVideo-1.5/: Hunyuan inference code and model dependencies.reel_script.json: required script input withshots.images/,audios/,videos/,merged/,results/: working/output folders..env.example: environment variable template.
Prerequisites
- Linux with NVIDIA GPU and CUDA runtime.
ffmpegandffprobeavailable on PATH.- Python 3.10+.
- Hunyuan model checkpoints under
HunyuanVideo-1.5/ckpts. - If using FLUX local download, access approved for
black-forest-labs/FLUX.1-schnell.
Environment Variables
- Create local env file:
cp .env.example .env
- Fill required variables in
.env:
ELEVENLABS_API_KEYfor audio generation.HUGGINGFACE_HUB_TOKENif gated Hugging Face model access is needed.AWS_S3_BUCKET(+ optional AWS vars) if you want final output uploaded to S3.
Run Locally (Python)
- Create and activate a virtual environment:
python3 -m venv .venv
source .venv/bin/activate
- Install Python dependencies:
python -m pip install --upgrade pip
pip install -r requirements.txt
- Install Hunyuan dependencies:
pip install -r HunyuanVideo-1.5/requirements.txt
pip install --upgrade tencentcloud-sdk-python
pip install sgl-kernel==0.3.18
- Run full pipeline:
python run_video_pipeline.py
- Common options:
# Skip generation and only merge + concat
python run_video_pipeline.py --skip-generate
# Skip S3 upload
python run_video_pipeline.py --skip-s3-upload
# Override base directory
python run_video_pipeline.py --base-dir /absolute/path/to/workdir
# Change logging verbosity
python run_video_pipeline.py --log-level DEBUG
Run with Docker
- Build image:
docker build -t content-generation:latest .
- Optional build with extra attention backends:
docker build -t content-generation:latest --build-arg INSTALL_OPTIONAL_ATTENTION=1 .
- Run pipeline in container (GPU required):
docker run --rm --gpus all \
--env-file .env \
-v "$(pwd)":/app \
-w /app \
content-generation:latest
- Pass extra pipeline args:
docker run --rm --gpus all \
--env-file .env \
-v "$(pwd)":/app \
-w /app \
content-generation:latest \
python run_video_pipeline.py --skip-s3-upload --log-level DEBUG
Input Expectations
reel_script.jsonmust exist and contain ashotsarray.images/shot_<n>.pngandaudios/output_<n>.mp3should align by shot number.- Final output is written by default to
results/final_output.mp4.
S3 Upload Behavior
- If
AWS_S3_BUCKETis set, the pipeline uploads final output to S3 usingS3VideoStorage. - If
AWS_S3_BUCKETis missing, upload is skipped with a warning. - Disable upload explicitly with
--skip-s3-upload.
Troubleshooting
torch.cuda.is_available()is false in Docker.
- Run with GPU flags:
docker run --gpus all ... - Verify NVIDIA Container Toolkit is installed on host.
- Check host GPU visibility:
nvidia-smi.
ffmpegorffprobenot found.
- Local: install ffmpeg with your package manager.
- Docker: ffmpeg is installed in the provided Dockerfile.
- Hunyuan generate step fails due to missing checkpoints.
- Ensure checkpoints are available under
HunyuanVideo-1.5/ckpts. - Confirm mounted project path in Docker includes checkpoints.
- Hugging Face model download fails (401/403).
- Accept model access terms for gated models (for example FLUX.1-schnell).
- Set
HUGGINGFACE_HUB_TOKENin.env.
- S3 upload fails.
- Confirm
AWS_S3_BUCKETis set. - If needed, set
AWS_REGIONand credentials (AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY, optionalAWS_SESSION_TOKEN). - For S3-compatible providers, set
AWS_S3_ENDPOINT_URL.
- Permission issues when running Docker with mounted volumes.
- Use your host user mapping if needed:
docker run --rm --gpus all -u "$(id -u):$(id -g)" ...
- Out-of-memory during video generation.
- Keep
PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True,max_split_size_mb:128. - Reduce workload by skipping optional enhancements or lowering resolution/steps in generation scripts.
- Verify syntax quickly before running.
python3 -m py_compile run_video_pipeline.py src/*.py