5

I try to add .srt subtitles to the mkv file and it doesn't work. I use the following very simple command:

$ ffmpeg -y -i original.mkv -i sub_original.srt -map 0 -map 1 -c copy ~/temp.mkv
ffmpeg version n4.2 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 9.1.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-nvdec --enable-nvenc --enable-omx --enable-shared --enable-version3
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, matroska,webm, from 'original.mkv':
  Metadata:
    encoder         : libebml v1.3.0 + libmatroska v1.4.1
    creation_time   : 2019-09-14T13:50:43.000000Z
  Duration: 00:58:52.45, start: 0.000000, bitrate: 8212 kb/s
    Stream #0:0(eng): Video: h264 (High), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Stream #0:1(rus): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
    Metadata:
      title           : Dub
    Stream #0:2(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 640 kb/s
    Stream #0:3(rus): Subtitle: subrip (default) (forced)
    Metadata:
      title           : Forced
    Stream #0:4(rus): Subtitle: subrip
    Stream #0:5(eng): Subtitle: subrip
    Stream #0:6(ger): Subtitle: subrip
    Stream #0:7(fre): Subtitle: subrip
    Stream #0:8(ita): Subtitle: subrip
    Stream #0:9(spa): Subtitle: subrip
    Stream #0:10(dut): Subtitle: subrip
    Stream #0:11(por): Subtitle: subrip
    Stream #0:12(tur): Subtitle: subrip
    Stream #0:13(gre): Subtitle: subrip
    Stream #0:14: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 854x1280 [SAR 72:72 DAR 427:640], 90k tbr, 90k tbn, 90k tbc (attached pic)
    Metadata:
      filename        : Cover_Unbelievable.jpg
      mimetype        : image/jpeg
Input #1, srt, from 'sub_original.srt':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Subtitle: subrip
Output #0, matroska, to 'temp.mkv':
  Metadata:
    encoder         : Lavf58.29.100
    Stream #0:0(eng): Video: h264 (High) (H264 / 0x34363248), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 23.98 fps, 23.98 tbr, 1k tbn, 1k tbc (default)
    Stream #0:1(rus): Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
    Metadata:
      title           : Dub
    Stream #0:2(eng): Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1(side), fltp, 640 kb/s
    Stream #0:3(rus): Subtitle: subrip (default) (forced)
    Metadata:
      title           : Forced
    Stream #0:4(rus): Subtitle: subrip
    Stream #0:5(eng): Subtitle: subrip
    Stream #0:6(ger): Subtitle: subrip
    Stream #0:7(fre): Subtitle: subrip
    Stream #0:8(ita): Subtitle: subrip
    Stream #0:9(spa): Subtitle: subrip
    Stream #0:10(dut): Subtitle: subrip
    Stream #0:11(por): Subtitle: subrip
    Stream #0:12(tur): Subtitle: subrip
    Stream #0:13(gre): Subtitle: subrip
    Stream #0:14: Video: mjpeg (Baseline) (MJPG / 0x47504A4D), yuvj420p(pc, bt470bg/unknown/unknown), 854x1280 [SAR 72:72 DAR 427:640], q=2-31, 90k tbr, 1k tbn, 90k tbc (attached pic)
    Metadata:
      filename        : Cover_Unbelievable.jpg
      mimetype        : image/jpeg
    Stream #0:15: Subtitle: subrip
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)
  Stream #0:3 -> #0:3 (copy)
  Stream #0:4 -> #0:4 (copy)
  Stream #0:5 -> #0:5 (copy)
  Stream #0:6 -> #0:6 (copy)
  Stream #0:7 -> #0:7 (copy)
  Stream #0:8 -> #0:8 (copy)
  Stream #0:9 -> #0:9 (copy)
  Stream #0:10 -> #0:10 (copy)
  Stream #0:11 -> #0:11 (copy)
  Stream #0:12 -> #0:12 (copy)
  Stream #0:13 -> #0:13 (copy)
  Stream #0:14 -> #0:14 (copy)
  Stream #1:0 -> #0:15 (copy)
Press [q] to stop, [?] for help
[matroska @ 0x564c2717f840] Starting new cluster due to timestamp
[matroska @ 0x564c2717f840] Starting new cluster due to timestamp37 bitrate=8282.2kbits/s speed= 387x    
frame=84685 fps=9337 q=-1.0 Lq=-1.0 size= 3542743kB time=00:58:52.41 bitrate=8215.9kbits/s speed= 389x    
video:3070859kB audio:469153kB subtitle:265kB other streams:0kB global headers:0kB muxing overhead: 0.069655%

At first glance it seems to work - if I open new file with VLC I can see new subtitle stream, but the subtitles themselves are not visible!

I get the followng warnings/errors in the console:

[matroska @ 0x557924efe840] Starting new cluster due to timestamp

[matroska @ 0x557924efe840] Starting new cluster due to timestamp

So I suppose it's the root of the problem, but I don't know what to do with it. Some other videos work fine with the same command, some don't.

8
  • pastiebin.com/5dae2a8e2a1cb Commented Oct 21, 2019 at 22:00
  • But I'm 100% sure that everything is fine with this file. Because in order to figure my problem out I used subtitle file from the original file. If I map it directly even multiple times everything works fine without any errors but once I try to map the file using input file it doesn't work. Commented Oct 21, 2019 at 22:02
  • ffmpeg -y -i /path_to_original.mkv -map 0:v -map 0:a -map 0:s -map 0:s:0 -c copy ~/path_to_result.mkv this command works perfectly - here I map the first subtitle stream twice and it works, but once I try to map it using the external file it stops working. Commented Oct 21, 2019 at 22:05
  • Show full log from command.
    – llogan
    Commented Oct 21, 2019 at 22:06
  • 3
    Possibly #6037 mkv muxing broken and #7064 External subtitle files cause wrong interleaving. Workaround may be to try -max_interleave_delta 0.
    – llogan
    Commented Oct 21, 2019 at 22:13

1 Answer 1

8

Possibly #6037 mkv muxing broken and #7064 External subtitle files cause wrong interleaving. Workaround may be to try -max_interleave_delta. Experiment to see which values work for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.