Incorrect limitation in kernel prevents VCN4.0 from encoding 8K HEVC
Brief summary of the problem:
Using the hevc_vaapi
encoder in ffmpeg
to encode video at 7680x4320 resolution (or any video height higher than 2304) on Radeon 780M/gfx1103
, ffmpeg
fails and reports that this resolution is not supported.
The kernel driver reports support for VCN4.0 HEVC encode up to 4096x2304 instead of 8192x4352.
/* SOC21 */
static const struct amdgpu_video_codec_info vcn_4_0_0_video_codecs_encode_array_vcn0[] = {
{codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 2304, 0)},
{codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 4096, 2304, 0)},
{codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_AV1, 8192, 4352, 0)},
};
static const struct amdgpu_video_codec_info vcn_4_0_0_video_codecs_encode_array_vcn1[] = {
{codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC, 4096, 2304, 0)},
{codec_info_build(AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC, 4096, 2304, 0)},
};
But the specifications indicate that VCN4.0 supports 4320p HEVC encoding.
Max Video Encode Bandwidth (SDR)
1080p630 8bpc H.264
1440p373 8bpc H.264
2160p175 8bpc H.264
1080p630 8bpc H.265
1440p373 8bpc H.265
2160p175 8bpc H.265
4320p43 8bpc H.265
1080p864 8/10bpc AV1
1440p513 8/10bpc AV1
2160p240 8/10bpc AV1
4320p60 8/10bpc AV1
Hardware description:
- GPU: Radeon 780M/gfx1103
System information:
- AMD Radeon Graphics (gfx1103_r1, LLVM 15.0.6, DRM 3.57, 6.8.0-rc3)
How to reproduce the issue:
ffmpeg -vaapi_device /dev/dri/renderD128 \
-f lavfi -i testsrc2=s=7680x4320,format=nv12 \
-vf hwupload -c:v hevc_vaapi -b:v 20M -vframes 1000 -y /tmp/8k-hevc.mp4
Log files (for system lockups / game freezes / crashes)
[hevc_vaapi @ 0x5565e27c180] Hardware does not support encoding at size 7680x4320 (constraints: width 256-4096 height 128-2304).
[vost#0:0/hevc_vaapi @ 0x5565e2e7c80] Error initializing output stream: Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Edited by nyanmisaka