Opened 7 years ago
Last modified 2 years ago
#8506 new defect
H.265 VA-API encoder changes video size on AMD cards
| Reported by: | tildearrow | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | avcodec |
| Version: | git-master | Keywords: | amf |
| Cc: | Blocked By: | ||
| Blocking: | Reproduced by developer: | no | |
| Analyzed by developer: | no |
Description
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.
Attachments (2)
Change History (7)
by , 7 years ago
| Attachment: | ffmpeg-20200201-151319.log added |
|---|
follow-up: 2 comment:1 by , 7 years ago
| Version: | 4.2 → unspecified |
|---|
Is this issue reproducible with current FFmpeg git head, the only version supported here?
comment:2 by , 7 years ago
| Version: | unspecified → git-master |
|---|
Replying to cehoyos:
Is this issue reproducible with current FFmpeg git head, the only version supported here?
Reproduces on master head too (d85c84eb38e5845495dacfcef82265a433fdd043 as of now).
comment:3 by , 7 years ago
| Keywords: | amf added |
|---|
comment:4 by , 7 years ago
Cannot be reproduced with iHD driver.
Since pic_width_in_luma_samples and pic_height_in_luma_samples are set in FFmpeg level, I tried with iHD driver, however it could not be reproduced. Doubt whether conformance_window_flag and conf_win_bottom_offset are set correctly in your case.
comment:5 by , 2 years ago
Hi, this issue appeared again half a year ago. This patch (https://patchwork.ffmpeg.org/project/ffmpeg/patch/20240321170219.1487-1-Primeadvice@gmail.com/) fixed it but it could no longer apply on ffmpeg 7.1.
This happens to AMD cards only, iHD is unaffected. But I have an AMD card without AV1 support, so the only options for me is H265 or H264 (the latter takes a lot more space).



Report