A music video that feels cut to the song needs cuts that land on the beat, lip-sync shots only where someone is actually singing, and the right singer on screen. mvdirector gets all of that from signal processing. The language model is never asked when to cut.
What mvd analyze measures
Analysis needs no network. The signal-processing helpers are pure functions over numpy arrays, so they are tested without audio files.
- 1
Load
The mix and the vocal stem are loaded as mono at 22,050 Hz with librosa.
- 2
Beats and bars
Beats come from
librosa.beat.beat_track, run on the drum stem if one is configured and on the mix otherwise. Bars are everybeats_per_barbeats (default 4). Bar intensity is the mean mix RMS per bar, scaled so the loudest bar is 1.0. - 3
Vocal windows
Spans where the vocal-stem RMS is above −30 dB relative to its peak. Gaps shorter than 0.6 s (breaths) are bridged and spans shorter than 0.3 s (stem bleed) are dropped.
- 4
Lyric timing
Word timestamps come from a supplied JSON file, else from faster-whisper if installed. Lyric tokens are matched to transcribed tokens with
difflib.SequenceMatcher, so transcription mistakes never change the lyric text. - 5
Estimate the rest
Runs of untimed lines share the gap between their timed neighbors in proportion to text length. Alignment diagnostics are reported before any GPU money is spent.
Who is singing, not just whether someone is
- Multi-singer vocal stems are diarized into solo voice clusters (
voice_1,voice_2) and simultaneous harmony or unison turns (both), stored inAnalysis.vocal_turns. - When lyric tags name the singers (
[Verse 1: Singer A],[Chorus: Both]) or diarization hears several voices, cuts land on vocal transitions rather than across active singing. Shot.singersrecords who is actively singing. Simultaneous duet shots are widened to two-shots, silent listeners in solo shots are told to keep their mouths closed, and the quality checks require the right number of faces to be present and synced.- Foreign vocals are muted in each singer's audio slice, so singers never lip-sync each other's lines.
Track profiling and auto-tune
With auto_tune: true (the default), mvd prepare, mvd analyze and mvd plan build a TrackProfile stored in analysis.json: language or code-switching, vocal mode (solo, duet, group, instrumental), rap and fast-flow density, drops and vocal chops, extreme vocals, and non-4/4 meter cues. That profile adjusts the Whisper settings, the video.* pacing parameters and planning.max_lipsync_share. mvd tune previews the changes and mvd tune --apply writes them to project.yaml.
Cutting the song into shots
The segmenter turns the beat grid into a gap-free list of shots. The demo below is a port of the real rules: the allowed bar steps come from the clip-length limits, fixed pacing cuts every N bars, and dynamic pacing scales shot length with bar intensity and snaps early to a new section or an intensity surge.
- Shots
- 20
- Average shot
- 3.2 s
- Allowed bar steps
- 4 · 2 · 1
- Intensity pacing
- Applied
Ported from planning/segmenter.py: allowed bar steps from the clip-length limits, intensity tiers at 0.55 and 0.80, early snap to a section start or an intensity surge, and the 0.15 contrast requirement. It leaves out vocal windows, singer handoffs and phrase slicing.
- Allowed steps are the subset of 8, 4, 2 or 1 bars whose duration fits within
video.min_clip_secondsandvideo.max_clip_seconds(defaults 1.5 s and 8.0 s). - Dynamic pacing needs contrast: if the intensity range across the song is under 0.15, cutting stays uniform. Calm bars (below 0.55) hold for the longest step, medium bars (0.55 to 0.80) take half of it, and peak bars (0.80 and up) take a quarter.
- A shot is
lipsyncwhen at leastvideo.lipsync_min_vocal_fraction(default 0.25) of it overlaps a vocal window; otherwise it isperformanceorbroll. - Each shot gets its audio slice, which is the shot plus
video.handle_secondson each side, and a frame count: the smallest8n + 1that covers the slice, which is the frame rule LTX video models expect.
What the model is not allowed to decide
- A
lipsyncshot stayslipsync; only shots with no sung vocal can become b-roll. - A lip-sync shot is never framed wider than
medium_closeby default (planning.lipsync_widest_framing). - How much of the song is the singer singing to camera is capped by
planning.max_lipsync_share(default 0.45, a hybrid mix). Sung shots over the cap become cutaways, the quietest non-chorus shots first. Chorus and hook shots and the last sung shot always stay, and the singer is never off screen for more than two shots in a row. - Shots the model leaves out, or a batch that fails direction, get rule-based direction, so the manifest is always complete.
Frequently asked questions
- Does the LLM choose when video cuts happen?
- No. Signal processing computes the beat grid, bar intensity, and vocal windows first. The language model directs visual framing and storytelling inside those locked time spans.
- How does mvdirector avoid turning an entire music video into nonstop lip-sync?
- By default, planning.max_lipsync_share caps sung on-camera shots at 45%, converting quieter non-chorus vocal shots into narrative cutaways while preserving chorus hooks.
- What if the automatic beat grid is a beat off from the real downbeat?
- You can adjust the bar timestamps directly in analysis.json and re-run planning, or test bar-to-frame cut lengths ahead of time in SongFilm's free BPM and Beat Analyzer tools.