[FFmpeg-trac] #11618(ffmpeg:new): hwupload filter fails with "Cannot allocate memory" for VA-API on AMD RX 7900 XT (Navi 31) preventing H.264/HEVC hardware encoding initialization.
FFmpeg
trac at avcodec.org
Sun Jun 1 00:13:19 EEST 2025
#11618: hwupload filter fails with "Cannot allocate memory" for VA-API on AMD RX
7900 XT (Navi 31) preventing H.264/HEVC hardware encoding initialization.
----------------------------------+----------------------------------
Reporter: CN | Type: defect
Status: new | Priority: normal
Component: ffmpeg | Version: 7.1
Keywords: hwupload | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
----------------------------------+----------------------------------
Summary of the bug: Fails to encode video files on Radeon hardware with
various methods. Gemini says 'The problem is not necessarily with the
h264_vaapi or hevc_vaapi encoder itself, but with the hwupload filter
failing to allocate memory on your VA-API device. This is a lower-level
issue than just a pixel format or encoder parameter problem.
This "Cannot allocate memory" error for hwupload when dealing with VA-API
on AMD GPUs (especially newer ones like Navi 3x) can indicate several
things'
How to reproduce:
{{{
see logs for versions and examples below:
}}}
--- FFmpeg Bug Report Log ---
Generated on: Sat 31 May 22:00:14 BST 2025
--- 1. vainfo output ---
Command: vainfo --display drm --device /dev/dri/renderD128
Trying display: drm
vainfo: VA-API version: 1.22 (libva 2.22.0)
vainfo: Driver version: Mesa Gallium driver 25.1.1-arch1.2 for AMD Radeon
RX 7900 XT (radeonsi, navi31, LLVM 19.1.7, DRM 3.61, 6.14.7-arch2-1)
vainfo: Supported profile and entrypoints
VAProfileH264ConstrainedBaseline: VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
VAProfileH264Main : VAEntrypointVLD
VAProfileH264Main : VAEntrypointEncSlice
VAProfileH264High : VAEntrypointVLD
VAProfileH264High : VAEntrypointEncSlice
VAProfileHEVCMain : VAEntrypointVLD
VAProfileHEVCMain : VAEntrypointEncSlice
VAProfileHEVCMain10 : VAEntrypointVLD
VAProfileHEVCMain10 : VAEntrypointEncSlice
VAProfileJPEGBaseline : VAEntrypointVLD
VAProfileVP9Profile0 : VAEntrypointVLD
VAProfileVP9Profile2 : VAEntrypointVLD
VAProfileAV1Profile0 : VAEntrypointVLD
VAProfileAV1Profile0 : VAEntrypointEncSlice
VAProfileNone : VAEntrypointVideoProc
--- 2. pacman -Q mesa output ---
Command: pacman -Q mesa
mesa 1:25.1.1-2
--- 3. uname -r output (Kernel Version) ---
Command: uname -r
6.14.7-arch2-1
--- 4. lspci -k | grep -EA3 'VGA|3D|Display' output (GPU Info) ---
Command: lspci -k | grep -EA3 'VGA|3D|Display'
lspci: Unable to load libkmod resources: error -2
0b:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI]
Navi 31 [Radeon RX 7900 XT/7900 XTX/7900 GRE/7900M] (rev cc)
Subsystem: Sapphire Technology Limited PULSE RX 7900 XTX
Kernel driver in use: amdgpu
0b:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Navi 31
HDMI/DP Audio
--- 5. FFmpeg Version and Configuration ---
Command: ffmpeg -version
ffmpeg version n7.1.1 Copyright (c) 2000-2025 the FFmpeg developers
built with gcc 15.1.1 (GCC) 20250425
configuration: --prefix=/usr --disable-debug --disable-static --disable-
stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto
--enable-fontconfig --enable-frei0r --enable-gmp --enable-gnutls --enable-
gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray
--enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libdvdnav
--enable-libdvdread --enable-libfreetype --enable-libfribidi --enable-
libglslang --enable-libgsm --enable-libharfbuzz --enable-libiec61883
--enable-libjack --enable-libjxl --enable-libmodplug --enable-libmp3lame
--enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg
--enable-libopenmpt --enable-libopus --enable-libplacebo --enable-libpulse
--enable-librav1e --enable-librsvg --enable-librubberband --enable-
libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-
libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-
libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpl --enable-
libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb
--enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq
--enable-nvdec --enable-nvenc --enable-opencl --enable-opengl --enable-
shared --enable-vapoursynth --enable-version3 --enable-vulkan
libavutil 59. 39.100 / 59. 39.100
libavcodec 61. 19.101 / 61. 19.101
libavformat 61. 7.100 / 61. 7.100
libavdevice 61. 3.100 / 61. 3.100
libavfilter 10. 4.100 / 10. 4.100
libswscale 8. 3.100 / 8. 3.100
libswresample 5. 3.100 / 5. 3.100
libpostproc 58. 3.100 / 58. 3.100
--- 6. Output of the failing synthetic FFmpeg command ---
Command: ffmpeg -v debug -init_hw_device vaapi=va:/dev/dri/renderD128 -f
lavfi -i testsrc=s=1280x720:r=30:d=5 -vf
'hwupload=derive_device=va,format=nv12' -c:v h264_vaapi -qp 24 -y
output_test_synthetic.mp4
ffmpeg version n7.1.1 Copyright (c) 2000-2025 the FFmpeg developers
built with gcc 15.1.1 (GCC) 20250425
configuration: --prefix=/usr --disable-debug --disable-static --disable-
stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto
--enable-fontconfig --enable-frei0r --enable-gmp --enable-gnutls --enable-
gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray
--enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libdvdnav
--enable-libdvdread --enable-libfreetype --enable-libfribidi --enable-
libglslang --enable-libgsm --enable-libharfbuzz --enable-libiec61883
--enable-libjack --enable-libjxl --enable-libmodplug --enable-libmp3lame
--enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg
--enable-libopenmpt --enable-libopus --enable-libplacebo --enable-libpulse
--enable-librav1e --enable-librsvg --enable-librubberband --enable-
libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-
libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-
libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpl --enable-
libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb
--enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq
--enable-nvdec --enable-nvenc --enable-opencl --enable-opengl --enable-
shared --enable-vapoursynth --enable-version3 --enable-vulkan
libavutil 59. 39.100 / 59. 39.100
libavcodec 61. 19.101 / 61. 19.101
libavformat 61. 7.100 / 61. 7.100
libavdevice 61. 3.100 / 61. 3.100
libavfilter 10. 4.100 / 10. 4.100
libswscale 8. 3.100 / 8. 3.100
libswresample 5. 3.100 / 5. 3.100
libpostproc 58. 3.100 / 58. 3.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with
argument 'debug'.
Reading option '-init_hw_device' ... matched as option 'init_hw_device'
(initialise hardware device) with argument 'vaapi=va:/dev/dri/renderD128'.
Reading option '-f' ... matched as option 'f' (force container format
(auto-detected otherwise)) with argument 'lavfi'.
Reading option '-i' ... matched as input url with argument
'testsrc=s=1280x720:r=30:d=5'.
Reading option '-vf' ... matched as option 'vf' (alias for -filter:v
(apply filters to video streams)) with argument
'hwupload=derive_device=va,format=nv12'.
Reading option '-c:v' ... matched as option 'c' (select encoder/decoder
('copy' to copy stream without reencoding)) with argument 'h264_vaapi'.
Reading option '-qp' ... matched as AVOption 'qp' with argument '24'.
Reading option '-y' ... matched as option 'y' (overwrite output files)
with argument '1'.
Reading option 'output_test_synthetic.mp4' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument debug.
Applying option init_hw_device (initialise hardware device) with argument
vaapi=va:/dev/dri/renderD128.
[AVHWDeviceContext @ 0x562c9170b800] libva: VA-API version 1.22.0
[AVHWDeviceContext @ 0x562c9170b800] libva: Trying to open
/usr/lib/dri/radeonsi_drv_video.so
[AVHWDeviceContext @ 0x562c9170b800] libva: Found init function
__vaDriverInit_1_22
[AVHWDeviceContext @ 0x562c9170b800] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x562c9170b800] Initialised VAAPI connection: version
1.22
[AVHWDeviceContext @ 0x562c9170b800] Format 0x3231564e -> nv12.
[AVHWDeviceContext @ 0x562c9170b800] Format 0x30313050 -> p010le.
[AVHWDeviceContext @ 0x562c9170b800] Format 0x32313050 -> p012le.
[AVHWDeviceContext @ 0x562c9170b800] Format 0x36313050 -> unknown.
[AVHWDeviceContext @ 0x562c9170b800] Format 0x30323449 -> yuv420p.
[AVHWDeviceContext @ 0x562c9170b800] Format 0x32315659 -> yuv420p.
[AVHWDeviceContext @ 0x562c9170b800] Format 0x56595559 -> unknown.
[AVHWDeviceContext @ 0x562c9170b800] Format 0x32595559 -> yuyv422.
[AVHWDeviceContext @ 0x562c9170b800] Format 0x59565955 -> uyvy422.
[AVHWDeviceContext @ 0x562c9170b800] Format 0x30303859 -> gray.
[AVHWDeviceContext @ 0x562c9170b800] Format 0x50343434 -> yuv444p.
[AVHWDeviceContext @ 0x562c9170b800] Format 0x56323234 -> yuv440p.
[AVHWDeviceContext @ 0x562c9170b800] Format 0x50424752 -> unknown.
[AVHWDeviceContext @ 0x562c9170b800] Format 0x41524742 -> bgra.
[AVHWDeviceContext @ 0x562c9170b800] Format 0x41424752 -> rgba.
[AVHWDeviceContext @ 0x562c9170b800] Format 0x42475241 -> argb.
[AVHWDeviceContext @ 0x562c9170b800] Format 0x58524742 -> bgr0.
[AVHWDeviceContext @ 0x562c9170b800] Format 0x58424752 -> rgb0.
[AVHWDeviceContext @ 0x562c9170b800] Format 0x30335241 -> unknown.
[AVHWDeviceContext @ 0x562c9170b800] Format 0x30334241 -> unknown.
[AVHWDeviceContext @ 0x562c9170b800] Format 0x30335258 -> x2rgb10le.
[AVHWDeviceContext @ 0x562c9170b800] Format 0x30334258 -> unknown.
[AVHWDeviceContext @ 0x562c9170b800] VAAPI driver: Mesa Gallium driver
25.1.1-arch1.2 for AMD Radeon RX 7900 XT (radeonsi, navi31, LLVM 19.1.7,
DRM 3.61, 6.14.7-arch2-1).
[AVHWDeviceContext @ 0x562c9170b800] Driver not found in known nonstandard
list, using standard behaviour.
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url testsrc=s=1280x720:r=30:d=5.
Applying option f (force container format (auto-detected otherwise)) with
argument lavfi.
Successfully parsed a group of options.
Opening an input file: testsrc=s=1280x720:r=30:d=5.
[AVFilterGraph @ 0x562c91915cc0] Setting 's' to value '1280x720'
[AVFilterGraph @ 0x562c91915cc0] Setting 'r' to value '30'
[AVFilterGraph @ 0x562c91915cc0] Setting 'd' to value '5'
detected 16 logical cores
[Parsed_testsrc_0 @ 0x562c91918d80] size:1280x720 rate:30/1
duration:5.000000 sar:1/1
[AVFilterGraph @ 0x562c91915cc0] query_formats: 2 queried, 3 merged, 0
already done, 0 delayed
[lavfi @ 0x562c91915900] All info found
Input #0, lavfi, from 'testsrc=s=1280x720:r=30:d=5':
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0, 1, 1/30: Video: wrapped_avframe, 1 reference frame, rgb24,
1280x720 [SAR 1:1 DAR 16:9], 0/1, 30 fps, 30 tbr, 30 tbn
Successfully opened the file.
Parsing a group of options: output url output_test_synthetic.mp4.
Applying option vf (alias for -filter:v (apply filters to video streams))
with argument hwupload=derive_device=va,format=nv12.
Applying option c:v (select encoder/decoder ('copy' to copy stream without
reencoding)) with argument h264_vaapi.
Successfully parsed a group of options.
Opening an output file: output_test_synthetic.mp4.
[out#0/mp4 @ 0x562c9191b780] No explicit maps, mapping streams
automatically...
[vost#0:0/h264_vaapi @ 0x562c9191c000] Created video stream from input
stream 0:0
[AVFilterGraph @ 0x562c9191ea40] Setting 'derive_device' to value 'va'
[AVFilterGraph @ 0x562c9191ea40] Setting 'pix_fmts' to value 'nv12'
[file @ 0x562c91921640] Setting default whitelist 'file,crypto,data'
Successfully opened the file.
Stream mapping:
Stream #0:0 -> #0:0 (wrapped_avframe (native) -> h264 (h264_vaapi))
[vost#0:0/h264_vaapi @ 0x562c9191c000] Starting thread...
[vf#0:0 @ 0x562c9191e980] Starting thread...
[vist#0:0/wrapped_avframe @ 0x562c917a3400] [dec:wrapped_avframe @
0x562c91920140] Starting thread...
[in#0/lavfi @ 0x562c91915040] Starting thread...
Press [q] to stop, [?] for help
[AVFilterGraph @ 0x7f8d58001000] Setting 'derive_device' to value 'va'
[AVFilterGraph @ 0x7f8d58001000] Setting 'pix_fmts' to value 'nv12'
[graph -1 input from stream 0:0 @ 0x7f8d58004a00] Setting 'video_size' to
value '1280x720'
[graph -1 input from stream 0:0 @ 0x7f8d58004a00] Setting 'pix_fmt' to
value '2'
[graph -1 input from stream 0:0 @ 0x7f8d58004a00] Setting 'time_base' to
value '1/30'
[graph -1 input from stream 0:0 @ 0x7f8d58004a00] Setting 'pixel_aspect'
to value '1/1'
[graph -1 input from stream 0:0 @ 0x7f8d58004a00] Setting 'colorspace' to
value '0'
[graph -1 input from stream 0:0 @ 0x7f8d58004a00] Setting 'range' to value
'2'
[graph -1 input from stream 0:0 @ 0x7f8d58004a00] Setting 'frame_rate' to
value '30/1'
[graph -1 input from stream 0:0 @ 0x7f8d58004a00] w:1280 h:720
pixfmt:rgb24 tb:1/30 fr:30/1 sar:1/1 csp:gbr range:pc
[format @ 0x7f8d58005640] Setting 'pix_fmts' to value 'vaapi'
[format @ 0x7f8d58005640] Setting 'color_ranges' to value 'tv|pc'
[Parsed_hwupload_0 @ 0x7f8d58004280] Query format failed for
'Parsed_hwupload_0': Cannot allocate memory
[vf#0:0 @ 0x562c9191e980] Error reinitializing filters!
[vf#0:0 @ 0x562c9191e980] Task finished with error code: -12 (Cannot
allocate memory)
[vf#0:0 @ 0x562c9191e980] Terminating thread with return code -12 (Cannot
allocate memory)
[vost#0:0/h264_vaapi @ 0x562c9191c000] Encoder thread received EOF
[vost#0:0/h264_vaapi @ 0x562c9191c000] Could not open encoder before EOF
[vost#0:0/h264_vaapi @ 0x562c9191c000] Task finished with error code: -22
(Invalid argument)
[vost#0:0/h264_vaapi @ 0x562c9191c000] Terminating thread with return code
-22 (Invalid argument)
[vist#0:0/wrapped_avframe @ 0x562c917a3400] [dec:wrapped_avframe @
0x562c91920140] Decoder returned EOF, finishing
[vist#0:0/wrapped_avframe @ 0x562c917a3400] [dec:wrapped_avframe @
0x562c91920140] Terminating thread with return code 0 (success)
[vist#0:0/wrapped_avframe @ 0x562c917a3400] All consumers of this stream
are done
[in#0/lavfi @ 0x562c91915040] All consumers are done
[in#0/lavfi @ 0x562c91915040] Terminating thread with return code 0
(success)
[out#0/mp4 @ 0x562c9191b780] Nothing was written into output file, because
at least one of its streams received no packets.
frame= 0 fps=0.0 q=0.0 Lsize= 0KiB time=N/A bitrate=N/A speed=N/A
[AVIOContext @ 0x562c91921700] Statistics: 0 bytes written, 0 seeks, 0
writeouts
[in#0/lavfi @ 0x562c91915040] Input file #0 (testsrc=s=1280x720:r=30:d=5):
[in#0/lavfi @ 0x562c91915040] Input stream #0:0 (video): 3 packets read
(1320 bytes); 2 frames decoded; 0 decode errors;
[in#0/lavfi @ 0x562c91915040] Total: 3 packets (1320 bytes) demuxed
Conversion failed!
--
Ticket URL: <https://trac.ffmpeg.org/ticket/11618>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list