Automation tool for creating professional overlay videos with animated content, perfect for FPP (Falcon Pi Player) displays, digital signage, or music videos.
- Automated Video Generation: Pairs MP4 background videos with MP3 audio tracks
- Text Overlays: Customizable text with fonts, colors, borders, and shadows
- Image Overlays: Support for PNG/JPG overlays with transparency and scaling
- Dynamic Content: MP3 metadata placeholders (
{title},{artist}) for song information - Random Background Selection: Automatically selects from available background videos
- Animation Groups: Create time-based content that cycles on/off during the video
- Define groups of overlays that appear/disappear together
- Set custom durations for each animation group
- Perfect for alternating between FM frequency info, QR codes, and other content
- Smooth Transitions: Fade in/out transitions between animation groups
- Smart Duration Handling: Automatically loops or truncates base videos to fit complete animation cycles
- Enhanced Background Caching: MD5-based intelligent caching only regenerates when content changes
- Software Encoding: H.264 with configurable CRF (18-35) and presets (ultrafast to veryslow)
- Hardware Encoding: VideoToolbox support for Mac (3-5x faster encoding)
- Quality Control: Fine-tune compression vs. quality balance
- Batch Processing: Process all songs or specific files
- Custom Config:
--config/-cto specify configuration file - Selective Processing:
--audio/-ato process specific audio files - Force Regeneration:
--force-regenerate/-fto bypass cache - Verbose Mode:
--verbose/-vfor detailed processing information - Compression Control:
--compressto enable compression via CLI
- Python 3.x
- FFmpeg (with hardware encoding support for VideoToolbox on Mac)
- Python packages:
ffmpeg-pythontinytag
# Install Python dependencies
pip install ffmpeg-python tinytag
# Or using uv (modern package manager)
uv pip install ffmpeg-python tinytagEdit video_creator.cfg to configure paths and overlay settings:
[Paths]
mp3_directory = /path/to/audio/files
mp4_directory = /path/to/background/videos
[Output]
output_directory = /path/to/output
scale = 1280:720
output_exists = skip # or 'overwrite'Add text overlays with full FFmpeg drawtext parameter support:
[Line1]
fontfile=/path/to/font.ttf
text=Tune to
fontsize=180
fontcolor=white
bordercolor=black
borderw=5
shadowcolor=black
shadowx=10
shadowy=10
x=(w-text_w)/2
y=(h-text_h)/2Dynamic Content: Use {title} and {artist} placeholders to pull from MP3 metadata.
Add logos, QR codes, or other images:
[Line_Logo]
image=/path/to/logo.png
scale=250:-1 # width:height, -1 for auto
x=10
y=10Create time-based animations that cycle content:
[Animation]
transition = fade
transition_duration = 0.5
# Animation Group 1: FM Frequency (shows for 5 seconds)
[Line_TuneTo]
text=Tune to
fontsize=180
animation_group=fm_display
animation_duration=5
[Line_Frequency]
text=100.1 FM
fontsize=225
animation_group=fm_display
animation_duration=5
# Animation Group 2: QR Code (shows for 5 seconds)
[Line_QR]
image=/path/to/qr-code.png
scale=-1:450
x=(main_w-overlay_w)/2
y=(main_h-overlay_h)/2
animation_group=qr_display
animation_duration=5
# Static overlays (no animation_group = always visible)
[Line_Title]
text={title}
fontsize=60How it works: The video will cycle between animation groups:
- 0-5s: Show FM frequency
- 5-10s: Show QR code
- 10-15s: Show FM frequency again
- (repeats for entire video duration)
Static overlays without animation_group remain visible throughout.
Configure post-processing compression:
[Compression]
enabled = true
use_hardware = false # Set to true for VideoToolbox (Mac)
# Software encoding options (use_hardware = false)
crf = 30 # 18-35, higher = more compression
preset = slow # ultrafast, fast, medium, slow, slower, veryslow
# Hardware encoding options (use_hardware = true)
quality = 65 # 0-100, higher = better quality
audio_bitrate = 128k
output_directory = /path/to/compressed/outputNote: Hardware encoding is faster but less efficient (larger files for same quality).
# Process all audio files
python3 video_creator.py
# Use custom config
python3 video_creator.py --config my_config.cfg
# Process specific songs
python3 video_creator.py --audio "song1.mp3" "song2.mp3"
# Enable compression
python3 video_creator.py --compress
# Verbose output
python3 video_creator.py --verbose
# Force regeneration (bypass cache)
python3 video_creator.py --force-regenerate# Process one song with custom config, compression, and verbose output
python3 video_creator.py -c custom.cfg -a "song.mp3" --compress -v
# Regenerate all videos with new settings
python3 video_creator.py --force-regenerate --compress-
Enhanced Background Creation:
- Loads base background video
- Applies smart duration handling (loops/truncates to fit animation cycles)
- Renders all text and image overlays with animation timing
- Caches result with MD5 hash (only regenerates when config/source changes)
-
Audio Muxing:
- Loops enhanced background infinitely
- Adds MP3 audio track
- Cuts to audio length using stream copy (fast, no re-encoding)
-
Optional Compression:
- Re-encodes video with H.264 (software or hardware)
- Adjustable quality/size tradeoff
- Reports compression ratio
The tool automatically handles mismatches between background video length and animation cycles:
- Base video < cycle: Loops video to fit at least one complete cycle
- Base video > cycle: Truncates to fit complete cycles (avoids partial animations)
- Perfect match: Uses as-is
Example: 45-second base video with 10-second animation cycle → truncates to 40 seconds (4 complete cycles)
Enhanced backgrounds are cached as {base_video}__enh_{content_hash}.mp4:
- Hash includes MP3 metadata and config settings
- Only regenerates when content or settings change
- Typical speedup: 2s vs 5-10s per video
w- video widthh- video heighttext_w- text widthtext_h- text height(w-text_w)/2- center horizontallyh-text_h-20- 20px from bottom
main_w- video widthmain_h- video heightoverlay_w- image widthoverlay_h- image height(main_w-overlay_w)/2- center horizontally(main_h-overlay_h)/2- center vertically
Typical processing time (3-minute song on Apple Silicon):
- Enhanced background rendering: ~5-10 seconds (cached after first run)
- Audio muxing: ~2 seconds (stream copy, no re-encoding)
- Compression (optional): ~10-30 seconds (varies by preset/hardware)
Hardware acceleration (Mac with VideoToolbox):
- 3-5x faster compression
- Slightly larger files for same quality
- Use
use_hardware = truein config
- Add margins to x/y positioning:
x=(w-text_w)/2-10 - Reduce shadow offset:
shadowx=5, shadowy=5
- Verify
animation_groupandanimation_durationare set - Check that duration values allow content to fit in base video
- Use
--verboseto see animation schedule
- Lower
crfvalue (30-33 for more compression) - Use slower preset (
sloworslower) - Disable hardware encoding (
use_hardware = false)
- Use
--force-regenerateto bypass cache - Check that config file was actually saved
Contributions are welcome! Please feel free to submit pull requests or open issues for bugs and feature requests.
GPL-3.0 License - See LICENSE file for details.
- Christmas Light Displays: FM frequency info + QR codes for FPP/xLights shows
- Digital Signage: Rotating announcements with background videos
- Music Videos: Automated lyric videos with MP3 metadata
- Event Displays: Conference/wedding videos with custom overlays