Opened 10 years ago
Last modified 6 years ago
#4005 open enhancement
Support transport streams with changing pid
Reported by: | Underground78 | Owned by: | |
---|---|---|---|
Priority: | wish | Component: | avformat |
Version: | git-master | Keywords: | mpegts |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | yes | |
Analyzed by developer: | no |
Description
Summary of the bug:
This sample file is only played for about 30s instead of about 2min when using VLC.
How to reproduce:
% ffmpeg -i 00000002_4_0.ts 00000002_4_0.mp4 ffmpeg version N-66595-g1c4c78e Copyright (c) 2000-2014 the FFmpeg developers built on Oct 3 2014 22:01:53 with gcc 4.9.1 (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-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --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-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-zlib libavutil 54. 9.100 / 54. 9.100 libavcodec 56. 2.101 / 56. 2.101 libavformat 56. 7.104 / 56. 7.104 libavdevice 56. 1.100 / 56. 1.100 libavfilter 5. 1.102 / 5. 1.102 libswscale 3. 1.100 / 3. 1.100 libswresample 1. 1.100 / 1. 1.100 libpostproc 53. 1.100 / 53. 1.100 [mpeg2video @ 0035f300] Invalid frame dimensions 0x0. Last message repeated 4 times Input #0, mpegts, from '00000002_4_0.ts': Duration: N/A, start: 57938.389556, bitrate: N/A Program 1 Stream #0:0[0x46](eng): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 192 kb/s Stream #0:1[0x47]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv), 704x576 [SAR 16:11 DAR 16:9], max. 15000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc [libx264 @ 0411f900] using SAR=16/11 [libx264 @ 0411f900] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX [libx264 @ 0411f900] profile High, level 3.0 [libx264 @ 0411f900] 264 - core 142 r2479 dd79a61 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 Output #0, mp4, to 'test.mp4': Metadata: encoder : Lavf56.7.104 Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 704x576 [SAR 16:11 DAR 16:9], q=-1--1, 25 fps, 12800 tbn, 25 tbc Metadata: encoder : Lavc56.2.101 libx264 Stream #0:1(eng): Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, s16, 128 kb/s Metadata: encoder : Lavc56.2.101 libvo_aacenc Stream mapping: Stream #0:1 -> #0:0 (mpeg2video (native) -> h264 (libx264)) Stream #0:0 -> #0:1 (mp2 (native) -> aac (libvo_aacenc)) Press [q] to stop, [?] for help frame= 98 fps=0.0 q=28.0 size= 568kB time=00:00:03.91 bitrate=1186.5kbits/s dup=8 drop=0 frame= 159 fps=156 q=28.0 size= 1245kB time=00:00:06.37 bitrate=1600.5kbits/s dup=8 drop=0 frame= 227 fps=149 q=28.0 size= 1610kB time=00:00:09.08 bitrate=1452.1kbits/s dup=8 drop=0 frame= 287 fps=141 q=28.0 size= 2252kB time=00:00:11.49 bitrate=1605.1kbits/s dup=8 drop=0 frame= 349 fps=137 q=28.0 size= 2738kB time=00:00:13.98 bitrate=1603.2kbits/s dup=8 drop=0 [mpeg2video @ 04f405c0] ac-tex damaged at 34 4 [mpeg2video @ 04f405c0] Warning MVs not available [mpeg2video @ 04f405c0] concealing 44 DC, 44 AC, 44 MV errors in I frame frame= 420 fps=138 q=28.0 size= 3294kB time=00:00:16.80 bitrate=1605.9kbits/s dup=8 drop=0 frame= 477 fps=135 q=28.0 size= 3945kB time=00:00:19.08 bitrate=1693.2kbits/s dup=8 drop=0 frame= 543 fps=134 q=28.0 size= 4484kB time=00:00:21.73 bitrate=1690.2kbits/s dup=8 drop=0 frame= 660 fps=145 q=28.0 size= 4855kB time=00:00:26.40 bitrate=1506.4kbits/s dup=8 drop=0 [mpegts @ 0035ec40] New audio stream 0:2 at pos:11205400 and DTS:57967.3s [mpegts @ 0035ec40] New video stream 0:3 at pos:11234916 and DTS:57968.2s [mpegts @ 0035ec40] PES packet size mismatch Last message repeated 2 times [mp2 @ 04f40060] incomplete frame Error while decoding stream #0:0: Invalid data found when processing input frame= 705 fps=136 q=-1.0 Lsize= 5426kB time=00:00:28.12 bitrate=1580.6kbits/s dup=10 drop=0 video:4965kB audio:439kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.398772% [libx264 @ 0411f900] frame I:10 Avg QP:20.37 size: 41416 [libx264 @ 0411f900] frame P:348 Avg QP:24.21 size: 10953 [libx264 @ 0411f900] frame B:347 Avg QP:26.93 size: 2472 [libx264 @ 0411f900] consecutive B-frames: 21.4% 34.3% 13.6% 30.6% [libx264 @ 0411f900] mb I I16..4: 10.1% 77.9% 12.0% [libx264 @ 0411f900] mb P I16..4: 5.2% 13.1% 1.0% P16..4: 38.8% 14.2% 7.0% 0.0% 0.0% skip:20.8% [libx264 @ 0411f900] mb B I16..4: 0.2% 0.5% 0.0% B16..8: 39.7% 4.2% 0.8% direct: 1.5% skip:53.0% L0:40.2% L1:49.5% BI:10.3% [libx264 @ 0411f900] 8x8 transform intra:69.1% inter:78.8% [libx264 @ 0411f900] coded y,uvDC,uvAC intra: 51.9% 58.3% 22.2% inter: 18.0% 17.5% 2.6% [libx264 @ 0411f900] i16 v,h,dc,p: 31% 43% 8% 17% [libx264 @ 0411f900] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 19% 33% 3% 3% 4% 3% 5% 3% [libx264 @ 0411f900] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 25% 13% 4% 5% 7% 5% 7% 3% [libx264 @ 0411f900] i8c dc,h,v,p: 50% 21% 24% 5% [libx264 @ 0411f900] Weighted P-Frames: Y:7.5% UV:7.2% [libx264 @ 0411f900] ref P L0: 66.1% 16.8% 12.8% 4.1% 0.1% [libx264 @ 0411f900] ref B L0: 85.1% 13.4% 1.5% [libx264 @ 0411f900] ref B L1: 94.9% 5.1% [libx264 @ 0411f900] kb/s:1442.07
Change History (4)
comment:1 by , 10 years ago
Component: | undetermined → avformat |
---|---|
Keywords: | mpegts added |
Priority: | normal → wish |
Reproduced by developer: | set |
Status: | new → open |
Summary: | TS file partially decoded → Support transport streams with changing pid |
Type: | defect → enhancement |
comment:2 by , 10 years ago
I think the issue is only in ffmpeg/ffplay.
They both discards packets that belong to dynamically discovered streams.
For the file of this bug, e.g., ffmpeg can be "fixed" by doing the following:
diff --git a/ffmpeg.c b/ffmpeg.c index 077207f..616b7e3 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -3383,7 +3383,7 @@ static int process_input(int file_index) dynamically in stream : we ignore them */ if (pkt.stream_index >= ifile->nb_streams) { report_new_stream(file_index, &pkt); - goto discard_packet; + pkt.stream_index %= ifile->nb_streams; } ist = input_streams[ifile->ist_index + pkt.stream_index];
I'd be tempted to change the component(s) to ffmpeg/ffplay.
comment:3 by , 10 years ago
I wonder if it shouldn't be possible to tell libavformat that I want the (all) audio and video streams of a specific program.
I will upload a sample that in the beginning has one audio and one video stream which are mapped from two programs and later on has different video (and audio) streams for the two programs one of which uses the old pids: I suspect your solution would not allow to choose the program that starts with one pid but switches later on.
comment:4 by , 6 years ago
Works now with -merge_pmt_versions 1
, additional sample provided by JEEB uploaded.
One way of showing the issue is the following command line: