Use ffmpeg for video post-processing and multi-clip composition.
Positioning
Important: video continuity is now ensured by the /generate-video --continuous mode. This skill is mainly used to:
- Add background music - Add BGM to a continuous video
- Multi-episode composition - Merge videos from multiple episodes
- Add intro/outro - Insert intro/outro
- Fallback - When continuous generation fails, splice independent scene videos
Use cases
1. Add background music
python .claude/skills/compose-video/scripts/compose_video.py \
my_project script.json \
--input output/episode_01.mp4 \
--music background_music.mp3 \
--music-volume 0.3
2. Merge multi-episode videos
python .claude/skills/compose-video/scripts/compose_video.py \
my_project script.json \
--merge-episodes 1 2 3 \
--output final_movie.mp4
3. Add intro/outro
python .claude/skills/compose-video/scripts/compose_video.py \
my_project script.json \
--intro intro.mp4 \
--outro outro.mp4 \
--output final_with_intro.mp4
4. Fallback splicing (not recommended)
When continuous generation is unavailable, splice independent scene videos:
python .claude/skills/compose-video/scripts/compose_video.py \
my_project script.json \
--fallback-mode \
--output chapter_01_final.mp4
Workflow
-
Load project and script
- If no project name is specified, ask the user
- From
projects/{项目名}/scripts/load the script - Check
output/for continuous videos in the directory
-
Select processing mode
- Add BGM
- Merge multiple episodes
- Add intro/outro
- Fallback splicing
-
Perform processing
- Use ffmpeg for the corresponding processing
- Keep the original video unchanged
- Output to
projects/{项目名}/output/
Transition types (fallback mode)
According to the transition_to_next field in the script:
| Type | ffmpeg filter |
|---|---|
| cut | Direct splicing |
| fade | xfade=transition=fade:duration=0.5 |
| dissolve | xfade=transition=dissolve:duration=0.5 |
| wipe | xfade=transition=wipeleft:duration=0.5 |
Environment requirements
- ffmpeg is installed and in PATH
- Continuous videos or scene videos have been generated
- Video resolutions are consistent (9:16 portrait)
Output options
- Add BGM - Mix original audio and background music
- Merge videos - Splice multiple videos into one
- Add intro/outro - Insert material at the beginning and end of the video
Pre-processing checks
- Continuous videos or scene videos exist and are playable
- Video resolutions are consistent (9:16 portrait)
- Background music file exists (if needed)
- Intro/outro files exist (if needed)
Recommended workflow
- Use
/generate-video --continuous --episode Nto generate a coherent video - Use
/compose-videoto add BGM (optional) - Use
/compose-videoto add intro/outro (optional)