Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#418 closed defect (fixed)

mpegts demux provides invalid dts when reading from stdin

Reported by: Martin Blech Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: mpegts non monotonically increasing dts pipe stdin
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

FFmpeg fails demultiplexing an mpegts stream when piped to stdin:

$ cat file_ok_pipe_fails_nonmonotonically.ts | ffmpeg -f mpegts -i - -acodec copy -f mp2 -map 0.25 /tmp/test0.25.mp2 -acodec copy -f mp2 -map 0.26 /tmp/test0.26.mp2 -acodec copy -f mp2 -map 0.16 /tmp/test0.16.mp2 -acodec copy -f mp2 -map 0.18 /tmp/test0.18.mp2 -acodec copy -f mp2 -map 0.24 /tmp/test0.24.mp2 -acodec copy -f mp2 -map 0.22 /tmp/test0.22.mp2 -acodec copy -f mp2 -map 0.19 /tmp/test0.19.mp2 -acodec copy -f mp2 -map 0.4 /tmp/test0.4.mp2 -acodec copy -f mp2 -map 0.1 /tmp/test0.1.mp2 -acodec copy -f mp2 -map 0.11 /tmp/test0.11.mp2 -acodec copy -f mp2 -map 0.36 /tmp/test0.36.mp2 -acodec copy -f mp2 -map 0.9 /tmp/test0.9.mp2 -acodec copy -f mp2 -map 0.21 /tmp/test0.21.mp2 -acodec copy -f mp2 -map 0.38 /tmp/test0.38.mp2
ffmpeg version 0.8, Copyright (c) 2000-2011 the FFmpeg developers
  built on Aug  2 2011 13:29:26 with gcc 4.2.1 (Apple Inc. build 5666) (dot 3)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/0.8 --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libxvid
  libavutil    51.  9. 1 / 51.  9. 1
  libavcodec   53.  7. 0 / 53.  7. 0
  libavformat  53.  4. 0 / 53.  4. 0
  libavdevice  53.  1. 1 / 53.  1. 1
  libavfilter   2. 23. 0 /  2. 23. 0
  libswscale    2.  0. 0 /  2.  0. 0
  libpostproc  51.  2. 0 / 51.  2. 0
(...)
[mpegts @ 0x101807c00] Estimating duration from bitrate, this may be inaccurate
Input #0, mpegts, from 'pipe:':
  Duration: N/A, start: 10560.007333, bitrate: 130500 kb/s
  Program 10068 
    Metadata:
      service_name    : EXTREMADURA TV
      service_provider: Telefonica Spain
    Stream #0.12[0x579]: Video: mpeg2video (Main), yuv420p, 720x576 [PAR 16:15 DAR 4:3], 15000 kb/s, 43.75 fps, 25 tbr, 90k tbn, 50 tbc
(...)
Output #0, mp2, to '/tmp/test0.25.mp2':
  Metadata:
    encoder         : Lavf53.4.0
    Stream #0.0: Audio: mp2, 48000 Hz, stereo, 128 kb/s
(...)
Stream mapping:
  Stream #0.25 -> #0.0
  Stream #0.26 -> #1.0
  Stream #0.16 -> #2.0
  Stream #0.18 -> #3.0
  Stream #0.24 -> #4.0
  Stream #0.22 -> #5.0
  Stream #0.19 -> #6.0
  Stream #0.4 -> #7.0
  Stream #0.1 -> #8.0
  Stream #0.11 -> #9.0
  Stream #0.36 -> #10.0
  Stream #0.9 -> #11.0
  Stream #0.21 -> #12.0
  Stream #0.38 -> #13.0
[mp2 @ 0x10187f400] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 4106889285 >= 4106889285
av_interleaved_write_frame(): Invalid argument

However, the same stream can be demuxed correctly when read directly from the file:

$ ffmpeg -f mpegts -i file_ok_pipe_fails_nonmonotonically.ts -acodec copy -f mp2 -map 0.27 /tmp/test0.27.mp2 -acodec copy -f mp2 -map 0.19 /tmp/test0.19.mp2 -acodec copy -f mp2 -map 0.17 /tmp/test0.17.mp2 -acodec copy -f mp2 -map 0.21 /tmp/test0.21.mp2 -acodec copy -f mp2 -map 0.26 /tmp/test0.26.mp2 -acodec copy -f mp2 -map 0.24 /tmp/test0.24.mp2 -acodec copy -f mp2 -map 0.8 /tmp/test0.8.mp2 -acodec copy -f mp2 -map 0.5 /tmp/test0.5.mp2 -acodec copy -f mp2 -map 0.1 /tmp/test0.1.mp2 -acodec copy -f mp2 -map 0.15 /tmp/test0.15.mp2 -acodec copy -f mp2 -map 0.18 /tmp/test0.18.mp2 -acodec copy -f mp2 -map 0.37 /tmp/test0.37.mp2 -acodec copy -f mp2 -map 0.23 /tmp/test0.23.mp2 -acodec copy -f mp2 -map 0.20 /tmp/test0.20.mp2
ffmpeg version 0.8, Copyright (c) 2000-2011 the FFmpeg developers
  built on Aug  2 2011 13:29:26 with gcc 4.2.1 (Apple Inc. build 5666) (dot 3)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/0.8 --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libxvid
  libavutil    51.  9. 1 / 51.  9. 1
  libavcodec   53.  7. 0 / 53.  7. 0
  libavformat  53.  4. 0 / 53.  4. 0
  libavdevice  53.  1. 1 / 53.  1. 1
  libavfilter   2. 23. 0 /  2. 23. 0
  libswscale    2.  0. 0 /  2.  0. 0
  libpostproc  51.  2. 0 / 51.  2. 0
(...)
[NULL @ 0x101894800] start time is not set in av_estimate_timings_from_pts
Input #0, mpegts, from 'file_ok_pipe_fails_nonmonotonically.ts':
  Duration: 23:31:49.95, start: 10559.767333, bitrate: 0 kb/s
  Program 10068 
    Metadata:
      service_name    : EXTREMADURA TV
      service_provider: Telefonica Spain
    Stream #0.9[0x579]: Video: mpeg2video (Main), yuv420p, 720x576 [PAR 16:15 DAR 4:3], 15000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0.27[0x57a]: Audio: mp2, 48000 Hz, stereo, s16, 128 kb/s
(...)
Output #0, mp2, to '/tmp/test0.27.mp2':
  Metadata:
    encoder         : Lavf53.4.0
    Stream #0.0: Audio: mp2, 48000 Hz, stereo, 128 kb/s
(...)
Stream mapping:
  Stream #0.27 -> #0.0
  Stream #0.19 -> #1.0
  Stream #0.17 -> #2.0
  Stream #0.21 -> #3.0
  Stream #0.26 -> #4.0
  Stream #0.24 -> #5.0
  Stream #0.8 -> #6.0
  Stream #0.5 -> #7.0
  Stream #0.1 -> #8.0
  Stream #0.15 -> #9.0
  Stream #0.18 -> #10.0
  Stream #0.37 -> #11.0
  Stream #0.23 -> #12.0
  Stream #0.20 -> #13.0
Press [q] to stop, [?] for help
size=      16kB time=00:00:01.10 bitrate= 118.3kbits/s    
video:0kB audio:296kB global headers:0kB muxing overhead -94.630231%

Attachments (4)

file_ok.log (13.5 KB ) - added by Martin Blech 13 years ago.
pipe_fails.log (13.4 KB ) - added by Martin Blech 13 years ago.
file_ok_pipe_fails_nonmonotonically.ts.splitaa (2.4 MB ) - added by Martin Blech 13 years ago.
file_ok_pipe_fails_nonmonotonically.ts.splitab (1.9 MB ) - added by Martin Blech 13 years ago.

Change History (8)

by Martin Blech, 13 years ago

Attachment: file_ok.log added

by Martin Blech, 13 years ago

Attachment: pipe_fails.log added

comment:1 by Carl Eugen Hoyos, 13 years ago

Reproduced by developer: set
Status: newopen
Version: 0.8.1git-master

Reproducible with

cat file_ok_pipe_fails_nonmonotonically.ts.splitaa | ffmpeg -i - -acodec copy out.mp2

comment:2 by Martin Blech, 13 years ago

Using -mp3 instead of -mp2 still gives the non monotonically increasing dts warning but not the av_interleaved_write_frame(): Invalid argument error. The output mp3 files sound correct.

[mp3 @ 0x10184f000] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 4106889285 >= 4106889285
[mp3 @ 0x101894600] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 4167 >= 4167
[mp3 @ 0x10187de00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 1690509186 >= 1690509186
[mp3 @ 0x101878400] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 4106771601 >= 4106771601
[mp3 @ 0x10188ec00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 5808049886 >= 5808049886
[mp3 @ 0x1018f0000] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 4718011066 >= 4718011066
[mp3 @ 0x101889200] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 3816877344 >= 3816877344
[mp3 @ 0x101868e00] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 7623749504 >= 7623749504
[mp3 @ 0x101946600] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 1340267596 >= 1340267596
size=      12kB time=00:00:01.05 bitrate=  90.2kbits/s    
video:0kB audio:220kB global headers:0kB muxing overhead -94.714099%

comment:3 by Carl Eugen Hoyos, 13 years ago

Resolution: fixed
Status: openclosed

The specific test case should be fixed.

comment:4 by Martin Blech, 13 years ago

wow that was fast. thanks!

Note: See TracTickets for help on using tickets.