If you publish long-form video content, you know the pain: you need to replace or update the soundtrack without touching the video quality. AudioSwitcher is a lightweight Python tool that does exactly that—using ffmpeg to replace the audio track of a single long video while copying the video stream as-is. The result: fast processing and zero video re-encoding.
Why AudioSwitcher?
- Keep video quality intact by copying the video stream.
- Automatically trim or loop audio to match the video length.
- Simple folder-based workflow or explicit file paths.
- Batch-friendly behavior with clear reporting.
What it does
AudioSwitcher replaces the audio track in your video with an MP3 from the audio/ folder. If that folder is empty, it automatically combines MP3s from audio-input/ into a single track and uses that instead. It even writes a tracklist file next to the combined MP3 with start times for each song—perfect for long mixes.
Core features from the README
- Replace audio on a video without re-encoding the video stream.
- List MP3 durations in
audio/oraudio-input/. - Combine multiple MP3s into one, with optional shuffle.
- Smart ordering: files with two-digit prefixes (e.g., “00 Intro.mp3”) stay in order; others are shuffled.
- Auto-select newest audio file or pick latest/oldest/name.
- Loop or trim audio to match the video length.
- Auto-select audio codec based on container (
.webm->opus,.mp4/.mov/.m4v/.mkv->aac,.avi->mp3).
Examples (from the README)
# Combine automatically (when audio/ is empty) and replace audio
./switch_audio.py
# Show MP3 durations in audio/
./switch_audio.py --list-audio-lengths
# Only combine MP3s in audio-input/ into audio/
./switch_audio.py --combine-only
# Combine with shuffle, but keep two-digit prefixes first (00, 01, ...)
./switch_audio.py --combine --shuffle-audio-input
Quick start workflow
1) Drop your video into video/ (or pass --video-input /path/to/video.mp4).
2) Drop a single MP3 into audio/ OR multiple MP3s into audio-input/.
3) Run ./switch_audio.py and let it handle the rest.
Get it on GitHub
AudioSwitcher is open-source and ready to use today. Grab it here:
https://github.com/LinuxLinusDE/AudioSwitcher