Opened 5 years ago

Closed 7 weeks ago

#3572 closed defect (fixed)

failure to remux h264 from mkv with pts < dts error

Reported by: bubbleguuum Owned by:
Priority: normal Component: ffmpeg
Version: git-master Keywords: mkv h264 av_interleaved_write_frame dts
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

This problematic mkv used in the command line belwos was recorded by TVheadend off Satellite on a UK HD (BBC) channel.

The 5MB sample can be downloaded here: http://bubblesoftapps.com/tmp/ToyStory2.2014-04-13.20-00-sample.mkv

The command line attempt to keep the h264 stream (copy) and convert the mp2 audio track to mp3.

It fails with a pts < dts error, generating a very short 100Kb file.

If the h264 is transcoded to h264 instead of just copied, it works.

So there seems to be a problem keeping the original video track while transcoding the audio track.

How to reproduce:

% $ ffmpeg -y  -i ToyStory2.2014-04-13.20-00-sample.mkv -map 0:0 -c:0 copy -map 0:1 -c:1 libmp3lame -ac:1 2 -b:1 320k test.mkv
ffmpeg version N-62475-g256f530 Copyright (c) 2000-2014 the FFmpeg developers
  built on Apr 15 2014 22:01:57 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 76.100 / 52. 76.100
  libavcodec     55. 58.103 / 55. 58.103
  libavformat    55. 37.100 / 55. 37.100
  libavdevice    55. 13.100 / 55. 13.100
  libavfilter     4.  4.100 /  4.  4.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
[h264 @ 02ca0360] mmco: unref short failure
    Last message repeated 4 times
[h264 @ 02ca0360] number of reference frames (0+5) exceeds max (4; probably corrupt input), discarding one
Input #0, matroska,webm, from 'ToyStory2.2014-04-13.20-00-sample.mkv':
  Metadata:
    title           : Toy Story 2
    encoder         : Tvheadend Matroska muxer
    DATE_BROADCASTED: 2014-04-13 20:00:00
    ORIGINAL_MEDIA_TYPE: TV
    CONTENT_TYPE    : Movie / Drama
    TVCHANNEL       : BBC Three HD
    SUMMARY         : Animated comedy. When Woody is kidnapped, Buzz Lightyear and the other toys set out in hot pursuit. However, when they find him they discover him in a new life, with new friends. [1999] [AD,S]
    SUMMARY-eng     : Animated comedy. When Woody is kidnapped, Buzz Lightyear and the other toys set out in hot pursuit. However, when they find him they discover him in a new life, with new friends. [1999] [AD,S]
  Duration: 01:42:05.14, start: 0.005000, bitrate: 6 kb/s
    Stream #0:0(eng): Video: h264 (High), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 1k tbn, 50 tbc (default)
    Stream #0:1(nar): Audio: mp2, 48000 Hz, stereo, s16p, 256 kb/s (default)
    Stream #0:2(eng): Subtitle: dvb_subtitle (default)
    Stream #0:3(eng): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s (default)
    Stream #0:4(eng): Subtitle: subrip (default)
Output #0, matroska, to 'test.mkv':
  Metadata:
    title           : Toy Story 2
    SUMMARY-eng     : Animated comedy. When Woody is kidnapped, Buzz Lightyear and the other toys set out in hot pursuit. However, when they find him they discover him in a new life, with new friends. [1999] [AD,S]
    DATE_BROADCASTED: 2014-04-13 20:00:00
    ORIGINAL_MEDIA_TYPE: TV
    CONTENT_TYPE    : Movie / Drama
    TVCHANNEL       : BBC Three HD
    SUMMARY         : Animated comedy. When Woody is kidnapped, Buzz Lightyear and the other toys set out in hot pursuit. However, when they find him they discover him in a new life, with new friends. [1999] [AD,S]
    encoder         : Lavf55.37.100
    Stream #0:0(eng): Video: h264 (H264 / 0x34363248), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 1k tbn, 1k tbc (default)
    Stream #0:1(nar): Audio: mp3 (libmp3lame) (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p, 320 kb/s (default)
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (mp2 -> libmp3lame)
Press [q] to stop, [?] for help
[matroska @ 04d5a9e0] pts (155) < dts (255) in stream 0
av_interleaved_write_frame(): Invalid argument
[libmp3lame @ 04d05f80] Trying to remove 1152 samples, but the queue is empty
[matroska @ 04d5a9e0] Encoder did not produce proper pts, making some up.
frame=    3 fps=0.0 q=-1.0 Lsize=      93kB time=00:00:00.23 bitrate=3231.7kbits/s
video:109kB audio:1kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Change History (3)

comment:1 Changed 5 years ago by cehoyos

  • Keywords av_interleaved_write_frame dts added
  • Reproduced by developer set
  • Status changed from new to open
  • Summary changed from failure to remux mkv to mkv with pts < dts error to failure to remux h264 from mkv with pts < dts error
  • Version changed from unspecified to git-master

http://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket3572/

$ ffmpeg -i ToyStory2.2014-04-13.20-00-sample.mkv -vcodec copy -an -f null -
ffmpeg version N-62495-g197fe39 Copyright (c) 2000-2014 the FFmpeg developers
  built on Apr 17 2014 14:39:19 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl
  libavutil      52. 76.100 / 52. 76.100
  libavcodec     55. 58.103 / 55. 58.103
  libavformat    55. 37.100 / 55. 37.100
  libavdevice    55. 13.100 / 55. 13.100
  libavfilter     4.  4.100 /  4.  4.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
[h264 @ 0x3552a40] mmco: unref short failure
    Last message repeated 4 times
[h264 @ 0x3552a40] number of reference frames (0+5) exceeds max (4; probably corrupt input), discarding one
Input #0, matroska,webm, from 'ToyStory2.2014-04-13.20-00-sample.mkv':
  Metadata:
    title           : Toy Story 2
    encoder         : Tvheadend Matroska muxer
    DATE_BROADCASTED: 2014-04-13 20:00:00
    ORIGINAL_MEDIA_TYPE: TV
    CONTENT_TYPE    : Movie / Drama
    TVCHANNEL       : BBC Three HD
    SUMMARY         : Animated comedy. When Woody is kidnapped, Buzz Lightyear and the other toys set out in hot pursuit. However, when they find him they discover him in a new life, with new friends. [1999] [AD,S]
    SUMMARY-eng     : Animated comedy. When Woody is kidnapped, Buzz Lightyear and the other toys set out in hot pursuit. However, when they find him they discover him in a new life, with new friends. [1999] [AD,S]
  Duration: 01:42:05.14, start: 0.005000, bitrate: 6 kb/s
    Stream #0:0(eng): Video: h264 (High), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 1k tbn, 50 tbc (default)
    Stream #0:1(nar): Audio: mp2, 48000 Hz, stereo, s16p, 256 kb/s (default)
    Stream #0:2(eng): Subtitle: dvb_subtitle (default)
    Stream #0:3(eng): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s (default)
    Stream #0:4(eng): Subtitle: subrip (default)
Output #0, null, to 'pipe:':
  Metadata:
    title           : Toy Story 2
    SUMMARY-eng     : Animated comedy. When Woody is kidnapped, Buzz Lightyear and the other toys set out in hot pursuit. However, when they find him they discover him in a new life, with new friends. [1999] [AD,S]
    DATE_BROADCASTED: 2014-04-13 20:00:00
    ORIGINAL_MEDIA_TYPE: TV
    CONTENT_TYPE    : Movie / Drama
    TVCHANNEL       : BBC Three HD
    SUMMARY         : Animated comedy. When Woody is kidnapped, Buzz Lightyear and the other toys set out in hot pursuit. However, when they find him they discover him in a new life, with new friends. [1999] [AD,S]
    encoder         : Lavf55.37.100
    Stream #0:0(eng): Video: h264, yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 90k tbn, 1k tbc (default)
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[null @ 0x38f9d00] pts (13950) < dts (22950) in stream 0
[null @ 0x38f9d00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 21150 >= 10350
[null @ 0x38f9d00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 21150 >= 13950
[null @ 0x38f9d00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 21150 >= 17550
[null @ 0x38f9d00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 21150 >= 21150
[null @ 0x38f9d00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 100350 >= 96750
[matroska,webm @ 0x3550c20] Read error
frame=  162 fps=0.0 q=-1.0 Lsize=N/A time=00:00:06.43 bitrate=N/A
video:15kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 118613321539649536.000000%

comment:2 Changed 5 years ago by cehoyos

  • Keywords mkv h264 added

comment:3 Changed 7 weeks ago by cehoyos

  • Component changed from undetermined to ffmpeg
  • Resolution set to fixed
  • Status changed from open to closed

Remuxing of this sample was fixed in 22844132069ebd2c0b2ac4e7b41c93c33890bfb9

Note: See TracTickets for help on using tickets.