Opened 2 months ago

Last modified 2 months ago

#11164 new defect

visual macroblock error with mpeg2video encoding

Reported by: dave rice Owned by:
Priority: normal Component: avcodec
Version: 6.1.1 Keywords: mpeg2video
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by dave rice)

Summary of the bug:

I've been using ffmpeg to create XDCam QuickTime files and found a regression or change in going from ffmpeg 5 to 6.

The simplest command I can create to demonstrate this problem is below. The ffmpeg@5 output looks fine and represents the input well, the ffmpeg@6 output shows some abundant macroblock errors.

How to reproduce:

This ffmpeg@5 output looks okay:

% ffmpeg -y -i input_that_creates_visual_error_with_ffmpeg6_but_not_5.mp4 -c:v mpeg2video -non_linear_quant 1 -qmin 1 -pix_fmt yuv422p -vtag xd5b -q:v 1 -qmax 8 good.mov
ffmpeg version 5.1.2 Copyright (c) 2000-2022 the FFmpeg developers
  built with Apple clang version 13.0.0 (clang-1300.0.29.30)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/5.1.2_6 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input_that_creates_visual_error_with_ffmpeg6_but_not_5.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf59.27.100
  Duration: 00:00:02.04, start: 0.000000, bitrate: 5301 kb/s
  Stream #0:0[0x1](eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080, 2982 kb/s, 23.98 fps, 23.98 tbr, 24k tbn (default)
    Metadata:
      handler_name    : ?Mainconcept Video Media Handler
      vendor_id       : [0][0][0][0]
      encoder         : AVC Coding
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> mpeg2video (native))
Press [q] to stop, [?] for help
Output #0, mov, to 'good.mov':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf59.27.100
  Stream #0:0(eng): Video: mpeg2video (4:2:2) (xd5b / 0x62356478), yuv422p(tv, bt709, progressive), 1920x1080, q=2-31, 200 kb/s, 23.98 fps, 24k tbn (default)
    Metadata:
      handler_name    : ?Mainconcept Video Media Handler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc59.37.100 mpeg2video
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
frame=   49 fps=0.0 q=1.0 Lsize=    5382kB time=00:00:01.96 bitrate=22491.4kbits/s speed=11.2x    
video:5381kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.019745%

This ffmpeg@6 output has visual artifacts.

% ffmpeg -y -i input_that_creates_visual_error_with_ffmpeg6_but_not_5.mp4 -c:v mpeg2video -non_linear_quant 1 -qmin 1 -pix_fmt yuv422p -vtag xd5b -q:v 1 -qmax 8 good.mov
ffmpeg version 6.1.2 Copyright (c) 2000-2024 the FFmpeg developers
  built with Apple clang version 14.0.0 (clang-1400.0.29.202)
  configuration: --prefix='/opt/homebrew/Cellar/ffmpeg@6/6.1.2_1' --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopenvino --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox --enable-neon
  libavutil      58. 29.100 / 58. 29.100
  libavcodec     60. 31.102 / 60. 31.102
  libavformat    60. 16.100 / 60. 16.100
  libavdevice    60.  3.100 / 60.  3.100
  libavfilter     9. 12.100 /  9. 12.100
  libswscale      7.  5.100 /  7.  5.100
  libswresample   4. 12.100 /  4. 12.100
  libpostproc    57.  3.100 / 57.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input_that_creates_visual_error_with_ffmpeg6_but_not_5.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf59.27.100
  Duration: 00:00:02.04, start: 0.000000, bitrate: 5301 kb/s
  Stream #0:0[0x1](eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080, 2982 kb/s, 23.98 fps, 23.98 tbr, 24k tbn (default)
    Metadata:
      handler_name    : ?Mainconcept Video Media Handler
      vendor_id       : [0][0][0][0]
      encoder         : AVC Coding
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> mpeg2video (native))
Press [q] to stop, [?] for help
Output #0, mov, to 'good.mov':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf60.16.100
  Stream #0:0(eng): Video: mpeg2video (4:2:2) (xd5b / 0x62356478), yuv422p(tv, bt709, progressive), 1920x1080, q=2-31, 200 kb/s, 23.98 fps, 24k tbn (default)
    Metadata:
      handler_name    : ?Mainconcept Video Media Handler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc60.31.102 mpeg2video
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
[out#0/mov @ 0x13fe04e70] video:5414kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.019627%
frame=   49 fps=0.0 q=1.0 Lsize=    5415kB time=00:00:01.96 bitrate=22627.3kbits/s speed=14.8x 

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Attachments (1)

input_that_creates_visual_error_with_ffmpeg6_but_not_5.mp4 (1.3 MB ) - added by dave rice 2 months ago.
input_that_creates_visual_error_with_ffmpeg6_but_not_5

Download all attachments as: .zip

Change History (4)

by dave rice, 2 months ago

input_that_creates_visual_error_with_ffmpeg6_but_not_5

comment:1 by dave rice, 2 months ago

Description: modified (diff)

comment:2 by Balling, 2 months ago

I cannot see any artifacts on ffmpeg master on windows.

Version 0, edited 2 months ago by Balling (next)

comment:3 by Marton Balint, 2 months ago

I can't really reproduce this on linux, neither with 6.1.2, nor with git master. You should try to narrow down what causes this (e.g. try git master, and options such as -threads 1, -cpuflags 0)...

Note: See TracTickets for help on using tickets.