TL; DR: We present Foley-Omni and V2ST-Bench to advance audio generation from isolated task-level synthesis to complete soundtrack generation from text and video.
foley_omni_demo_full.mp4
Foley-Omni focuses on Video-to-Soundtrack (V2ST) generation. Given a video and text conditioning, Foley-Omni jointly generates synchronized speech, sound effects, and music. Besides, the model also supports single-task inference such as task-level generation for speech synthesis, sound effect generation, and music composition.
V2ST-Bench for complete video soundtrack generation: Coming soon .
The public release was verified in the environment with:
- Python 3.10
- CUDA 12.4
- PyTorch 2.6.0
- FlashAttention 2.7.4.post1
git clone https://github.com/NJU-Speech/Foley-Omni.git
cd Foley-Omni
conda create -n foley-omni python=3.10 -y
conda activate foley-omni
# Install PyTorch first
pip install torch==2.6.0 torchvision==0.21.0 torchaudio==2.6.0 --index-url https://download.pytorch.org/whl/cu124
# Install other dependencies
pip install -r requirements.txt
# Install Flash Attention
pip install flash_attn==2.7.4.post1 --no-build-isolation
# Install the Hugging Face CLI
pip install "huggingface_hub[cli]>=0.30.0,<1.0"The released checkpoints are hosted at https://huggingface.co/CocoBro/Foley-Omni.
Download the full checkpoint package with:
bash scripts/download_release_ckpts.sh CocoBro/Foley-OmniExpected checkpoint layout:
ckpts/
├── Foley-Omni/
│ └── v2st.pth
├── Wan2.2-TI2V-5B/
│ ├── models_t5_umt5-xxl-enc-bf16.pth
│ └── google/
│ └── umt5-xxl/
│ ├── special_tokens_map.json
│ ├── spiece.model
│ ├── tokenizer.json
│ └── tokenizer_config.json
└── mmaudio/
└── ext_weights/
├── v1-16.pth
├── best_netG.pt
└── synchformer_state_dict.pth
The current public checkpoint is designed for videos up to 10 seconds. For best results, trim each input video to 10 seconds or shorter before inference.
Batch inference:
python inference_v2st.py --config-file inference_v2st.yamlGenerated files will be written to output_dir and include:
*.mp4: input video merged with the generated soundtrack
Single-video inference:
- Disable
json_filein inference_v2st.yaml - Set
video_path - Set
text_prompt - Run:
python inference_v2st.py --config-file inference_v2st.yamlThe batch example file is:
Each JSON key is a video path. Each JSON value is a metadata object for soundtrack generation.
Minimal example:
{
"./examples/videos/721ecf7c92d162bd2d74820f72f68d41.mp4": {
"resp": "[WORDS]That car came by faster than I expected.[END_WORDS][AUDIO_CAPTION]A clear, neutral English-speaking voice is accompanied by the sound of a car passing on a quiet urban street.[END_AUDIO_CAPTION]"
}
}Supported fields:
resp: required structured prompt stringclip_feature_path: optional pre-extracted CLIP feature pathsync_feature_path: optional pre-extracted Sync feature path
The resp field can contain any subset of the following blocks:
[WORDS] ... [END_WORDS]: speech content to be spoken in the generated soundtrack[AUDIO_CAPTION] ... [END_AUDIO_CAPTION]: sound effects, acoustic events, actions, speaker prompt[MUSIC] ... [END_MUSIC]: background music style, mood, instrumentation, and tempo
Notes:
- At least one of
WORDS,AUDIO_CAPTION, orMUSICshould be present in each sample. clip_feature_pathandsync_feature_pathare optional.- If feature paths are not provided, Foley-Omni extracts visual features from the input video.
To pre-extract CLIP and Sync features, use:
Example:
python data_process/convert_memmap_to_npy.py \
--json_input ./examples/video_text_example.json \
--feature_dir ./examples/features \
--json_output ./examples/video_text_with_features.json \
--gpu_ids 0This script reads the input videos, extracts clip_feature_path and sync_feature_path, and writes an updated JSON manifest that can be used directly by inference_v2st.py.
Representative text-only prompts are provided at:
The default text-only config is:
Run text-only generation with:
python inference.py --config-file inference_fusion.yaml- Release model weights
- Release inference code
- Release V2ST-Bench
- Release Huggingface online demo
We would like to thank the following projects:
