feat: export as MP4 (karaoke video) for MP4 uploads and YouTube - #226
Merged
Conversation
Add an MP4 export that muxes the current mixer state (e.g. vocals muted)
with the source video, producing a karaoke-style video.
Backend:
- Preserve a silent video.mp4 from .mp4 uploads (stream-copy, no re-encode).
- YouTube jobs do a best-effort video-only download (H.264/avc1, <=720p)
to video.mp4, decoupled from the audio source so failures degrade to
audio-only. New STEMDECK_VIDEO_MAX_HEIGHT config.
- GET /api/jobs/{id}/video.mp4 streams a fragmented MP4: the amix audio
graph encoded as AAC, video stream-copied.
- has_video flag on Job, surfaced in state and persisted to metadata.
Frontend:
- MP4 added as a fourth export format (WAV/MP3/FLAC/MP4), shown only for
jobs with a preserved video track. In MP4 mode, Export Mix produces the
karaoke video and the audio-only Stems/Region rows are hidden.
SoundCloud and plain audio uploads are audio-only (no MP4 option).
added 2 commits
June 25, 2026 22:38
Linux no longer requires `sudo apt install ffmpeg`. The desktop shell now downloads a static FFmpeg build into the user data dir on first launch (like Windows/macOS), falling back to a system ffmpeg on PATH when present. This also fixes Demucs failing to decode compressed sources, since the download lands in data_dir/ffmpeg which config.json already adds to PATH. - ensure_ffmpeg: prefer a system ffmpeg, else download_linux_ffmpeg. - download_linux_ffmpeg: fetch the .tar.xz, extract with system tar, copy ffmpeg + ffprobe into data_dir/ffmpeg. STEMDECK_FFMPEG_URL overrides. - Widen download_file and make_executable from macos to unix so Linux reuses them. - Not bundled in the tarball, so we don't redistribute FFmpeg. - Update Linux README/notices/packaging comment to drop the ffmpeg apt step.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #219.
What
Adds an MP4 export that muxes the current mixer state (e.g. vocals muted) with the source video, producing a karaoke-style video the user can sing along to.
.mp4Backend
.mp4uploads — extract a silentvideo.mp4(stream-copy, no re-encode) before the source is transcoded for Demucs.bestvideo[vcodec^=avc1], ≤STEMDECK_VIDEO_MAX_HEIGHT/720p) tovideo.mp4. The audio source download is untouched; any video failure degrades gracefully to audio-only. H.264 is preferred so the export plays everywhere (avoids AV1, which Safari/iOS can't decode).GET /api/jobs/{id}/video.mp4?stems=&gains=— streams a fragmented MP4: the sameamixaudio graph as the existing mixdown (encoded AAC) with the video stream-copied. 404 when the job has no video.has_videoflag onJob, surfaced in state and persisted tometadata.json.Frontend
Tests
_extract_video_trackpreserves video from an.mp4and skips audio-only.mp4.Notes
Also in this PR — Linux FFmpeg
Linux no longer needs
sudo apt install ffmpeg. The desktop shell downloads a static FFmpeg on first launch (like Windows/macOS), falling back to a systemffmpegon PATH when present. Not bundled in the tarball, so we do not redistribute FFmpeg. Also fixes Demucs failing on compressed sources in source/dev runs.download_file/make_executablefrom macos to unix for reuse.