A karaoke video is a small synchronization problem: the music, the words, and the visuals all have to arrive together.
First, separate the song.
I start by splitting the original recording into two stems with Demucs. The accompaniment becomes the final audio; the isolated voice gives me a cleaner signal for transcription and timing.
Terminal · separate stemspython -m demucs \
--two-stems=vocals \
-n htdemucs \
"08 - Free Bird.mp3"This creates vocals.wav and no_vocals.wav in a model- and track-specific directory. Separation is an estimate, so some vocal or instrumental bleed can remain.
Hear the difference
Two stems from the same Free Bird recording.
Turn the voice into data.
I use a local tool I built, karaoke-ass, to turn the vocal stem into an editable transcription and an ASS subtitle file. Whisper estimates word timings; the tool then estimates syllable boundaries using language rules and the audio’s energy envelope.
Terminal · generate the draft./karaoke-ass \
"separated/htdemucs/08 - Free Bird/vocals.wav" \
--model medium --device cpu --threads 4 \
--output results/freebirdThe tool converts audio to mono at 16 kHz for recognition and processes overlapping windows. It preserves the original audio timeline, including the long instrumental opening.
transcripcion.json · excerpt{
"text": "If",
"start": 68.21,
"end": 69.61,
"language": "en",
"probability": 0.4053974747657776
}It also writes a readable transcript, a TSV of timing units, a review report, and execution metadata. The probability is a review signal, not proof that the word is correct.
Make the words move.
ASS combines styles, event timings, and karaoke tags. In the generated file, \kf progressively highlights text over a duration measured in hundredths of a second.
karaoke.ass · excerptDialogue: 0,0:01:08.21,0:01:14.06,Default,,0,0,0,,{\kf140}If{\kf82} I{\kf122} leave{\kf36} here{\k3}{\kf62} to{\kf70}mor{\kf70}rowHere, \kf140 highlights its unit over 1.40 seconds; the empty \k3 accounts for a short pause. The generated style uses white text and a yellow highlight.
Listen, then refine.
I review the draft against the song and use revision.txt to find low-confidence words and unusually long intervals. A structurally valid file can still contain an incorrect lyric or a poorly timed highlight.
After editing a copy of the JSON, I can regenerate the subtitles without running Whisper again:
Terminal · rebuild from editscp results/freebird/transcripcion.json letra-corregida.json
# Edit the words and timestamps, then:
./karaoke-ass \
"separated/htdemucs/08 - Free Bird/vocals.wav" \
--from-json letra-corregida.json \
--output results/freebird-corregidoThe JSON can contain a source-audio hash, so I use the same vocal file for regeneration. Font, size, and timing offset can also be adjusted.
Bring the pieces together.
Finally, I combine the instrumental with a looping background and burn in the ASS subtitles. This example command illustrates the assembly; it is not a record of the demo’s original render command.
Terminal · render videoffmpeg \
-stream_loop -1 -i background-loop.mp4 \
-i "separated/htdemucs/08 - Free Bird/no_vocals.mp3" \
-vf "ass=results/freebird/karaoke.ass" \
-map 0:v:0 -map 1:a:0 \
-c:v libx264 -pix_fmt yuv420p \
-c:a aac -b:a 192k -shortest \
freebird-karaoke.mp4The loop repeats the background, the ASS filter renders the text, and -shortest ends the output with the audio. FFmpeg needs libass support for the subtitle filter.
Ready to sing.
The finished Free Bird karaoke video, compressed for web playback. Use the player controls to watch and listen.
Download demo video ↗References & resources.
Documentation and source code for the tools and formats used in this workflow.
- Demucs — source separation model and command-line tool.
- karaoke-ass — the local vocal-to-karaoke subtitle tool.
- OpenAI Whisper — speech recognition and transcription.
- Aegisub ASS karaoke tags — reference for karaoke timing and highlighting.
- FFmpeg documentation — audio and video processing and rendering.
- libass — ASS subtitle rendering library used by FFmpeg.