[FFmpeg-trac] #4450(undetermined:new): Copying subtitle streams aborts w/non monotonically increasing dts
FFmpeg
trac at avcodec.org
Tue Apr 7 22:45:48 CEST 2015
#4450: Copying subtitle streams aborts w/non monotonically increasing dts
-------------------------------------+-------------------------------------
Reporter: forbyta | Type: defect
Status: new | Priority: normal
Component: | Version: git-
undetermined | master
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Summary of the bug:
Copying the subtitle streams from some mpeg files causes ffmpeg to abort
with the following message (example 1 below):
{{{
[vob @ 0x9aa6860] Application provided invalid, non monotonically
increasing dts to muxer in stream 2: 307990683 >= 0
av_interleaved_write_frame(): Invalid argument
}}}
If only video and audio streams are copied, then a similar message is
displayed for the audio streams, but ffmpeg does NOT abort (example 2
below):
{{{
[vob @ 0x8526700] Non-monotonous DTS in output stream 0:1; previous:
331320960, current: 331319487; changing to 331320961. This may result in
incorrect timestamps in the output file.
}}}
If ffmpeg.c line 679 is modified to include AVMEDIA_TYPE_SUBTITLE or line
679 is removed, then example 1 will complete the copy. ffmpeg generates
the same warning as example 2 for each subtitle stream, but the resulting
file appears to be fine with all subtitles intact.
This issue does not happen with ALL mpeg files and it may not be
restricted to mpeg files. I've noticed it on several mpeg files where the
duration is incorrectly detected. In the 2 examples below ffmpeg
indicates the duration is 01:14:31.97, but the actual length is
02:15:53.30. This is confirmed by looking at the output from the
successful example 2 below:
{{{
$ ffmpeg -i mpeg-COPY-VA.vob 2>&1 | grep Duration
Duration: 02:15:53.30, start: 0.533367, bitrate: 5677 kb/s
}}}
Example 1 - copy 1 video, audio and subtitle stream - aborts:
{{{
$ ffmpeg -i mpeg.vob -map 0:0 -map 0:13 -map 0:8 -codec copy -f vob mpeg-
COPY-VAS.vob
ffmpeg version N-71325-g9c37c81 Copyright (c) 2000-2015 the FFmpeg
developers
built with gcc 4.5.1 (GCC) 20100924 (Red Hat 4.5.1-4)
configuration: --enable-gpl --enable-version3 --enable-nonfree
--disable-static --enable-shared --disable-debug --enable-libass --enable-
libfdk-aac --enable-libmp3lame --enable-libtheora --enable-libvorbis
--enable-libvpx --enable-libx264 --enable-x11grab
libavutil 54. 22.101 / 54. 22.101
libavcodec 56. 34.100 / 56. 34.100
libavformat 56. 30.100 / 56. 30.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 13.101 / 5. 13.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, mpeg, from 'mpeg.vob':
Duration: 01:14:31.97, start: 0.207756, bitrate: 12204 kb/s
Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, smpte170m),
720x480 [SAR 32:27 DAR 16:9], max. 9800 kb/s, 31.97 fps, 59.94 tbr, 90k
tbn, 59.94 tbc
Stream #0:1[0x20]: Subtitle: dvd_subtitle
Stream #0:2[0x21]: Subtitle: dvd_subtitle
Stream #0:3[0x22]: Subtitle: dvd_subtitle
Stream #0:4[0x23]: Subtitle: dvd_subtitle
Stream #0:5[0x24]: Subtitle: dvd_subtitle
Stream #0:6[0x25]: Subtitle: dvd_subtitle
Stream #0:7[0x26]: Subtitle: dvd_subtitle
Stream #0:8[0x27]: Subtitle: dvd_subtitle
Stream #0:9[0x28]: Subtitle: dvd_subtitle
Stream #0:10[0x29]: Subtitle: dvd_subtitle
Stream #0:11[0x2a]: Subtitle: dvd_subtitle
Stream #0:12[0x2b]: Subtitle: dvd_subtitle
Stream #0:13[0x80]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
Stream #0:14[0x81]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
Stream #0:15[0x82]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
Stream #0:16[0x83]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
Output #0, vob, to 'mpeg-COPY-VAS.vob':
Metadata:
encoder : Lavf56.30.100
Stream #0:0: Video: mpeg2video, yuv420p, 720x480 [SAR 32:27 DAR 16:9],
q=2-31, max. 9800 kb/s, 31.97 fps, 59.94 tbr, 90k tbn, 29.97 tbc
Stream #0:1: Audio: ac3, 48000 Hz, 5.1(side), 448 kb/s
Stream #0:2: Subtitle: dvd_subtitle
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:13 -> #0:1 (copy)
Stream #0:8 -> #0:2 (copy)
Press [q] to stop, [?] for help
[vob @ 0x9aa6860] Application provided invalid, non monotonically
increasing dts to muxer in stream 2: 307990683 >= 0
av_interleaved_write_frame(): Invalid argument
frame=88264 fps=548 q=-1.0 Lsize= 2547730kB time=01:01:21.37
bitrate=5669.3kbits/s
video:2314651kB audio:201325kB subtitle:24kB other streams:0kB global
headers:0kB muxing overhead: 1.261121%
Conversion failed!
}}}
Example 2 - copy 1 video and audio stream - finishes:
{{{
$ ffmpeg -i mpeg.vob -map 0:0 -map 0:13 -codec copy -f vob mpeg-COPY-
VA.vob
ffmpeg version N-71325-g9c37c81 Copyright (c) 2000-2015 the FFmpeg
developers
built with gcc 4.5.1 (GCC) 20100924 (Red Hat 4.5.1-4)
configuration: --enable-gpl --enable-version3 --enable-nonfree
--disable-static --enable-shared --disable-debug --enable-libass --enable-
libfdk-aac --enable-libmp3lame --enable-libtheora --enable-libvorbis
--enable-libvpx --enable-libx264 --enable-x11grab
libavutil 54. 22.101 / 54. 22.101
libavcodec 56. 34.100 / 56. 34.100
libavformat 56. 30.100 / 56. 30.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 13.101 / 5. 13.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, mpeg, from 'mpeg.vob':
Duration: 01:14:31.97, start: 0.207756, bitrate: 12204 kb/s
Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, smpte170m),
720x480 [SAR 32:27 DAR 16:9], max. 9800 kb/s, 31.97 fps, 59.94 tbr, 90k
tbn, 59.94 tbc
Stream #0:1[0x20]: Subtitle: dvd_subtitle
Stream #0:2[0x21]: Subtitle: dvd_subtitle
Stream #0:3[0x22]: Subtitle: dvd_subtitle
Stream #0:4[0x23]: Subtitle: dvd_subtitle
Stream #0:5[0x24]: Subtitle: dvd_subtitle
Stream #0:6[0x25]: Subtitle: dvd_subtitle
Stream #0:7[0x26]: Subtitle: dvd_subtitle
Stream #0:8[0x27]: Subtitle: dvd_subtitle
Stream #0:9[0x28]: Subtitle: dvd_subtitle
Stream #0:10[0x29]: Subtitle: dvd_subtitle
Stream #0:11[0x2a]: Subtitle: dvd_subtitle
Stream #0:12[0x2b]: Subtitle: dvd_subtitle
Stream #0:13[0x80]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
Stream #0:14[0x81]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
Stream #0:15[0x82]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
Stream #0:16[0x83]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
Output #0, vob, to 'mpeg-COPY-VA.vob':
Metadata:
encoder : Lavf56.30.100
Stream #0:0: Video: mpeg2video, yuv420p, 720x480 [SAR 32:27 DAR 16:9],
q=2-31, max. 9800 kb/s, 31.97 fps, 59.94 tbr, 90k tbn, 29.97 tbc
Stream #0:1: Audio: ac3, 48000 Hz, 5.1(side), 448 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:13 -> #0:1 (copy)
Press [q] to stop, [?] for help
[vob @ 0x8526700] Non-monotonous DTS in output stream 0:1; previous:
331320960, current: 331319487; changing to 331320961. This may result in
incorrect timestamps in the output file.
frame=195485 fps=458 q=-1.0 Lsize= 5651160kB time=02:15:53.29
bitrate=5678.0kbits/s
video:5135016kB audio:445886kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 1.258899%
}}}
Here's complete debug output for the input file used in the above
examples:
{{{
$ ffmpeg -v 9 -loglevel 99 -i mpeg.vob
ffmpeg version N-71325-g9c37c81 Copyright (c) 2000-2015 the FFmpeg
developers
built with gcc 4.5.1 (GCC) 20100924 (Red Hat 4.5.1-4)
configuration: --enable-gpl --enable-version3 --enable-nonfree
--disable-static --enable-shared --disable-debug --enable-libass --enable-
libfdk-aac --enable-libmp3lame --enable-libtheora --enable-libvorbis
--enable-libvpx --enable-libx264 --enable-x11grab
libavutil 54. 22.101 / 54. 22.101
libavcodec 56. 34.100 / 56. 34.100
libavformat 56. 30.100 / 56. 30.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 13.101 / 5. 13.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Splitting the commandline.
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 '-i' ... matched as input file with argument 'mpeg.vob'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Successfully parsed a group of options.
Parsing a group of options: input file mpeg.vob.
Successfully parsed a group of options.
Opening an input file: mpeg.vob.
[mpeg @ 0x825d2c0] Format mpeg probed with size=8192 and score=52
[mpeg @ 0x825d2c0] Before avformat_find_stream_info() pos: 0 bytes
read:32768 seeks:0
[mpeg @ 0x825d2c0] probing stream 0 pp:2500
[mpeg @ 0x825d2c0] Probe with size=2012, packets=1 detected mpegvideo with
score=25
[mpeg @ 0x825d2c0] probed stream 0
[mpeg @ 0x825d2c0] max_analyze_duration 5000000 reached at 5004667
microseconds
rfps: 23.916667 0.017421
rfps: 24.000000 0.011237
rfps: 60.000000 0.007633
rfps: 23.976024 0.009996
Last message repeated 1 times
rfps: 59.940060 0.000000
Last message repeated 1 times
[mpeg @ 0x825d2c0] After avformat_find_stream_info() pos: 0 bytes
read:2871440 seeks:2 frames:750
Input #0, mpeg, from 'mpeg.vob':
Duration: 01:14:31.97, start: 0.207756, bitrate: 12204 kb/s
Stream #0:0[0x1e0], 122, 1/90000: Video: mpeg2video (Main), 1
reference frame, yuv420p(tv, smpte170m, left), 720x480 [SAR 32:27 DAR
16:9], 1001/60000, max. 9800 kb/s, 31.97 fps, 59.94 tbr, 90k tbn, 59.94
tbc
Stream #0:1[0x20], 1, 1/90000: Subtitle: dvd_subtitle
Stream #0:2[0x21], 1, 1/90000: Subtitle: dvd_subtitle
Stream #0:3[0x22], 1, 1/90000: Subtitle: dvd_subtitle
Stream #0:4[0x23], 1, 1/90000: Subtitle: dvd_subtitle
Stream #0:5[0x24], 1, 1/90000: Subtitle: dvd_subtitle
Stream #0:6[0x25], 1, 1/90000: Subtitle: dvd_subtitle
Stream #0:7[0x26], 1, 1/90000: Subtitle: dvd_subtitle
Stream #0:8[0x27], 1, 1/90000: Subtitle: dvd_subtitle
Stream #0:9[0x28], 1, 1/90000: Subtitle: dvd_subtitle
Stream #0:10[0x29], 1, 1/90000: Subtitle: dvd_subtitle
Stream #0:11[0x2a], 1, 1/90000: Subtitle: dvd_subtitle
Stream #0:12[0x2b], 1, 1/90000: Subtitle: dvd_subtitle
Stream #0:13[0x80], 154, 1/90000: Audio: ac3, 48000 Hz, 5.1(side),
fltp, 448 kb/s
Stream #0:14[0x81], 154, 1/90000: Audio: ac3, 48000 Hz, stereo, fltp,
192 kb/s
Stream #0:15[0x82], 154, 1/90000: Audio: ac3, 48000 Hz, 5.1(side),
fltp, 384 kb/s
Stream #0:16[0x83], 154, 1/90000: Audio: ac3, 48000 Hz, 5.1(side),
fltp, 384 kb/s
Successfully opened the file.
At least one output file must be specified
[AVIOContext @ 0x825cae0] Statistics: 2871440 bytes read, 2 seek
}}}
--
Ticket URL: <https://trac.ffmpeg.org/ticket/4450>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list