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%
Reproducible with