[FFmpeg-trac] #7064(avformat:new): External subtitle files cause wrong interleaving

FFmpeg trac at avcodec.org
Tue Mar 6 20:43:10 EET 2018


#7064: External subtitle files cause wrong interleaving
----------------------------------+--------------------------------------
             Reporter:  mkver     |                     Type:  defect
               Status:  new       |                 Priority:  normal
            Component:  avformat  |                  Version:  git-master
             Keywords:            |               Blocked By:
             Blocking:            |  Reproduced by developer:  0
Analyzed by developer:  0         |
----------------------------------+--------------------------------------
 I tried to remux a transport stream with two external subtitle files to
 Matroska and the result showed strange behaviour with regards to some
 subtitle packets: They worked when accessing the movie linearly and when
 seeking to a time when the subtitles should be shown (as they should
 because ffmpeg writes CueDuration and CueRelativePosition data), but not
 when seeking to a position a few seconds before the subtitles should be
 shown. And then I looked at the file using mkvinfo (from MKVToolNix). The
 problem is that some of the subtitle packets are wrongly interleaved with
 the rest of the data and are therefore inaccessible after a seek (and the
 interleaving of audio and video is also suboptimal):
 {{{
 Track 1: video, codec ID: V_MPEG4/ISO/AVC (h.264 profile: High @L4.0),
 mkvmerge/mkvextract track ID: 0, language: und, default duration: 20.000ms
 (50.000 frames/fields per second for a video track), pixel width: 1280,
 pixel height: 720
 Track 2: audio, codec ID: A_AC3, mkvmerge/mkvextract track ID: 1,
 language: deu, channels: 2, sampling freq: 48000, bits per sample: 32
 Track 3: subtitles, codec ID: S_TEXT/UTF8, mkvmerge/mkvextract track ID:
 2, language: und
 Track 4: subtitles, codec ID: S_TEXT/UTF8, mkvmerge/mkvextract track ID:
 3, language: und
 ...
 I frame, track 1, timestamp 00:00:01.329000000, size 4345, adler
 0x5a843c3f
 P frame, track 1, timestamp 00:00:01.249000000, size 41, adler 0xd73608b0
 P frame, track 1, timestamp 00:00:01.189000000, size 42, adler 0xb13407fe
 P frame, track 1, timestamp 00:00:01.209000000, size 43, adler 0xe2dd0a40
 I frame, track 3, timestamp 00:00:22.800000000, duration
 00:00:01.959000000, size 9, adler 0x0cea029e
 I frame, track 2, timestamp 00:00:00.048000000, size 1792, adler
 0x094f90bf
 I frame, track 2, timestamp 00:00:00.080000000, size 1792, adler
 0x08a27524
 P frame, track 1, timestamp 00:00:01.229000000, size 44, adler 0x9f3606e8
 P frame, track 1, timestamp 00:00:01.269000000, size 37, adler 0x61e504c6
 ...
 P frame, track 1, timestamp 00:02:18.869000000, size 32032, adler
 0x88681474
 I frame, track 2, timestamp 00:02:17.584000000, size 1792, adler
 0x9c2d71fc
 I frame, track 2, timestamp 00:02:17.616000000, size 1792, adler
 0x6fbe797b
 I frame, track 3, timestamp 00:02:56.320000000, duration
 00:00:01.959000000, size 20, adler 0x401f062e
 I frame, track 2, timestamp 00:02:17.648000000, size 1792, adler
 0x3ef76f7d
 I frame, track 2, timestamp 00:02:17.680000000, size 1792, adler
 0xe7f958f8
 P frame, track 1, timestamp 00:02:18.889000000, size 32945, adler
 0x347166b5
 }}}

 It turned out that it is not my input transport stream that is to blame,
 but the subtitles (probably sparse tracks in general). It can also be
 reproduced with nullsrc and other formats than Matroska (the full report
 which I have attached is 65MB and therefore the following is only a
 portion):

 {{{
 % ffmpeg.exe -debug_ts -report -v 9 -loglevel 99 -f lavfi -i nullsrc -i
 sub.1.srt -i sub.2.srt -map 0:0 -map 1:0 -map 2:0 -c copy -f framehash
 -hash crc32 -t 1:39:00 log.txt
 ffmpeg version N-90232-g0645698ecc Copyright (c) 2000-2018 the FFmpeg
 developers
   built with gcc 7.3.0 (Rev1, Built by MSYS2 project)
   configuration: --disable-static --enable-shared --disable-amf --enable-
 avisynth --disable-cuda --disable-cuvid --disable-d3d11va --disable-nvenc
 --enable-gpl --enable-openssl --disable-encoder=dca --disable-
 encoder=nellymoser --disable-encoder=real_144 --disable-encoder=truehd
 --disable-encoder=vorbis --disable-encoder=sonic --disable-encoder=sonicls
 --disable-encoder=amv --disable-encoder=asv1 --disable-encoder=asv2
 --disable-encoder=flashsv --disable-encoder=flashsv2 --disable-
 encoder=roqvideo --disable-encoder=svq1 --disable-encoder=zmbv --disable-
 encoder=zlib --disable-encoder=snow --disable-encoder=cinepak --disable-
 encoder=a64multi --disable-encoder=a64multi5 --disable-encoder=h261
 --disable-encoder=h263 --disable-encoder=h263p --disable-encoder=wmv7
 --disable-encoder=wmav1 --disable-encoder=wmav2 --disable-encoder=wmv8
 --enable-libfdk-aac --enable-nonfree --disable-debug --shlibdir=/local64
 /bin-video
   libavutil      56.  8.100 / 56.  8.100
   libavcodec     58. 13.102 / 58. 13.102
   libavformat    58. 10.100 / 58. 10.100
   libavdevice    58.  2.100 / 58.  2.100
   libavfilter     7. 12.100 /  7. 12.100
   libswscale      5.  0.102 /  5.  0.102
   libswresample   3.  0.101 /  3.  0.101
   libpostproc    55.  0.100 / 55.  0.100
 Splitting the commandline.
 Reading option '-debug_ts' ... matched as option 'debug_ts' (print
 timestamp debugging info) with argument '1'.
 Reading option '-report' ... matched as option 'report' (generate a
 report) with argument '1'.
 Reading option '-v' ... matched as option 'v' (set logging level) with
 argument '9'.
 Reading option '-loglevel' ... matched as option 'loglevel' (set logging
 level) with argument '99'.
 Reading option '-f' ... matched as option 'f' (force format) with argument
 'lavfi'.
 Reading option '-i' ... matched as input url with argument 'nullsrc'.
 Reading option '-i' ... matched as input url with argument 'sub.1.srt'.
 Reading option '-i' ... matched as input url with argument 'sub.2.srt'.
 Reading option '-map' ... matched as option 'map' (set input stream
 mapping) with argument '0:0'.
 Reading option '-map' ... matched as option 'map' (set input stream
 mapping) with argument '1:0'.
 Reading option '-map' ... matched as option 'map' (set input stream
 mapping) with argument '2:0'.
 Reading option '-c' ... matched as option 'c' (codec name) with argument
 'copy'.
 Reading option '-f' ... matched as option 'f' (force format) with argument
 'framehash'.
 Reading option '-hash' ... matched as AVOption 'hash' with argument
 'crc32'.
 Reading option '-t' ... matched as option 't' (record or transcode
 "duration" seconds of audio/video) with argument '1:39:00'.
 Reading option 'log.txt' ... matched as output url.
 Finished splitting the commandline.
 Parsing a group of options: global .
 Applying option debug_ts (print timestamp debugging info) with argument 1.
 Applying option report (generate a report) with argument 1.
 Applying option v (set logging level) with argument 9.
 Applying option loglevel (set logging level) with argument 99.
 Successfully parsed a group of options.
 Parsing a group of options: input url nullsrc.
 Applying option f (force format) with argument lavfi.
 Successfully parsed a group of options.
 Opening an input file: nullsrc.
 detected 4 logical cores
 [Parsed_nullsrc_0 @ 00000000005d5e00] size:320x240 rate:25/1
 duration:-1.000000 sar:1/1
 [AVFilterGraph @ 00000000005d2cc0] query_formats: 2 queried, 1 merged, 0
 already done, 0 delayed
 [lavfi @ 00000000005d2280] All info found
 Input #0, lavfi, from 'nullsrc':
   Duration: N/A, start: 0.000000, bitrate: N/A
     Stream #0:0, 1, 1/25: Video: rawvideo, 1 reference frame (I420 /
 0x30323449), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 0/1, 25 tbr, 25 tbn, 25
 tbc
 Successfully opened the file.
 Parsing a group of options: input url sub.1.srt.
 Successfully parsed a group of options.
 Opening an input file: sub.1.srt.
 [NULL @ 000000000061c480] Opening 'sub.1.srt' for reading
 [file @ 000000000061cac0] Setting default whitelist 'file,crypto'
 [srt @ 000000000061c480] Format srt probed with size=2048 and score=100
 [srt @ 000000000061c480] Before avformat_find_stream_info() pos: 32939
 bytes read:32939 seeks:0 nb_streams:1
 [srt @ 000000000061c480] All info found
 [srt @ 000000000061c480] After avformat_find_stream_info() pos: 32939
 bytes read:32939 seeks:0 frames:0
 Input #1, srt, from 'sub.1.srt':
   Duration: N/A, bitrate: N/A
     Stream #1:0, 0, 1/1000: Subtitle: subrip
 Successfully opened the file.
 Parsing a group of options: input url sub.2.srt.
 Successfully parsed a group of options.
 Opening an input file: sub.2.srt.
 [NULL @ 0000000000669400] Opening 'sub.2.srt' for reading
 [file @ 000000000061cb80] Setting default whitelist 'file,crypto'
 [srt @ 0000000000669400] Format srt probed with size=2048 and score=100
 [srt @ 0000000000669400] Before avformat_find_stream_info() pos: 26559
 bytes read:26559 seeks:0 nb_streams:1
 [srt @ 0000000000669400] All info found
 [srt @ 0000000000669400] After avformat_find_stream_info() pos: 26559
 bytes read:26559 seeks:0 frames:0
 Input #2, srt, from 'sub.2.srt':
   Duration: N/A, bitrate: N/A
     Stream #2:0, 0, 1/1000: Subtitle: subrip
 Successfully opened the file.
 Parsing a group of options: output url log.txt.
 Applying option map (set input stream mapping) with argument 0:0.
 Applying option map (set input stream mapping) with argument 1:0.
 Applying option map (set input stream mapping) with argument 2:0.
 Applying option c (codec name) with argument copy.
 Applying option f (force format) with argument framehash.
 Applying option t (record or transcode "duration" seconds of audio/video)
 with argument 1:39:00.
 Successfully parsed a group of options.
 Opening an output file: log.txt.
 [file @ 000000000061ce80] Setting default whitelist 'file,crypto'
 Successfully opened the file.
 Output #0, framehash, to 'log.txt':
   Metadata:
     encoder         : Lavf58.10.100
     Stream #0:0, 0, 1/25: Video: rawvideo, 1 reference frame (I420 /
 0x30323449), yuv420p, 320x240 (0x0) [SAR 1:1 DAR 4:3], 0/1, q=2-31, 25
 tbr, 25 tbn, 25 tbc
     Stream #0:1, 0, 1/1000: Subtitle: subrip
     Stream #0:2, 0, 1/1000: Subtitle: subrip
 Stream mapping:
   Stream #0:0 -> #0:0 (copy)
   Stream #1:0 -> #0:1 (copy)
   Stream #2:0 -> #0:2 (copy)
 Press [q] to stop, [?] for help
 cur_dts is invalid (this is harmless if it occurs once at the start per
 stream)
 cur_dts is invalid (this is harmless if it occurs once at the start per
 stream)
 cur_dts is invalid (this is harmless if it occurs once at the start per
 stream)
 demuxer -> ist_index:0 type:video next_dts:NOPTS next_dts_time:NOPTS
 next_pts:NOPTS next_pts_time:NOPTS pkt_pts:0 pkt_pts_time:0 pkt_dts:0
 pkt_dts_time:0 off:0 off_time:0
 demuxer+ffmpeg -> ist_index:0 type:video pkt_pts:0 pkt_pts_time:0
 pkt_dts:0 pkt_dts_time:0 off:0 off_time:0
 muxer <- type:video pkt_pts:0 pkt_pts_time:0 pkt_dts:0 pkt_dts_time:0
 size:115200
 cur_dts is invalid (this is harmless if it occurs once at the start per
 stream)
 cur_dts is invalid (this is harmless if it occurs once at the start per
 stream)
 demuxer -> ist_index:1 type:subtitle next_dts:NOPTS next_dts_time:NOPTS
 next_pts:NOPTS next_pts_time:NOPTS pkt_pts:54560 pkt_pts_time:54.56
 pkt_dts:54560 pkt_dts_time:54.56 off:0 off_time:0
 demuxer+ffmpeg -> ist_index:1 type:subtitle pkt_pts:54560
 pkt_pts_time:54.56 pkt_dts:54560 pkt_dts_time:54.56 off:0 off_time:0
 muxer <- type:subtitle pkt_pts:54560 pkt_pts_time:54.56 pkt_dts:54560
 pkt_dts_time:54.56 size:4
 [framehash @ 0000000002f14240] Delay between the first packet and last
 packet in the muxing queue is 54560000 > 10000000: forcing output
 cur_dts is invalid (this is harmless if it occurs once at the start per
 stream)
 demuxer -> ist_index:2 type:subtitle next_dts:NOPTS next_dts_time:NOPTS
 next_pts:NOPTS next_pts_time:NOPTS pkt_pts:146760 pkt_pts_time:146.76
 pkt_dts:146760 pkt_dts_time:146.76 off:0 off_time:0
 demuxer+ffmpeg -> ist_index:2 type:subtitle pkt_pts:146760
 pkt_pts_time:146.76 pkt_dts:146760 pkt_dts_time:146.76 off:0 off_time:0
 muxer <- type:subtitle pkt_pts:146760 pkt_pts_time:146.76 pkt_dts:146760
 pkt_dts_time:146.76 size:4
 [framehash @ 0000000002f14240] Delay between the first packet and last
 packet in the muxing queue is 92200000 > 10000000: forcing output
 demuxer -> ist_index:0 type:video next_dts:40000 next_dts_time:0.04
 next_pts:40000 next_pts_time:0.04 pkt_pts:1 pkt_pts_time:0.04 pkt_dts:1
 pkt_dts_time:0.04 off:0 off_time:0
 demuxer+ffmpeg -> ist_index:0 type:video pkt_pts:1 pkt_pts_time:0.04
 pkt_dts:1 pkt_dts_time:0.04 off:0 off_time:0
 muxer <- type:video pkt_pts:1 pkt_pts_time:0.04 pkt_dts:1
 pkt_dts_time:0.04 size:115200
 [framehash @ 0000000002f14240] Delay between the first packet and last
 packet in the muxing queue is 146720000 > 10000000: forcing output
 ...
 demuxer -> ist_index:0 type:video next_dts:208080000 next_dts_time:208.08
 next_pts:208080000 next_pts_time:208.08 pkt_pts:5202 pkt_pts_time:208.08
 pkt_dts:5202 pkt_dts_time:208.08 off:0 off_time:0
 demuxer+ffmpeg -> ist_index:0 type:video pkt_pts:5202 pkt_pts_time:208.08
 pkt_dts:5202 pkt_dts_time:208.08 off:0 off_time:0
 muxer <- type:video pkt_pts:5202 pkt_pts_time:208.08 pkt_dts:5202
 pkt_dts_time:208.08 size:115200
 [framehash @ 0000000002f14240] Delay between the first packet and last
 packet in the muxing queue is 60640000 > 10000000: forcing output
 demuxer -> ist_index:0 type:video next_dts:208120000 next_dts_time:208.12
 next_pts:208120000 next_pts_time:208.12 pkt_pts:5203 pkt_pts_time:208.12
 pkt_dts:5203 pkt_dts_time:208.12 off:0 off_time:0
 demuxer+ffmpeg -> ist_index:0 type:video pkt_pts:5203 pkt_pts_time:208.12
 pkt_dts:5203 pkt_dts_time:208.12 off:0 off_time:0
 muxer <- type:video pkt_pts:5203 pkt_pts_time:208.12 pkt_dts:5203
 pkt_dts_time:208.12 size:115200
 [framehash @ 0000000002f14240] Delay between the first packet and last
 packet in the muxing queue is 60600000 > 10000000: forcing output
 demuxer -> ist_index:1 type:subtitle next_dts:208080000
 next_dts_time:208.08 next_pts:208080000 next_pts_time:208.08
 pkt_pts:249240 pkt_pts_time:249.24 pkt_dts:249240 pkt_dts_time:249.24
 off:0 off_time:0
 demuxer+ffmpeg -> ist_index:1 type:subtitle pkt_pts:249240
 pkt_pts_time:249.24 pkt_dts:249240 pkt_dts_time:249.24 off:0 off_time:0
 muxer <- type:subtitle pkt_pts:249240 pkt_pts_time:249.24 pkt_dts:249240
 pkt_dts_time:249.24 size:4
 [framehash @ 0000000002f14240] Delay between the first packet and last
 packet in the muxing queue is 19480000 > 10000000: forcing output
 demuxer -> ist_index:0 type:video next_dts:208160000 next_dts_time:208.16
 next_pts:208160000 next_pts_time:208.16 pkt_pts:5204 pkt_pts_time:208.16
 pkt_dts:5204 pkt_dts_time:208.16 off:0 off_time:0
 demuxer+ffmpeg -> ist_index:0 type:video pkt_pts:5204 pkt_pts_time:208.16
 pkt_dts:5204 pkt_dts_time:208.16 off:0 off_time:0
 muxer <- type:video pkt_pts:5204 pkt_pts_time:208.16 pkt_dts:5204
 pkt_dts_time:208.16 size:115200
 [framehash @ 0000000002f14240] Delay between the first packet and last
 packet in the muxing queue is 60560000 > 10000000: forcing output
 ...
 }}}

 The following subtitle packets are more than 4s away from the first non-
 subtitle-packet following them (the first time in every line is the
 timestamp of the first non-subtitle-packet immediately following the
 subtitle packet with the second time in that very same line):
 {{{
 sub.1.srt:  00:00:00.0400000   00:00:54.5600000
 sub.1.srt:  00:02:49.4400000   00:03:28.0800000
 sub.1.srt:  00:03:28.1600000   00:04:09.2400000
 sub.1.srt:  00:07:38.0800000   00:07:44.1600000
 sub.1.srt:  00:13:49.8400000   00:13:54.0000000
 sub.1.srt:  00:13:54.0800000   00:14:09.4400000
 sub.1.srt:  00:14:49.1600000   00:15:44.1200000
 sub.1.srt:  00:18:41.9600000   00:18:47.0800000
 sub.1.srt:  00:18:50.2400000   00:19:06.0400000
 sub.1.srt:  00:27:15.2400000   00:27:21.6800000
 sub.1.srt:  00:28:40.9600000   00:28:46.3200000
 sub.1.srt:  00:31:15.5600000   00:31:27.2400000
 sub.1.srt:  00:33:10.5600000   00:33:23.4000000
 sub.2.srt:  00:37:16.3200000   00:37:38.2800000
 sub.1.srt:  00:50:54.9200000   00:51:06.7200000
 sub.1.srt:  00:53:06.0000000   00:53:31.5600000
 sub.1.srt:  00:56:40.6000000   00:57:02.8400000
 sub.1.srt:  00:58:35.3600000   00:58:53.1200000
 sub.1.srt:  00:59:34.4800000   00:59:39.4000000
 sub.1.srt:  01:01:41.9600000   01:02:38.1600000
 sub.1.srt:  01:06:11.9200000   01:06:24.8000000
 sub.1.srt:  01:11:11.0800000   01:11:20.9200000
 sub.1.srt:  01:11:21.0000000   01:11:48.6000000
 sub.1.srt:  01:18:08.7200000   01:18:27.4800000
 sub.2.srt:  01:19:00.6400000   01:19:05.0800000
 sub.2.srt:  01:19:05.1600000   01:19:10.1200000
 sub.2.srt:  01:19:10.2000000   01:19:17.5600000
 sub.2.srt:  01:26:13.9200000   01:26:18.8400000
 sub.2.srt:  01:26:18.9200000   01:26:23.0800000
 sub.2.srt:  01:26:26.6800000   01:26:32.6800000
 sub.2.srt:  01:26:32.7600000   01:26:53.9200000
 sub.2.srt:  01:26:56.7600000   01:27:03.1200000
 sub.2.srt:  01:27:03.2000000   01:27:10.2400000
 sub.2.srt:  01:27:10.3200000   01:27:17.1200000
 sub.2.srt:  01:27:17.2000000   01:27:24.2800000
 sub.2.srt:  01:27:28.2400000   01:27:32.4000000
 sub.2.srt:  01:27:32.4800000   01:28:09.6000000
 sub.2.srt:  01:28:23.0000000   01:28:43.4800000
 sub.1.srt:  01:31:32.7600000   01:31:37.9600000
 }}}

 These are the same packets that are wrongly interleaved in the Matroska
 file I mentioned at the beginning (I used a -ss 31.76 to create it, hence
 the discrepancy).
 And here is a part of framehash's output:
 {{{
 #format: frame checksums
 #version: 2
 #hash: CRC32
 #software: Lavf58.10.100
 #tb 0: 1/25
 #media_type 0: video
 #codec_id 0: rawvideo
 #dimensions 0: 320x240
 #sar 0: 1/1
 #tb 1: 1/1000
 #media_type 1: subtitle
 #codec_id 1: subrip
 #tb 2: 1/1000
 #media_type 2: subtitle
 #codec_id 2: subrip
 #stream#, dts,        pts, duration,     size, hash
 0,          0,          0,        1,   115200, 2a01c517
 1,      54560,      54560,     1959,        4, 784dd132
 0,          1,          1,        1,   115200, 2a01c517
 0,          2,          2,        1,   115200, 2a01c517
 0,          3,          3,        1,   115200, 2a01c517
 0,          4,          4,        1,   115200, 2a01c517
 0,          5,          5,        1,   115200, 2a01c517
 0,          6,          6,        1,   115200, 2a01c517
 0,          7,          7,        1,   115200, 2a01c517
 ...
 0,       4230,       4230,        1,   115200, 2a01c517
 0,       4231,       4231,        1,   115200, 2a01c517
 1,     169240,     169240,     2399,        4, 784dd132
 0,       4232,       4232,        1,   115200, 2a01c517
 2,     169360,     169360,     2079,        4, 784dd132
 0,       4233,       4233,        1,   115200, 2a01c517
 0,       4234,       4234,        1,   115200, 2a01c517
 0,       4235,       4235,        1,   115200, 2a01c517
 1,     208080,     208080,     1959,        4, 784dd132
 0,       4236,       4236,        1,   115200, 2a01c517
 0,       4237,       4237,        1,   115200, 2a01c517
 ...
 }}}

 [[BR]]
 [[BR]]
 [[BR]]

 As can be seen from the above report, ffmpeg is forcing output not only
 for the subtitle packets, but also for audio and video packets. No forcing
 happens with only one video and one subtitle track and the interleavement
 is fine in this case; but in the case of a video, an audio and an external
 subtitle track it's not. I used the
 [http://download.blender.org/peach/bigbuckbunny_movies/BigBuckBunny_320x180.mp4
 Big Buck Bunny movie] and converted it to a transport stream with large
 PES packets (the more audio or video frames in a PES packet, the worse the
 interlacing of the final output file will be):
 {{{
 ffmpeg.exe -i BigBuckBunny_320x180.mp4 -c copy -f mpegts -pes_payload_size
 15000 bbb.ts
 }}}
 The streams in this transport stream are then sent (via streamcopy) to the
 framehash muxer, once with an external subtitle file and once without.
 Here is the commandline for the case without subs:
 {{{
 ffmpeg.exe -debug_ts -report -loglevel 99 -i bbb.ts -t 3:00 -c copy -f
 framehash -hash crc32 bbb.txt
 }}}
 I am omitting the rest of the output here, but attach the report. Nothing
 bad has happened here. The output of the framehash muxer looks good (if
 one uses the default value for the size of PES packets one gets the same
 interleavement):
 {{{
 #format: frame checksums
 #version: 2
 #hash: CRC32
 #extradata 0,                              37, f416b2c0
 #software: Lavf58.10.100
 #tb 0: 1/90000
 #media_type 0: video
 #codec_id 0: h264
 #dimensions 0: 320x180
 #sar 0: 1/1
 #tb 1: 1/90000
 #media_type 1: audio
 #codec_id 1: aac
 #sample_rate 1: 48000
 #channel_layout 1: 3
 #channel_layout_name 1: stereo
 #stream#, dts,        pts, duration,     size, hash
 0,          0,          0,     3750,      256, 867f29a5, S=1,        1,
 72080df5
 1,          0,          0,     1920,      404, 364de659, S=1,        1,
 49662d3d
 1,       1920,       1920,     1920,      329, 28f13373
 0,       3750,       3750,     3750,       18, 4d8ee2e7, S=1,        1,
 72080df5
 1,       3840,       3840,     1920,      352, c1b02f7a
 1,       5760,       5760,     1920,      375, 644afd31
 0,       7500,       7500,     3750,       18, 9d1ebd27, S=1,        1,
 72080df5
 1,       7680,       7680,     1920,      338, 9e110bca
 1,       9600,       9600,     1920,      325, 0a8daad0
 0,      11250,      11250,     3750,       18, daaea9ee, S=1,        1,
 72080df5
 1,      11520,      11520,     1920,      330, fc5d9ddc
 1,      13440,      13440,     1920,      329, 05c3d3eb
 0,      15000,      15000,     3750,      472, a26fe68f, S=1,        1,
 72080df5
 1,      15360,      15360,     1920,      343, fddf9fb9
 1,      17280,      17280,     1920,      367, 6d7dbcb0
 0,      18750,      18750,     3750,      476, d9ce4dbf, S=1,        1,
 72080df5
 1,      19200,      19200,     1920,      361, 079a44eb
 1,      21120,      21120,     1920,      362, 454e5a3b
 0,      22500,      22500,     3750,      371, f7bfab8d, S=1,        1,
 72080df5
 1,      23040,      23040,     1920,      420, 58f2697e
 1,      24960,      24960,     1920,      420, 4e86239b
 0,      26250,      26250,     3750,      455, 243fea03, S=1,        1,
 72080df5
 1,      26880,      26880,     1920,      398, e82eacff
 1,      28800,      28800,     1920,      417, 7035160f
 0,      30000,      30000,     3750,      698, 75bb2061, S=1,        1,
 72080df5
 1,      30720,      30720,     1920,      454, 32c82555
 1,      32640,      32640,     1920,      428, b877ffe5
 0,      33750,      33750,     3750,      654, 0cd0b802, S=1,        1,
 72080df5
 1,      34560,      34560,     1920,      430, b0b3778c
 1,      36480,      36480,     1920,      454, 22fa256e
 0,      37500,      37500,     3750,      764, 94ea5bf6, S=1,        1,
 72080df5
 1,      38400,      38400,     1920,      461, d0ad0635
 1,      40320,      40320,     1920,      479, 9bc771f0
 0,      41250,      41250,     3750,      900, a9b58282, S=1,        1,
 72080df5
 1,      42240,      42240,     1920,      457, 25c613f8
 1,      44160,      44160,     1920,      488, 214e2c69
 0,      45000,      45000,     3750,      928, 3edd1c6f, S=1,        1,
 72080df5
 1,      46080,      46080,     1920,      507, d690ea7b
 1,      48000,      48000,     1920,      488, 5bfc7a00
 0,      48750,      48750,     3750,      969, eb8e8580, S=1,        1,
 72080df5
 1,      49920,      49920,     1920,      482, 63fc95b2
 1,      51840,      51840,     1920,      434, bbdad45e
 ...
 }}}
 But with an external subtitle file the situation changes (I'll attach the
 report created by it):
 {{{
 ffmpeg.exe -debug_ts -report -loglevel 99 -i bbb.ts -i sub.1.srt -map 0
 -map 1 -t 3:00 -c copy -f framehash -hash crc32 bbb2.txt
 ...
 demuxer -> ist_index:0 type:video next_dts:583334 next_dts_time:0.583334
 next_pts:583334 next_pts_time:0.583334 pkt_pts:178500 pkt_pts_time:1.98333
 pkt_dts:178500 pkt_dts_time:1.98333 off:-1400000 off_time:-1.4
 demuxer+ffmpeg -> ist_index:0 type:video pkt_pts:52500
 pkt_pts_time:0.583333 pkt_dts:52500 pkt_dts_time:0.583333 off:-1400000
 off_time:-1.4
 muxer <- type:video pkt_pts:52500 pkt_pts_time:0.583333 pkt_dts:52500
 pkt_dts_time:0.583333 size:1152
 cur_dts is invalid (this is harmless if it occurs once at the start per
 stream)
 cur_dts is invalid (this is harmless if it occurs once at the start per
 stream)
 demuxer -> ist_index:1 type:audio next_dts:NOPTS next_dts_time:NOPTS
 next_pts:NOPTS next_pts_time:NOPTS pkt_pts:126000 pkt_pts_time:1.4
 pkt_dts:126000 pkt_dts_time:1.4 off:-1400000 off_time:-1.4
 demuxer+ffmpeg -> ist_index:1 type:audio pkt_pts:0 pkt_pts_time:0
 pkt_dts:0 pkt_dts_time:0 off:-1400000 off_time:-1.4
 muxer <- type:audio pkt_pts:0 pkt_pts_time:0 pkt_dts:0 pkt_dts_time:0
 size:404
 cur_dts is invalid (this is harmless if it occurs once at the start per
 stream)
 demuxer -> ist_index:2 type:subtitle next_dts:NOPTS next_dts_time:NOPTS
 next_pts:NOPTS next_pts_time:NOPTS pkt_pts:54560 pkt_pts_time:54.56
 pkt_dts:54560 pkt_dts_time:54.56 off:0 off_time:0
 demuxer+ffmpeg -> ist_index:2 type:subtitle pkt_pts:54560
 pkt_pts_time:54.56 pkt_dts:54560 pkt_dts_time:54.56 off:0 off_time:0
 muxer <- type:subtitle pkt_pts:54560 pkt_pts_time:54.56 pkt_dts:54560
 pkt_dts_time:54.56 size:4
 [framehash @ 000000000241dcc0] Delay between the first packet and last
 packet in the muxing queue is 54518333 > 10000000: forcing output
 [framehash @ 000000000241dcc0] Delay between the first packet and last
 packet in the muxing queue is 54476667 > 10000000: forcing output
 [framehash @ 000000000241dcc0] Delay between the first packet and last
 packet in the muxing queue is 54435000 > 10000000: forcing output
 [framehash @ 000000000241dcc0] Delay between the first packet and last
 packet in the muxing queue is 54393333 > 10000000: forcing output
 [framehash @ 000000000241dcc0] Delay between the first packet and last
 packet in the muxing queue is 54351667 > 10000000: forcing output
 [framehash @ 000000000241dcc0] Delay between the first packet and last
 packet in the muxing queue is 54310000 > 10000000: forcing output
 [framehash @ 000000000241dcc0] Delay between the first packet and last
 packet in the muxing queue is 54268333 > 10000000: forcing output
 [framehash @ 000000000241dcc0] Delay between the first packet and last
 packet in the muxing queue is 54226667 > 10000000: forcing output
 [framehash @ 000000000241dcc0] Delay between the first packet and last
 packet in the muxing queue is 54185000 > 10000000: forcing output
 [framehash @ 000000000241dcc0] Delay between the first packet and last
 packet in the muxing queue is 54143333 > 10000000: forcing output
 [framehash @ 000000000241dcc0] Delay between the first packet and last
 packet in the muxing queue is 54101667 > 10000000: forcing output
 [framehash @ 000000000241dcc0] Delay between the first packet and last
 packet in the muxing queue is 54060000 > 10000000: forcing output
 [framehash @ 000000000241dcc0] Delay between the first packet and last
 packet in the muxing queue is 54018333 > 10000000: forcing output
 [framehash @ 000000000241dcc0] Delay between the first packet and last
 packet in the muxing queue is 53976667 > 10000000: forcing output
 demuxer -> ist_index:1 type:audio next_dts:21333 next_dts_time:0.021333
 next_pts:21333 next_pts_time:0.021333 pkt_pts:127920 pkt_pts_time:1.42133
 pkt_dts:127920 pkt_dts_time:1.42133 off:-1400000 off_time:-1.4
 demuxer+ffmpeg -> ist_index:1 type:audio pkt_pts:1920
 pkt_pts_time:0.0213333 pkt_dts:1920 pkt_dts_time:0.0213333 off:-1400000
 off_time:-1.4
 muxer <- type:audio pkt_pts:1920 pkt_pts_time:0.0213333 pkt_dts:1920
 pkt_dts_time:0.0213333 size:329
 [framehash @ 000000000241dcc0] Delay between the first packet and last
 packet in the muxing queue is 54538667 > 10000000: forcing output
 demuxer -> ist_index:1 type:audio next_dts:42666 next_dts_time:0.042666
 next_pts:42666 next_pts_time:0.042666 pkt_pts:129840 pkt_pts_time:1.44267
 pkt_dts:129840 pkt_dts_time:1.44267 off:-1400000 off_time:-1.4
 demuxer+ffmpeg -> ist_index:1 type:audio pkt_pts:3840
 pkt_pts_time:0.0426667 pkt_dts:3840 pkt_dts_time:0.0426667 off:-1400000
 off_time:-1.4
 muxer <- type:audio pkt_pts:3840 pkt_pts_time:0.0426667 pkt_dts:3840
 pkt_dts_time:0.0426667 size:352
 [framehash @ 000000000241dcc0] Delay between the first packet and last
 packet in the muxing queue is 54517333 > 10000000: forcing output
 ...
 }}}
 And forcing output has adverse consequences for its interleavement until
 it is only 10s away from the next subtitle packet; it gets bad again after
 outputting a subtitle packet if there is another subtitle packet and if
 the next packet is more than 10s away:
 {{{
 #format: frame checksums
 #version: 2
 #hash: CRC32
 #extradata 0,                              37, f416b2c0
 #software: Lavf58.10.100
 #tb 0: 1/90000
 #media_type 0: video
 #codec_id 0: h264
 #dimensions 0: 320x180
 #sar 0: 1/1
 #tb 1: 1/90000
 #media_type 1: audio
 #codec_id 1: aac
 #sample_rate 1: 48000
 #channel_layout 1: 3
 #channel_layout_name 1: stereo
 #tb 2: 1/1000
 #media_type 2: subtitle
 #codec_id 2: subrip
 #stream#, dts,        pts, duration,     size, hash
 0,          0,          0,     3750,      256, 867f29a5, S=1,        1,
 72080df5
 1,          0,          0,     1920,      404, 364de659, S=1,        1,
 49662d3d
 0,       3750,       3750,     3750,       18, 4d8ee2e7, S=1,        1,
 72080df5
 0,       7500,       7500,     3750,       18, 9d1ebd27, S=1,        1,
 72080df5
 0,      11250,      11250,     3750,       18, daaea9ee, S=1,        1,
 72080df5
 0,      15000,      15000,     3750,      472, a26fe68f, S=1,        1,
 72080df5
 0,      18750,      18750,     3750,      476, d9ce4dbf, S=1,        1,
 72080df5
 0,      22500,      22500,     3750,      371, f7bfab8d, S=1,        1,
 72080df5
 0,      26250,      26250,     3750,      455, 243fea03, S=1,        1,
 72080df5
 0,      30000,      30000,     3750,      698, 75bb2061, S=1,        1,
 72080df5
 0,      33750,      33750,     3750,      654, 0cd0b802, S=1,        1,
 72080df5
 0,      37500,      37500,     3750,      764, 94ea5bf6, S=1,        1,
 72080df5
 0,      41250,      41250,     3750,      900, a9b58282, S=1,        1,
 72080df5
 0,      45000,      45000,     3750,      928, 3edd1c6f, S=1,        1,
 72080df5
 0,      48750,      48750,     3750,      969, eb8e8580, S=1,        1,
 72080df5
 0,      52500,      52500,     3750,     1152, 18c3337b, S=1,        1,
 72080df5
 1,       1920,       1920,     1920,      329, 28f13373
 1,       3840,       3840,     1920,      352, c1b02f7a
 1,       5760,       5760,     1920,      375, 644afd31
 1,       7680,       7680,     1920,      338, 9e110bca
 1,       9600,       9600,     1920,      325, 0a8daad0
 1,      11520,      11520,     1920,      330, fc5d9ddc
 1,      13440,      13440,     1920,      329, 05c3d3eb
 1,      15360,      15360,     1920,      343, fddf9fb9
 1,      17280,      17280,     1920,      367, 6d7dbcb0
 1,      19200,      19200,     1920,      361, 079a44eb
 1,      21120,      21120,     1920,      362, 454e5a3b
 1,      23040,      23040,     1920,      420, 58f2697e
 1,      24960,      24960,     1920,      420, 4e86239b
 1,      26880,      26880,     1920,      398, e82eacff
 1,      28800,      28800,     1920,      417, 7035160f
 1,      30720,      30720,     1920,      454, 32c82555
 1,      32640,      32640,     1920,      428, b877ffe5
 1,      34560,      34560,     1920,      430, b0b3778c
 1,      36480,      36480,     1920,      454, 22fa256e
 1,      38400,      38400,     1920,      461, d0ad0635
 1,      40320,      40320,     1920,      479, 9bc771f0
 1,      42240,      42240,     1920,      457, 25c613f8
 1,      44160,      44160,     1920,      488, 214e2c69
 1,      46080,      46080,     1920,      507, d690ea7b
 1,      48000,      48000,     1920,      488, 5bfc7a00
 1,      49920,      49920,     1920,      482, 63fc95b2
 1,      51840,      51840,     1920,      434, bbdad45e
 1,      53760,      53760,     1920,      424, ea315f47
 1,      55680,      55680,     1920,      418, bf958856
 1,      57600,      57600,     1920,      436, b09bb481
 1,      59520,      59520,     1920,      429, d3939cdb
 1,      61440,      61440,     1920,      425, ced41fb9
 0,      56250,      56250,     3750,     1072, e26a957d, S=1,        1,
 72080df5
 ...
 1,    3987840,    3987840,     1920,      461, f7eb6426
 1,    3989760,    3989760,     1920,      453, 4dd30411
 1,    3991680,    3991680,     1920,      458, 0e644367
 1,    3993600,    3993600,     1920,      461, 643ee2b3
 1,    3995520,    3995520,     1920,      460, be7d42ff
 1,    3997440,    3997440,     1920,      528, ffd44e16
 1,    3999360,    3999360,     1920,      616, 99806080
 1,    4001280,    4001280,     1920,      553, dbfeb1be
 1,    4003200,    4003200,     1920,      518, dd233bad
 1,    4005120,    4005120,     1920,      533, ddb6a301
 1,    4007040,    4007040,     1920,      536, 91b43133
 1,    4008960,    4008960,     1920,      531, dd6efb7d
 0,    4005000,    4005000,     3750,    18482, f964ca8e, S=1,        1,
 72080df5
 0,    4008750,    4008750,     3750,     1684, 2815991f, S=1,        1,
 72080df5
 1,    4010880,    4010880,     1920,      501, bb2df590, S=1,        1,
 49662d3d
 0,    4012500,    4012500,     3750,     2377, 2f108248, S=1,        1,
 72080df5
 1,    4012800,    4012800,     1920,      424, 5733240e
 1,    4014720,    4014720,     1920,      453, a99c42e9
 0,    4016250,    4016250,     3750,     2690, 44ae63da, S=1,        1,
 72080df5
 1,    4016640,    4016640,     1920,      429, 1a8b3573
 1,    4018560,    4018560,     1920,      419, ff04fe0c
 0,    4020000,    4020000,     3750,     3208, 06b49d8f, S=1,        1,
 72080df5
 1,    4020480,    4020480,     1920,      414, 1637ab1d
 1,    4022400,    4022400,     1920,      393, 65ea7479
 0,    4023750,    4023750,     3750,     2968, 52bd9074, S=1,        1,
 72080df5
 1,    4024320,    4024320,     1920,      435, 9323cdf6
 1,    4026240,    4026240,     1920,      385, 9045a31d
 ...
 1,    4897920,    4897920,     1920,      403, aa78b4e5
 1,    4899840,    4899840,     1920,      401, 4a5fa886
 0,    4901250,    4901250,     3750,     3247, cce70aa5, S=1,        1,
 72080df5
 1,    4901760,    4901760,     1920,      386, 3c967b96
 1,    4903680,    4903680,     1920,      428, a5f404c1
 0,    4905000,    4905000,     3750,    23857, c47e5f75, S=1,        1,
 72080df5
 1,    4905600,    4905600,     1920,      358, bc590c67
 1,    4907520,    4907520,     1920,      328, 34c625d9
 0,    4908750,    4908750,     3750,     1198, b3c25ffe, S=1,        1,
 72080df5
 1,    4909440,    4909440,     1920,      385, 7e965f96
 2,      54560,      54560,     1959,        4, 784dd132
 1,    4911360,    4911360,     1920,      426, ac588c93
 0,    4912500,    4912500,     3750,     1466, be194b99, S=1,        1,
 72080df5
 0,    4916250,    4916250,     3750,     1525, 2f7c3e98, S=1,        1,
 72080df5
 0,    4920000,    4920000,     3750,     1480, e0fb3fca, S=1,        1,
 72080df5
 0,    4923750,    4923750,     3750,     2398, 5a567e40, S=1,        1,
 72080df5
 0,    4927500,    4927500,     3750,     2636, 61b32c6d, S=1,        1,
 72080df5
 0,    4931250,    4931250,     3750,     3260, 8037056c, S=1,        1,
 72080df5
 0,    4935000,    4935000,     3750,     2893, fc17e61b, S=1,        1,
 72080df5
 0,    4938750,    4938750,     3750,     4115, 12840a6d, S=1,        1,
 72080df5
 1,    4913280,    4913280,     1920,      461, 8e420c2c
 1,    4915200,    4915200,     1920,      492, dfb4dc23
 1,    4917120,    4917120,     1920,      522, 1981a904
 1,    4919040,    4919040,     1920,      501, c4607451
 1,    4920960,    4920960,     1920,      502, 64ae294d
 1,    4922880,    4922880,     1920,      472, f075741d
 1,    4924800,    4924800,     1920,      403, 82a83cdf
 1,    4926720,    4926720,     1920,      411, 265fb690
 1,    4928640,    4928640,     1920,      403, 69102e83
 1,    4930560,    4930560,     1920,      401, 1e2c2372
 1,    4932480,    4932480,     1920,      404, 076b6aca
 1,    4934400,    4934400,     1920,      402, 100f397d
 1,    4936320,    4936320,     1920,      418, e4557858
 1,    4938240,    4938240,     1920,      402, 2bee4d0e
 1,    4940160,    4940160,     1920,      380, e35f3971
 1,    4942080,    4942080,     1920,      402, 3ef0c724
 1,    4944000,    4944000,     1920,      404, 7584afcd
 1,    4945920,    4945920,     1920,      411, 9f0da940
 ...
 }}}

--
Ticket URL: <https://trac.ffmpeg.org/ticket/7064>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list