Opened 11 years ago
Closed 11 years ago
#3743 closed enhancement (fixed)
mpeg2video decoder loses frames when progressive_sequence flag flips
Reported by: | SianLiao | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avcodec |
Version: | git-master | Keywords: | mpeg2video regression |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | yes | |
Analyzed by developer: | no |
Description
Summary of the bug:
In mpeg2video streams where progressive_sequence flag flips, one-frame will be lost due to context reinitialized in mpeg_decode_postinit call
Without entering the initialization block the otherwise lost frame is decoded correctly.
(ffmpeg binary causes a duplicate frame in that position when decoding)
How to reproduce:
Decode an mpeg2 stream with progressive_sequence flipping ffmpeg version 2.2.1 and prior
Attachments (1)
Change History (6)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
The file (too big to attach, 13 MB) is uploaded to upload.ffmpeg.org under filename 3743_mpeg_progressive_seq_flip.avi
Running ffmpeg decoder will cause "1 dup!", failing to decode a frame and therefore the frames 19 and 20 will be identical.
The frame otherwise is decodable, if no context reinit happens in the code as described above.
./ffmpeg -i 3743_mpeg_progressive_seq_flip.avi -loglevel verbose -y -an -f image2 "imgs/img_%05d.jpg" ffmpeg version N-64226-g7e8fdf0 Copyright (c) 2000-2014 the FFmpeg developers built on Jun 26 2014 19:28:40 with Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn) configuration: --disable-optimizations --disable-stripping --enable-debug=3 libavutil 52. 90.101 / 52. 90.101 libavcodec 55. 68.100 / 55. 68.100 libavformat 55. 44.100 / 55. 44.100 libavdevice 55. 13.101 / 55. 13.101 libavfilter 4. 9.100 / 4. 9.100 libswscale 2. 6.100 / 2. 6.100 libswresample 0. 19.100 / 0. 19.100 Input #0, avi, from '3743_mpeg_progressive_seq_flip.avi': Metadata: encoder : Lavf55.33.100 Duration: 00:00:02.21, start: 0.000000, bitrate: 50237 kb/s Stream #0:0: Video: mpeg2video (4:2:2) (mpg2 / 0x3267706D), yuv422p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 51233 kb/s, 50 fps, 25 tbr, 50 tbn, 50 tbc Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, mono, s16p, 64 kb/s [graph 0 input from stream 0:0 @ 0x7fa7585003a0] w:1920 h:1080 pixfmt:yuv422p tb:1/50 fr:25/1 sar:1/1 sws_param:flags=2 [auto-inserted scaler 0 @ 0x7fa758500de0] w:iw h:ih flags:'0x4' interl:0 [format @ 0x7fa758500980] auto-inserting filter 'auto-inserted scaler 0' between the filter 'Parsed_null_0' and the filter 'format' [swscaler @ 0x7fa759000600] deprecated pixel format used, make sure you did set range correctly [auto-inserted scaler 0 @ 0x7fa758500de0] w:1920 h:1080 fmt:yuv422p sar:1/1 -> w:1920 h:1080 fmt:yuvj422p sar:1/1 flags:0x4 [image2 @ 0x7fa758825a00] Using AVStream.codec.time_base as a timebase hint to the muxer is deprecated. Set AVStream.time_base instead. Output #0, image2, to 'imgs/img_%05d.jpg': Metadata: encoder : Lavf55.44.100 Stream #0:0: Video: mjpeg, yuvj422p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc Metadata: encoder : Lavc55.68.100 mjpeg Stream mapping: Stream #0:0 -> #0:0 (mpeg2video (native) -> mjpeg (native)) Press [q] to stop, [?] for help *** 1 dup! *** 1 dup!9 fps=0.0 q=18.0 size=N/A time=00:00:00.36 bitrate=N/A dup=1 drop=0 No more output streams to write to, finishing.:02.16 bitrate=N/A dup=2 drop=0 frame= 56 fps= 20 q=24.8 Lsize=N/A time=00:00:02.24 bitrate=N/A dup=2 drop=0 video:4148kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown Input file #0 (3743_mpeg_progressive_seq_flip.avi): Input stream #0:0 (video): 55 packets read (13833108 bytes); 54 frames decoded; Input stream #0:1 (audio): 31 packets read (5952 bytes); Total: 86 packets (13839060 bytes) demuxed Output file #0 (imgs/img_%05d.jpg): Output stream #0:0 (video): 56 frames encoded; 56 packets muxed (4247491 bytes); Total: 56 packets (4247491 bytes) muxed
by , 11 years ago
Attachment: | 3743_mpeg_progressive_seq_flip.m2v added |
---|
comment:3 by , 11 years ago
Keywords: | mpeg2video regression added; mpeg removed |
---|---|
Priority: | normal → important |
Reproduced by developer: | set |
Status: | new → open |
Regression since 0127b861
The attached sample outputs four frames for older FFmpeg versions, the third frame is missing since that change.
$ ffmpeg -vsync 0 -i 3743_mpeg_progressive_seq_flip.m2v -f framecrc - ffmpeg version N-64228-g057d270 Copyright (c) 2000-2014 the FFmpeg developers built on Jun 26 2014 20:00:52 with gcc 4.7 (SUSE Linux) configuration: --enable-gpl libavutil 52. 90.101 / 52. 90.101 libavcodec 55. 68.100 / 55. 68.100 libavformat 55. 44.100 / 55. 44.100 libavdevice 55. 13.101 / 55. 13.101 libavfilter 4. 9.100 / 4. 9.100 libswscale 2. 6.100 / 2. 6.100 libswresample 0. 19.100 / 0. 19.100 libpostproc 52. 3.100 / 52. 3.100 Input #0, mpegvideo, from '3743_mpeg_progressive_seq_flip.m2v': Duration: N/A, bitrate: N/A Stream #0:0: Video: mpeg2video (4:2:2), yuv422p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], max. 50000 kb/s, 25 fps, 25 tbr, 1200k tbn, 50 tbc [framecrc @ 0x2430060] Using AVStream.codec.time_base as a timebase hint to the muxer is deprecated. Set AVStream.time_base instead. #software: Lavf55.44.100 #tb 0: 1/25 Output #0, framecrc, to 'pipe:': Metadata: encoder : Lavf55.44.100 Stream #0:0: Video: rawvideo (Y42B / 0x42323459), yuv422p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc Metadata: encoder : Lavc55.68.100 rawvideo Stream mapping: Stream #0:0 -> #0:0 (mpeg2video (native) -> rawvideo (native)) Press [q] to stop, [?] for help 0, 3, 3, 1, 4147200, 0x4af40956 0, 4, 4, 1, 4147200, 0x468d0927 0, 6, 6, 1, 4147200, 0x32961317 frame= 3 fps=0.0 q=0.0 Lsize= 0kB time=00:00:00.28 bitrate= 6.0kbits/s video:12150kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
comment:4 by , 11 years ago
Priority: | important → normal |
---|---|
Type: | defect → enhancement |
the progressive sequence flag isnt allowed to change in mpeg, thus this is a bug in the used encoder.
Where is this file from ?
mpeg2: In repeat sequence headers all of the data elements with the permitted exception of those defining the quantisation matrices (load_intra_quantiser_matrix, load_non_intra_quantiser_matrix and optionally intra_quantiser_matrix and non_intra_quantiser_matrix) shall have the same values as in the first sequence header. The quantisation matrices may be redefined each time that a sequence header occurs in the bitstream (Note that quantisation matrices may also be updated using quant_matrix_extension()). All of the data elements in the sequence_extension() that follows a repeat sequence_header() shall have the same values as in the first sequence_extension(). If a sequence_scalable_extension() occurs after the first sequence_header() all subsequent sequence headers shall be followed by sequence_scalable_extension() in which all data elements are the same as in the first sequence_scalable_extension().
comment:5 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | open → closed |
Please test current FFmpeg git head and provide your failing command line (the command that doesn't produce the expected output) together with the complete, uncut console output and please upload a sample to make this a valid ticket.