Opened 15 months ago

Last modified 12 months ago

#10099 new defect

mpeg2_vaapi SAR problems

Reported by: Liroy2003 Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: mpeg2_vaapi vaapi sar
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug: When using mpeg2_vaapi to transcode a 720p UDP multicast stream to i576 UDP multicast stream the SAR is giving some errors:

[mpeg2_vaapi @ 0x55ad1ffdae40] Driver does not support some wanted packed headers (wanted 0x3, found 0x10).
[mpeg2_vaapi @ 0x55ad1ffdae40] Sample aspect ratio 64:45 is not representable, signalling square pixels instead.

When using other mpeg2 encoders like mpeg2video or mpeg2_qsv the SAR is fine.

How to reproduce:

% /usr/bin/ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i "udp://239.200.101.6:1234fifo_size=1000000&overrun_nonfatal=1" -vf 'scale_vaapi=w=720:h=576,deinterlace_vaapi' -c:v mpeg2_vaapi -b:v 5000k -maxrate 5000k -minrate 5000k -muxrate 6000k -pcr_period 40 -flags:v +ildct+ilme -top 0 -aspect 16:9 -c:a mp2 -b:a 192k -f mpegts "udp://239.123.123.2:1234?pkt_size=1316&bitrate=12000000"

ffmpeg version 5.1.2-0ubuntu1~20.04.sav1.1 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  configuration: --prefix=/usr --extra-version='0ubuntu1~20.04.sav1.1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-lcms2 --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-sndio --enable-pocketsphinx --enable-librsvg --enable-libdav1d --enable-libjxl --enable-librist --enable-libvmaf --enable-libzimg --enable-crystalhd --enable-libmfx --enable-libsvtav1 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared
  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

tried different ffmpeg version on ubuntu and centos


Output when using mpeg2_vaapi:
/usr/bin/ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i "udp://239.200.101.6:1234fifo_size=1000000&overrun_nonfatal=1" -vf 'scale_vaapi=w=720:h=576,deinterlace_vaapi' -c:v mpeg2_vaapi -b:v 5000k -maxrate 5000k -minrate 5000k -muxrate 6000k -pcr_period 40 -flags:v +ildct+ilme -top 0 -aspect 16:9 -c:a mp2 -b:a 192k -f mpegts "udp://239.123.123.2:1234?pkt_size=1316&bitrate=12000000"
Input #0, mpegts, from 'udp://239.200.101.6:1234fifo_size=1000000&overrun_nonfatal=1':
  Duration: N/A, start: 95378.437922, bitrate: N/A
  Program 10302
    Metadata:
      service_name    : arte HD
      service_provider: ARD
  Stream #0:1[0x13f7]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 50 fps, 50 tbr, 90k tbn
  Stream #0:2[0x13f8](deu): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s
  Stream #0:3[0x13fa](deu): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006), 492x250
  No Program
  Stream #0:0[0x12]: Data: epg
Stream mapping:
  Stream #0:1 -> #0:0 (h264 (native) -> mpeg2video (mpeg2_vaapi))
  Stream #0:2 -> #0:1 (mp2 (native) -> mp2 (native))
Press [q] to stop, [?] for help
[h264 @ 0x55ad201ee780] co located POCs unavailable
[h264 @ 0x55ad20304540] mmco: unref short failure
[h264 @ 0x55ad20304540] number of reference frames (0+5) exceeds max (4; probably corrupt input), discarding one
[h264 @ 0x55ad201ee780] mmco: unref short failure
[mpeg2_vaapi @ 0x55ad1ffdae40] Driver does not support some wanted packed headers (wanted 0x3, found 0x10).
[mpeg2_vaapi @ 0x55ad1ffdae40] Sample aspect ratio 64:45 is not representable, signalling square pixels instead.
Output #0, mpegts, to 'udp://239.123.123.2:1234?pkt_size=1316&bitrate=12000000#':
  Metadata:
    encoder         : Lavf59.27.100
  Stream #0:0: Video: mpeg2video (Main), vaapi(tv, bt709, bottom first), 720x576 [SAR 64:45 DAR 16:9], q=2-31, 5000 kb/s, 50 fps, 90k tbn
    Metadata:
      encoder         : Lavc59.37.100 mpeg2_vaapi
  Stream #0:1(deu): Audio: mp2, 48000 Hz, stereo, s16, 192 kb/s
    Metadata:
      encoder         : Lavc59.37.100 mp2
frame=  828 fps= 61 q=-0.0 Lsize=   12848kB time=00:00:17.50 bitrate=6014.4kbits/s speed=1.28x
video:10275kB audio:402kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 20.336689%

Output when using mpeg2video:
/usr/bin/ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i "udp://239.200.101.6:1234fifo_size=1000000&overrun_nonfatal=1" -vf 'scale_vaapi=w=720:h=576,deinterlace_vaapi,hwdownload' -c:v mpeg2video -b:v 5000k -maxrate 5000k -minrate 5000k -muxrate 6000k -pcr_period 40 -flags:v +ildct+ilme -top 0 -aspect 16:9 -c:a mp2 -b:a 192k -f mpegts "udp://239.123.123.2:1234?pkt_size=1316&bitrate=12000000"
Input #0, mpegts, from 'udp://239.200.101.6:1234fifo_size=1000000&overrun_nonfatal=1':
  Duration: N/A, start: 95320.077922, bitrate: N/A
  Program 10302
    Metadata:
      service_name    : arte HD
      service_provider: ARD
  Stream #0:1[0x13f7]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 50 fps, 50 tbr, 90k tbn
  Stream #0:2[0x13f8](deu): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s
  Stream #0:3[0x13fa](deu): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006), 492x250
  No Program
  Stream #0:0[0x12]: Data: epg
Stream mapping:
  Stream #0:1 -> #0:0 (h264 (native) -> mpeg2video (native))
  Stream #0:2 -> #0:1 (mp2 (native) -> mp2 (native))
Press [q] to stop, [?] for help
[h264 @ 0x55dca5d1a380] co located POCs unavailable
[h264 @ 0x55dca64714c0] mmco: unref short failure
[h264 @ 0x55dca64714c0] number of reference frames (0+5) exceeds max (4; probably corrupt input), discarding one
[h264 @ 0x55dca5d1a380] mmco: unref short failure
[mpeg2video @ 0x55dca5c98ec0] Automatically choosing VBV buffer size of 224 kbyte
Output #0, mpegts, to 'udp://239.123.123.2:1234?pkt_size=1316&bitrate=12000000':
  Metadata:
    encoder         : Lavf59.27.100
  Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, bt709, bottom first), 720x576 [SAR 64:45 DAR 16:9], q=2-31, 5000 kb/s, 50 fps, 90k tbn
    Metadata:
      encoder         : Lavc59.37.100 mpeg2video
    Side data:
      cpb: bitrate max/min/avg: 5000000/5000000/5000000 buffer size: 1835008 vbv_delay: N/A
  Stream #0:1(deu): Audio: mp2, 48000 Hz, stereo, s16, 192 kb/s
    Metadata:
      encoder         : Lavc59.37.100 mp2
frame= 1559 fps= 54 q=2.5 Lsize=   23775kB time=00:00:32.44 bitrate=6003.9kbits/s speed=1.13x

Attachments (2)

mpeg2_vaapi.PNG (1.6 MB ) - added by Liroy2003 15 months ago.
mpeg2video.PNG (1.4 MB ) - added by Liroy2003 15 months ago.

Change History (7)

by Liroy2003, 15 months ago

Attachment: mpeg2_vaapi.PNG added

by Liroy2003, 15 months ago

Attachment: mpeg2video.PNG added

comment:1 by Liroy2003, 15 months ago

Version: unspecified5.1.2

comment:2 by Carl Eugen Hoyos, 15 months ago

Version: 5.1.2unspecified

Why do you think this is an issue that can be fixed within FFmpeg?
Please test current FFmpeg git head to make this a valid ticket.

comment:3 by Liroy2003, 14 months ago

Ok i tested with the newest version:

ffmpeg version N-109510-g6e05622216 Copyright (c) 2000-2023 the FFmpeg developers

built with gcc 11 (Ubuntu 11.3.0-1ubuntu1~22.04)
configuration: --prefix=/home/ntv/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/ntv/ffmpeg_build/include --extra-ldflags=-L/home/ntv/ffmpeg_build/lib --extra-libs='-lpthread -lm' --ld=g++ --bindir=/home/ntv/bin --enable-gpl --enable-gnutls --enable-libfdk-aac --enable-libfreetype --enable-libx264 --enable-libx265 --enable-nonfree
libavutil 57. 43.100 / 57. 43.100
libavcodec 59. 56.100 / 59. 56.100
libavformat 59. 34.102 / 59. 34.102
libavdevice 59. 8.101 / 59. 8.101
libavfilter 8. 53.100 / 8. 53.100
libswscale 6. 8.112 / 6. 8.112
libswresample 4. 9.100 / 4. 9.100
libpostproc 56. 7.100 / 56. 7.100

Hyper fast Audio and Video encoder

same result:

[mpeg2_vaapi @ 0x55de9e57c640] Driver does not support some wanted packed headers (wanted 0x3, found 0x10).
[mpeg2_vaapi @ 0x55de9e57c640] Sample aspect ratio 64:45 is not representable, signalling square pixels instead.

comment:4 by Fei Wang, 12 months ago

What's your hardware platform? It works for me on Intel i7-8700K by using Intel media-driver.

comment:5 by Liroy2003, 12 months ago

I tested on a i7 10700k, i will try on a different system!

Note: See TracTickets for help on using tickets.