Log: (all $variables are set correctly) ffmpeg \ -init_hw_device vaapi=amd:/dev/dri/renderD128 \ -hwaccel vaapi -hwaccel_device amd \ -c:v vp9 -hwaccel_output_format vaapi -an \ -extra_hw_frames $lad \ -i orig-vp9.mp4 \ -frames:v $numframes \ -c:v hevc_vaapi \ -preset veryslow \ -profile:v 1 \ -low_power false \ -async_depth $cores \ -b:v $bitrate \ -maxrate $((2 * $bitrate)) \ -bufsize $((4 * $bitrate)) \ -fps_mode passthrough -y \ hevc.mp4 # Adding this below line (uncommented) causes the command to fail citing # "Cannot allocate memory" # -vf 'scale_vaapi=-1:720' \ Log of failure: ffmpeg version n7.0.1 Copyright (c) 2000-2024 the FFmpeg developers built with gcc 14.1.1 (GCC) 20240522 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-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-nvdec --enable-nvenc --enable-opencl --enable-opengl --enable-shared --enable-vapoursynth --enable-version3 --enable-vulkan libavutil 59. 8.100 / 59. 8.100 libavcodec 61. 3.100 / 61. 3.100 libavformat 61. 1.100 / 61. 1.100 libavdevice 61. 1.100 / 61. 1.100 libavfilter 10. 1.100 / 10. 1.100 libswscale 8. 1.100 / 8. 1.100 libswresample 5. 1.100 / 5. 1.100 libpostproc 58. 1.100 / 58. 1.100 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x5784a5224b40] stream 0, timescale not set [vp9 @ 0x5784a518c900] Requested reference 1 not available [mov,mp4,m4a,3gp,3g2,mj2 @ 0x5784a5224b40] Could not find codec parameters for stream 2 (Video: vp9 (Profile 0), none): unspecified size Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'orig-vp9.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2mp41 encoder : Lavf59.16.100 Duration: 07:51:03.40, start: 0.000000, bitrate: 4081 kb/s Stream #0:0[0x1](eng): Video: vp9 (Profile 0) (vp09 / 0x39307076), yuv420p(tv, bt470bg/bt709/bt709), 1920x1080, 3960 kb/s, SAR 1:1 DAR 16:9, 60 fps, 60 tbr, 16k tbn (default) Metadata: handler_name : VideoHandler vendor_id : [0][0][0][0] Stream #0:1[0x2](eng): Audio: opus (Opus / 0x7375704F), 48000 Hz, mono, fltp, 101 kb/s (default) Metadata: handler_name : SoundHandler vendor_id : [0][0][0][0] Stream #0:2[0x0]: Video: vp9 (Profile 0), none, 90k tbr, 90k tbn (attached pic) [out#0/mp4 @ 0x5784a5188680] Codec AVOption preset (Encoding preset) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream. Stream mapping: Stream #0:0 -> #0:0 (vp9 (native) -> hevc (hevc_vaapi)) Press [q] to stop, [?] for help [hevc_vaapi @ 0x5784a518c900] No quality level set; using default (25). [hevc_vaapi @ 0x5784a518c900] Driver does not support some wanted packed headers (wanted 0xd, found 0x1). Output #0, mp4, to 'hevc.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2mp41 encoder : Lavf61.1.100 Stream #0:0(eng): Video: hevc (Main) (hev1 / 0x31766568), vaapi(tv, bt470bg/bt470bg/smpte170m, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 60 fps, 15360 tbn (default) Metadata: handler_name : VideoHandler vendor_id : [0][0][0][0] encoder : Lavc61.3.100 hevc_vaapi [vf#0:0 @ 0x5784a51440c0] Error while filtering: Cannot allocate memory [vf#0:0 @ 0x5784a51440c0] Task finished with error code: -12 (Cannot allocate memory) [vf#0:0 @ 0x5784a51440c0] Terminating thread with return code -12 (Cannot allocate memory) [out#0/mp4 @ 0x5784a5188680] video:11KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 22.129284% frame= 10 fps=0.0 q=-0.0 Lsize= 13KiB time=00:00:00.16 bitrate= 644.8kbits/s speed=2.34x Conversion failed!