id	summary	reporter	owner	description	type	status	priority	component	version	resolution	keywords	cc	blockedby	blocking	reproduced	analyzed
960	h264 in ts: non monotonically increasing dts	aurelien		"I have a sample : H.264/AAC wrapped in MPEG-TS whith cannot be transcoded (or copy using -vcodec copy) using ffmpeg-git.

jupiter@~/ffmpeg> ./ffmpeg -y -i /tmp/sample-non-monotonic-dts.ts -an -vcodec copy -f mpegts /dev/null
ffmpeg version N-37401-g151ecc2 Copyright (c) 2000-2012 the FFmpeg developers
  built on Jan 31 2012 12:54:08 with gcc 4.6.2
  configuration: --prefix=/home/aurelien/local --enable-postproc --enable-nonfree --enable-gpl --enable-libopencore-amrnb --enable-libfaac --enable-libmp3lame --enable-shared --enable-libxvid --enable-libx264 --extra-cflags=-I/home/aurelien/local/include --extra-ldflags=-L/home/aurelien/local/lib --enable-version3 --disable-optimizations
  libavutil      51. 36.100 / 51. 36.100
  libavcodec     54.  0.102 / 54.  0.102
  libavformat    54.  0.100 / 54.  0.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 60.100 /  2. 60.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  6.100 /  0.  6.100
  libpostproc    52.  0.100 / 52.  0.100
[mpegts @ 0xda43a0] max_analyze_duration 5000000 reached at 5000000
[mpegts @ 0xda43a0] PES packet size mismatch
Input #0, mpegts, from '/tmp/sample-non-monotonic-dts.ts':
  Duration: 00:01:08.67, start: 0.500011, bitrate: 2189 kb/s
  Program 1 
    Stream #0:0[0x3e8]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p, 720x576 [SAR 16:11 DAR 20:11], 50 fps, 50 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x1e2](fra): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16, 192 kb/s (clean effects)
[mpegts @ 0xdab3e0] muxrate VBR, pcr every 2 pkts, sdt every 200, pat/pmt every 40 pkts
Output #0, mpegts, to '/dev/null':
  Metadata:
    encoder         : Lavf54.0.100
    Stream #0:0: Video: h264 ([27][0][0][0] / 0x001B), yuv420p, 720x576 [SAR 16:11 DAR 20:11], q=2-31, 50 fps, 90k tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[mpegts @ 0xdab3e0] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 23399 >= 23399
av_interleaved_write_frame(): Invalid argument

It does not work with ffmpeg version shipped with Debian Squeeze either.

jupiter@~> ffmpeg -y -i /tmp/sample-non-monotonic-dts.ts -an -vcodec copy -f mpegts /dev/null
FFmpeg version SVN-r0.5.6-4:0.5.6-3, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration: --extra-version=4:0.5.6-3 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libdirac --enable-libgsm --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping --disable-vhook --enable-runtime-cpudetect --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libfaad --enable-libdc1394 --enable-shared --disable-static
  libavutil     49.15. 0 / 49.15. 0
  libavcodec    52.20. 1 / 52.20. 1
  libavformat   52.31. 0 / 52.31. 0
  libavdevice   52. 1. 0 / 52. 1. 0
  libavfilter    0. 4. 0 /  0. 4. 0
  libswscale     0. 7. 1 /  0. 7. 1
  libpostproc   51. 2. 0 / 51. 2. 0
  built on Dec 31 2011 16:14:46, gcc: 4.4.5
Input #0, mpegts, from '/tmp/sample-non-monotonic-dts.ts':
  Duration: 00:01:08.67, start: 0.500022, bitrate: 2189 kb/s
  Program 1 
    Stream #0.0[0x3e8]: Video: h264, yuv420p, 720x576 [PAR 16:11 DAR 20:11], 50 tbr, 90k tbn, 50 tbc
    Stream #0.1[0x1e2](fra): Audio: mp2, 48000 Hz, stereo, s16, 192 kb/s
Output #0, mpegts, to '/dev/null':
    Stream #0.0: Video: 0x0000, yuv420p, 720x576 [PAR 16:11 DAR 20:11], q=2-31, 90k tbn, 25 tbc
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop encoding
[mpegts @ 0x170b870]dts < pcr, TS is invalid
    Last message repeated 220 times
[NULL @ 0x170a710]error, non monotone timestamps 23398 >= 23398
av_interleaved_write_frame(): Error while opening file

Sample name : sample-non-monotonic-dts.ts (uploaded on upload.ffmpeg.org)

Here are two frames taken from the sample :

NEW DATA
        PID : 1000
        Size : 5280
        PTS : 81000
        DTS : 68400
NEW DATA
        PID : 1000
        Size : 1072
        PTS : 68400
        DTS : no value

I guess the problem is the second frame has pts=dts=68400 which is also the dts of the previous frame though I don't know if the sample is valid regarding ISO 13818-1.
"	defect	closed	normal	undetermined	git-master	invalid	av_interleaved_write_frame h264 ts				1	1
