#11602 closed defect (invalid)

Muxing MKV and adding external SRT as anything except the only subtitle stream in an MKV prevents subtitle display in VLC

Reported by: Kurt Fitzner Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: mkv srt muxer remux
Cc: Kurt Fitzner Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
When re-muxing an MKV video that already has subtitle streams in it to add an additional external subrip .srt file, if the external .srt is included as anything except the only subtitle stream in the output then the added external subtitle will not display in VLC or on a Roku media player.

You can select any number of existing subtitle stream from the input MKV video and they will properly copy to the output and display when the video is played.

The following produces videos where the added external subtitle DOES NOT display, but where the subtitle stream included from the input .mkv DOES display:

% ffmpeg -report -i invid.mkv -i 1b.srt -map 0:v? -c:v copy -map 0:a? -c:a copy -map 0:s:0 -c:s:0 copy -map 1:s:0 -c:s:1 copy outvid1.mkv
% ffmpeg -report -i invid.mkv -i 1b.srt -map 0:v? -c:v copy -map 0:a? -c:a copy -map 1:s:0 -c:s:0 copy -map 0:s:0 -c:s:1 copy outvid2.mkv

The following produces a video where the added external subtitle (the same one as the above) DOES display properly:

% ffmpeg -i invid.mkv -i 1b.srt -map 0:v? -c:v copy -map 0:a? -c:a copy -map 1:s:0 -c:s:0 copy outvid3.mkv

This was attempted on ffmpeg Windows 64 builds:
ffmpeg version 2025-05-07-git-1b643e3f65-full_build-www.gyan.dev
ffmpeg version 2025-05-19-git-c55d65ac0a-full_build-www.gyan.dev

Change History (2)

comment:1 by Kurt Fitzner, 16 months ago

Log file for a run which creates an undisplayable subtitle is available at:
https://va1der.ca/~public/ffmpeg-20250521-190837.log.xz

comment:2 by mkver, 16 months ago

Resolution: invalid
Status: newclosed

Here is the relevant information about the output streams from your log:

  Stream #0:3, 0, 1/1000: Subtitle: subrip
  Stream #0:4(eng), 0, 1/1000: Subtitle: subrip (default) (forced)
    Metadata:
      title           : English (translations only)
      DURATION        : 00:11:33.297000000

It means that the second subtitle stream (the one that has been copied from the input Matroska file) is marked as default and forced, whereas the first one (from the external srt) is not. Therefore players will prefer the second subtitle track because it is the default. But players typically still allow to switch to a non-default track (VLC does in my test).

Anyway, you can (re)set the disposition of output streams via the -disposition option. You can also use the header editor from MKVToolNix to modify the flags of an already existing Matroska file.

Note: See TracTickets for help on using tickets.