commit a8b978852782b4b63d4ab9627609ef16203f9dcc equwal <truex@equwal.com> 2026-09-20 15:32:21 -0700 Fix mkv mux: map streams explicitly, not -map 0 An MP4 stores chapters as a bin_data track, and Matroska accepts only audio, video and subtitle streams - so -map 0 made ffmpeg refuse the whole file with "Only audio, video, and subtitles are supported for Matroska". Map v/a/s explicitly; chapters still carry over through -map_chapters, being container metadata rather than a stream.
backend/render.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/backend/render.py b/backend/render.py index a891816..e6d44da 100644 --- a/backend/render.py +++ b/backend/render.py @@ -251,7 +251,12 @@ def mux_subtitles(video: Path, subtitles: Path, dest: Path) -> Path: "-i", str(video), # Declare the format; ffmpeg does not always sniff an srt correctly. "-f", "srt", "-i", str(subtitles), - "-map", "0", "-map", "1", + # Map video and audio explicitly rather than "-map 0": an MP4 carries + # its chapters as a bin_data track, and Matroska accepts only audio, + # video and subtitle streams - it refuses the file outright otherwise. + # Chapters still survive via -map_chapters, being container metadata. + "-map", "0:v", "-map", "0:a", "-map", "1:s", + "-map_chapters", "0", "-c", "copy", "-c:s", "srt", # Players pick this up automatically instead of needing it turned on. "-disposition:s:0", "default",