[FFmpeg-trac] #8506(avcodec:new): H.265 VA-API encoder changes video size on AMD cards

FFmpeg trac at avcodec.org
Sat Feb 1 22:16:57 EET 2020


#8506: H.265 VA-API encoder changes video size on AMD cards
------------------------------------+----------------------------------
             Reporter:  tildearrow  |                     Type:  defect
               Status:  new         |                 Priority:  normal
            Component:  avcodec     |                  Version:  4.2
             Keywords:              |               Blocked By:
             Blocking:              |  Reproduced by developer:  0
Analyzed by developer:  0           |
------------------------------------+----------------------------------
 Description:
 The H.265 VA-API encoder on an AMD card rounds the video size to a
 multiple of 16.
 As an example, a 1920x1080 video will be resized to 1920x1088.

 While the specs require the internal video size to be a multiple of 16,
 there is another "visible" video size which can be set arbitrarily (and
 hence allow for the 1920x1080 size).
 However, the AMD VA-API driver seems to be setting the "visible" size to
 the same value as the internal size. Therefore the size is wrong.

 Steps to Reproduce:
 1.
 {{{
 sudo env LIBVA_DRIVER_NAME=radeonsi ffmpeg -vaapi_device /dev/dri/card1 -f
 lavfi -i color=color=black:size=1920x1080 -t 0.04 -vf
 'format=nv12,hwupload' -c:v hevc_vaapi -qp 24 -y 1088.ts
 }}}
 This will generate a 1-frame video that apparently has a frame size of
 1920x1080.

 2.
 {{{
 $ ffprobe -i 1088.ts
 }}}
 This will check that the video really has a frame size of 1920x1080.

 -Expected Result-
 {{{
 ffprobe version n4.2.2 Copyright (c) 2007-2019 the FFmpeg developers
   built with gcc 9.2.0 (GCC)
   configuration: --prefix=/usr --disable-debug --disable-static --disable-
 stripping --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl
 --enable-ladspa --enable-libaom --enable-libass --enable-libbluray
 --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi
 --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx
 --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb
 --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-
 libpulse --enable-libsoxr --enable-libspeex --enable-libssh --enable-
 libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis
 --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265
 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-nvdec --enable-
 nvenc --enable-omx --enable-shared --enable-version3
   libavutil      56. 31.100 / 56. 31.100
   libavcodec     58. 54.100 / 58. 54.100
   libavformat    58. 29.100 / 58. 29.100
   libavdevice    58.  8.100 / 58.  8.100
   libavfilter     7. 57.100 /  7. 57.100
   libswscale      5.  5.100 /  5.  5.100
   libswresample   3.  5.100 /  3.  5.100
   libpostproc    55.  5.100 / 55.  5.100
 [mpegts @ 0x55aed1cd4c00] Format mpegts detected only with low score of 2,
 misdetection possible!
 Input #0, mpegts, from '1088.ts':
   Duration: 00:00:00.00, start: 1.400000, bitrate: 957090 kb/s
   Program 1
     Metadata:
       service_name    : Service01
       service_provider: FFmpeg
     Stream #0:0[0x100]: Video: hevc (Main) (HEVC / 0x43564548),
 yuv420p(tv), 1920x1080, 90k tbr, 90k tbn, 90k tbc
 }}}
 (look at 1920x1080)

 -Actual (Defective) Result-
 {{{
 ffprobe version n4.2.2 Copyright (c) 2007-2019 the FFmpeg developers
   built with gcc 9.2.0 (GCC)
   configuration: --prefix=/usr --disable-debug --disable-static --disable-
 stripping --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl
 --enable-ladspa --enable-libaom --enable-libass --enable-libbluray
 --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi
 --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx
 --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb
 --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-
 libpulse --enable-libsoxr --enable-libspeex --enable-libssh --enable-
 libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis
 --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265
 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-nvdec --enable-
 nvenc --enable-omx --enable-shared --enable-version3
   libavutil      56. 31.100 / 56. 31.100
   libavcodec     58. 54.100 / 58. 54.100
   libavformat    58. 29.100 / 58. 29.100
   libavdevice    58.  8.100 / 58.  8.100
   libavfilter     7. 57.100 /  7. 57.100
   libswscale      5.  5.100 /  5.  5.100
   libswresample   3.  5.100 /  3.  5.100
   libpostproc    55.  5.100 / 55.  5.100
 [mpegts @ 0x55aed1cd4c00] Format mpegts detected only with low score of 2,
 misdetection possible!
 Input #0, mpegts, from '1088.ts':
   Duration: 00:00:00.00, start: 1.400000, bitrate: 957090 kb/s
   Program 1
     Metadata:
       service_name    : Service01
       service_provider: FFmpeg
     Stream #0:0[0x100]: Video: hevc (Main) (HEVC / 0x43564548),
 yuv420p(tv), 1920x1088, 90k tbr, 90k tbn, 90k tbc
 }}}

 As you can see, the video has been resize to 1920x1088. This should not
 happen.

 Additional information:
 FFmpeg 4.2.2. Arch Linux.
 Radeon Vega FE. Mesa 19.3.3.
 Linux linux 5.4.10-rt5-1-rt #1 SMP PREEMPT_RT @1578738969 x86_64
 GNU/Linux.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/8506>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list