#6677 closed defect (fixed)

mpeg2 decoder always output some redundant dummy frames for interlace videos

Reported by: lizhong1008 Owned by:
Priority: important Component: avcodec
Version: git-master Keywords: mpeg2video regression
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description (last modified by cehoyos)

Summary of the bug:
If a mpeg2 video is a field video, ffmpeg will always insert a dummy frame when decoding the first key filed picture. And the dummy frame will be output later.
Take the attachment file (tcela-8-fp-dp.bits.mpeg2) as example, this clip has 4 frames (8 fields), but 5 frames will be output after decoding, the first output frame is a redundant dummy frame.

How to reproduce:

ffmpeg -i /root/Videos/yami_mpeg2/tcela-8-fp-dp.bits.mpeg2 -pix_fmt yuv420p /root/Videos/tcela-8-fp-dp.bits.mpeg_sw_720x480.yuv
ffmpeg version N-87349-g0426e77108 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 6.3.0 (Ubuntu 6.3.0-12ubuntu2) 20170406
  configuration: --prefix=/opt/X11R7/ --enable-vaapi --enable-libx264 --enable-libx265 --enable-gpl --disable-optimizations --enable-debug=3
  libavutil      55. 75.100 / 55. 75.100
  libavcodec     57.106.101 / 57.106.101
  libavformat    57. 82.101 / 57. 82.101
  libavdevice    57.  8.101 / 57.  8.101
  libavfilter     6.105.100 /  6.105.100
  libswscale      4.  7.103 /  4.  7.103
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
[mpegvideo @ 0x557bd94c37e0] Estimating duration from bitrate, this may be inaccurate
Input #0, mpegvideo, from '/root/Videos/yami_mpeg2/tcela-8-fp-dp.bits.mpeg2':
  Duration: 00:00:00.15, bitrate: 15000 kb/s
    Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, bottom first), 720x480 [SAR 8:9 DAR 4:3], 15000 kb/s, 30 fps, 30 tbr, 1200k tbn, 60 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video (native) -> rawvideo (native))
Press [q] to stop, [?] for help
Output #0, rawvideo, to '/root/Videos/tcela-8-fp-dp.bits.mpeg_sw_720x480.yuv':
    encoder         : Lavf57.82.101
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 720x480 [SAR 8:9 DAR 4:3], q=2-31, 124416 kb/s, 30 fps, 30 tbn, 30 tbc
      encoder         : Lavc57.106.101 rawvideo
frame=    5 fps=0.0 q=-0.0 Lsize=    2531kB time=00:00:00.16 bitrate=124415.8kbits/s speed=18.1x
video:2531kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%

Attachments (2)

tcela-8-fp-dp.bits.mpeg2 (281.1 KB) - added by lizhong1008 10 months ago.
sony-ct1.bits.mpeg2 (674.7 KB) - added by lizhong1008 10 months ago.

Download all attachments as: .zip

Change History (11)

Changed 10 months ago by lizhong1008

Changed 10 months ago by lizhong1008

comment:1 Changed 10 months ago by cehoyos

  • Description modified (diff)
  • Keywords mpeg2video regression added; mpeg2 decoder removed
  • Priority changed from normal to important
  • Reproduced by developer set
  • Status changed from new to open

Regression since 99e07a4453732058df90885f80b3db3b4f37cb3c, I wonder if there is a relation with #3690 (which shows another commit but also grey frames).

comment:4 Changed 10 months ago by lizhong1008

Yes, it is a regression. I am plan to revert the commit of 99e07a4453732058df90885f80b3db3b4f37cb3c, but I can't get the clip of issue #2367 this commit try to fix.

comment:3 Changed 10 months ago by lizhong1008

Last edited 10 months ago by lizhong1008 (previous) (diff)

comment:5 Changed 10 months ago by lizhong1008

I prefer to revert 99e07a4453732058df90885f80b3db3b4f37cb3c directly, since the sample clip ofinterlaced_mpeg2.bin is detected as wrong input and doesn't make ffmpeg crash right now.

comment:6 Changed 10 months ago by cehoyos

I can confirm that reverting 99e07a4 the crash with the given sample was fixed in 23daee0dcc57b647b9d62d4c905e94acf0c6b8e0

comment:7 Changed 10 months ago by lizhong1008

Patch has been sent to review.

comment:8 Changed 10 months ago by cehoyos

  • Resolution set to fixed
  • Status changed from open to closed

Fixed in fd7cb86468cc63b5bda203d74964584281318cda - thank you for the report and the fix!

Note: See TracTickets for help on using tickets.