libplacebo in 7.1.1 and vaapi decode/encode on rx550
I am trying to explore new world of Vulkan. Just compiled vulkan-sdk 1.4.304 and thus ffmpeg 7.1.1 with libplacebo and vulkan filters/hwaccels/encode. Because Vulkan decode for some reason does not work on my AMD RX550 (polaris12) even with RADV_VIDEO_ENCODE=1 RADV_VIDEO_DECODE=1 I am trying to make libplacebo's tonemap cooperate with vaapi bash-5.1$ ./bin/ffmpeg711-vulkan -init_hw_device vulkan -hwaccel vaapi -hwaccel_output_format vaapi -i ~/K38_sdcard1/Documents/iPhone11_4K-recorder_59.940HDR10.mov -vf libplacebo=colorspace=bt709:color_primaries=bt709:color_trc=bt709:range=tv -c:a copy -c:v hevc_vulkan -f avi /dev/null ffmpeg version 7.1.1 Copyright (c) 2000-2025 the FFmpeg developers built with gcc 11.2.0 (GCC) configuration: --enable-opencl --disable-debug --enable-libx265 --enable-libx264 --enable-gpl --enable-libplacebo --enable-vulkan --enable-libshaderc 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 [aist#0:1/pcm_s16le @ 0xb1ff740] Guessed Channel Layout: stereo Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/guest/K38_sdcard1/Documents/iPhone11_4K-recorder_59.940HDR10.mov': Metadata: major_brand : qt minor_version : 0 compatible_brands: qt creation_time : 2020-12-18T22:20:29.000000Z com.apple.quicktime.creationdate: 2020-12-18T17:20:29-0500 com.apple.quicktime.location.ISO6709: +33.4233-084.5802/ Duration: 00:00:19.16, start: 0.000000, bitrate: 69140 kb/s Stream #0:0[0x1](und): Video: hevc (Main 10) (hvc1 / 0x31637668), yuv420p10le(pc, bt2020nc/bt2020/smpte2084), 3840x2160, 64166 kb/s, 59.92 fps, 59.94 tbr, 600 tbn (default) Metadata: creation_time : 2020-12-18T22:20:29.000000Z handler_name : Core Media Video vendor_id : [0][0][0][0] encoder : HEVC Stream #0:1[0x2](und): Audio: pcm_s16le (lpcm / 0x6D63706C), 48000 Hz, stereo, s16, 1536 kb/s (default) Metadata: creation_time : 2020-12-18T22:20:29.000000Z handler_name : Core Media Audio vendor_id : [0][0][0][0] File '/dev/null' already exists. Overwrite? [y/N] y Stream mapping: Stream #0:0 -> #0:0 (hevc (native) -> hevc (hevc_vulkan)) Stream #0:1 -> #0:1 (copy) Press [q] to stop, [?] for help There are 2 hardware devices. device vaapi0 of type vaapi is picked for filters by default. Set hardware device explicitly with the filter_hw_device option if device vaapi0 is not usable for filters. Impossible to convert between the formats supported by the filter 'graph -1 input from stream 0:0' and the filter 'auto_scale_0' [vf#0:0 @ 0xb1fe380] Error reinitializing filters! [vf#0:0 @ 0xb1fe380] Task finished with error code: -38 (Function not implemented) [vost#0:0/hevc_vulkan @ 0xb200200] Could not open encoder before EOF [vost#0:0/hevc_vulkan @ 0xb200200] Task finished with error code: -22 (Invalid argument) [vost#0:0/hevc_vulkan @ 0xb200200] Terminating thread with return code -22 (Invalid argument) [vf#0:0 @ 0xb1fe380] Terminating thread with return code -38 (Function not implemented) [out#0/avi @ 0xb1e8d80] 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 Conversion failed! ow! And adding -filter_hw_device vulkan only result in ash-5.1$ ./bin/ffmpeg711-vulkan -init_hw_device vulkan -filter_hw_device vulkan -hwaccel vaapi -hwaccel_output_format vaapi -i ~/K38_sdcard1/Documents/iPhone11_4K-recorder_59.940HDR10.mov -vf libplacebo=colorspace=bt709:color_primaries=bt709:color_trc=bt709:range=tv -c:a copy -c:v hevc_vulkan -f avi /dev/null ffmpeg version 7.1.1 Copyright (c) 2000-2025 the FFmpeg developers built with gcc 11.2.0 (GCC) configuration: --enable-opencl --disable-debug --enable-libx265 --enable-libx264 --enable-gpl --enable-libplacebo --enable-vulkan --enable-libshaderc 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 Invalid filter device vulkan. Failed to set value 'vulkan' for option 'filter_hw_device': Invalid argument Error parsing global options: Invalid argument Any idea how to proceed?
I am trying to explore new world of Vulkan. Just compiled vulkan-sdk 1.4.304 and thus ffmpeg 7.1.1 with libplacebo and vulkan filters/hwaccels/encode.
Because Vulkan decode for some reason does not work on my AMD RX550 (polaris12) even with RADV_VIDEO_ENCODE=1 RADV_VIDEO_DECODE=1 I am trying to make libplacebo's tonemap cooperate with vaapi
bash-5.1$ ./bin/ffmpeg711-vulkan -init_hw_device vulkan -hwaccel vaapi -hwaccel_output_format vaapi -i ~/K38_sdcard1/Documents/iPhone11_4K-recorder_59.940HDR10.mov -vf libplacebo=colorspace=bt709:color_primaries=bt709:color_trc=bt709:range=tv -c:a copy -c:v hevc_vulkan -f avi /dev/null ffmpeg version 7.1.1 Copyright (c) 2000-2025 the FFmpeg developers built with gcc 11.2.0 (GCC) configuration: --enable-opencl --disable-debug --enable-libx265 --enable-libx264 --enable-gpl --enable-libplacebo --enable-vulkan --enable-libshaderc 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 [aist#0:1/pcm_s16le @ 0xb1ff740] Guessed Channel Layout: stereo Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/guest/K38_sdcard1/Documents/iPhone11_4K-recorder_59.940HDR10.mov': Metadata: major_brand : qt minor_version : 0 compatible_brands: qt creation_time : 2020-12-18T22:20:29.000000Z com.apple.quicktime.creationdate: 2020-12-18T17:20:29-0500 com.apple.quicktime.location.ISO6709: +33.4233-084.5802/ Duration: 00:00:19.16, start: 0.000000, bitrate: 69140 kb/s Stream #0:0[0x1](und): Video: hevc (Main 10) (hvc1 / 0x31637668), yuv420p10le(pc, bt2020nc/bt2020/smpte2084), 3840x2160, 64166 kb/s, 59.92 fps, 59.94 tbr, 600 tbn (default) Metadata: creation_time : 2020-12-18T22:20:29.000000Z handler_name : Core Media Video vendor_id : [0][0][0][0] encoder : HEVC Stream #0:1[0x2](und): Audio: pcm_s16le (lpcm / 0x6D63706C), 48000 Hz, stereo, s16, 1536 kb/s (default) Metadata: creation_time : 2020-12-18T22:20:29.000000Z handler_name : Core Media Audio vendor_id : [0][0][0][0] File '/dev/null' already exists. Overwrite? [y/N] y Stream mapping: Stream #0:0 -> #0:0 (hevc (native) -> hevc (hevc_vulkan)) Stream #0:1 -> #0:1 (copy) Press [q] to stop, [?] for help There are 2 hardware devices. device vaapi0 of type vaapi is picked for filters by default. Set hardware device explicitly with the filter_hw_device option if device vaapi0 is not usable for filters. Impossible to convert between the formats supported by the filter 'graph -1 input from stream 0:0' and the filter 'auto_scale_0' [vf#0:0 @ 0xb1fe380] Error reinitializing filters! [vf#0:0 @ 0xb1fe380] Task finished with error code: -38 (Function not implemented) [vost#0:0/hevc_vulkan @ 0xb200200] Could not open encoder before EOF [vost#0:0/hevc_vulkan @ 0xb200200] Task finished with error code: -22 (Invalid argument) [vost#0:0/hevc_vulkan @ 0xb200200] Terminating thread with return code -22 (Invalid argument) [vf#0:0 @ 0xb1fe380] Terminating thread with return code -38 (Function not implemented) [out#0/avi @ 0xb1e8d80] 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 Conversion failed!
ow!
And adding -filter_hw_device vulkan only result in
ash-5.1$ ./bin/ffmpeg711-vulkan -init_hw_device vulkan -filter_hw_device vulkan -hwaccel vaapi -hwaccel_output_format vaapi -i ~/K38_sdcard1/Documents/iPhone11_4K-recorder_59.940HDR10.mov -vf libplacebo=colorspace=bt709:color_primaries=bt709:color_trc=bt709:range=tv -c:a copy -c:v hevc_vulkan -f avi /dev/null ffmpeg version 7.1.1 Copyright (c) 2000-2025 the FFmpeg developers built with gcc 11.2.0 (GCC) configuration: --enable-opencl --disable-debug --enable-libx265 --enable-libx264 --enable-gpl --enable-libplacebo --enable-vulkan --enable-libshaderc 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 Invalid filter device vulkan. Failed to set value 'vulkan' for option 'filter_hw_device': Invalid argument Error parsing global options: Invalid argument
Any idea how to proceed?
have you set the following environment variables? RADV_PERFTEST=video_encode RADV_PERFTEST=video_decode But it can also be that you're out of luck because somewhere I came across this (for an older version of FFmpeg: It (vulkan decoding) doesn't work on Polaris: |0.339][e][ffmpeg/video] h264: Device does not support the VK_KHR_video_decode_queue extension! |
вс, 27 апр. 2025 г., 20:08 Ferdi Scholten <ferdi@sttc-nlp.nl>:
I am trying to explore new world of Vulkan. Just compiled vulkan-sdk 1.4.304 and thus ffmpeg 7.1.1 with libplacebo and vulkan filters/hwaccels/encode.
Because Vulkan decode for some reason does not work on my AMD RX550 (polaris12) even with RADV_VIDEO_ENCODE=1 RADV_VIDEO_DECODE=1 I am trying to make libplacebo's tonemap cooperate with vaapi
bash-5.1$ ./bin/ffmpeg711-vulkan -init_hw_device vulkan -hwaccel vaapi -hwaccel_output_format vaapi -i ~/K38_sdcard1/Documents/iPhone11_4K-recorder_59.940HDR10.mov -vf
libplacebo=colorspace=bt709:color_primaries=bt709:color_trc=bt709:range=tv
-c:a copy -c:v hevc_vulkan -f avi /dev/null ffmpeg version 7.1.1 Copyright (c) 2000-2025 the FFmpeg developers built with gcc 11.2.0 (GCC) configuration: --enable-opencl --disable-debug --enable-libx265 --enable-libx264 --enable-gpl --enable-libplacebo --enable-vulkan --enable-libshaderc 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 [aist#0:1/pcm_s16le @ 0xb1ff740] Guessed Channel Layout: stereo Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/guest/K38_sdcard1/Documents/iPhone11_4K-recorder_59.940HDR10.mov': Metadata: major_brand : qt minor_version : 0 compatible_brands: qt creation_time : 2020-12-18T22:20:29.000000Z com.apple.quicktime.creationdate: 2020-12-18T17:20:29-0500 com.apple.quicktime.location.ISO6709: +33.4233-084.5802/ Duration: 00:00:19.16, start: 0.000000, bitrate: 69140 kb/s Stream #0:0[0x1](und): Video: hevc (Main 10) (hvc1 / 0x31637668), yuv420p10le(pc, bt2020nc/bt2020/smpte2084), 3840x2160, 64166 kb/s, 59.92 fps, 59.94 tbr, 600 tbn (default) Metadata: creation_time : 2020-12-18T22:20:29.000000Z handler_name : Core Media Video vendor_id : [0][0][0][0] encoder : HEVC Stream #0:1[0x2](und): Audio: pcm_s16le (lpcm / 0x6D63706C), 48000 Hz, stereo, s16, 1536 kb/s (default) Metadata: creation_time : 2020-12-18T22:20:29.000000Z handler_name : Core Media Audio vendor_id : [0][0][0][0] File '/dev/null' already exists. Overwrite? [y/N] y Stream mapping: Stream #0:0 -> #0:0 (hevc (native) -> hevc (hevc_vulkan)) Stream #0:1 -> #0:1 (copy) Press [q] to stop, [?] for help There are 2 hardware devices. device vaapi0 of type vaapi is picked for filters by default. Set hardware device explicitly with the filter_hw_device option if device vaapi0 is not usable for filters. Impossible to convert between the formats supported by the filter 'graph -1 input from stream 0:0' and the filter 'auto_scale_0' [vf#0:0 @ 0xb1fe380] Error reinitializing filters! [vf#0:0 @ 0xb1fe380] Task finished with error code: -38 (Function not implemented) [vost#0:0/hevc_vulkan @ 0xb200200] Could not open encoder before EOF [vost#0:0/hevc_vulkan @ 0xb200200] Task finished with error code: -22 (Invalid argument) [vost#0:0/hevc_vulkan @ 0xb200200] Terminating thread with return code -22 (Invalid argument) [vf#0:0 @ 0xb1fe380] Terminating thread with return code -38 (Function not implemented) [out#0/avi @ 0xb1e8d80] 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 Conversion failed!
ow!
And adding -filter_hw_device vulkan only result in
ash-5.1$ ./bin/ffmpeg711-vulkan -init_hw_device vulkan -filter_hw_device vulkan -hwaccel vaapi -hwaccel_output_format vaapi -i ~/K38_sdcard1/Documents/iPhone11_4K-recorder_59.940HDR10.mov -vf
libplacebo=colorspace=bt709:color_primaries=bt709:color_trc=bt709:range=tv
-c:a copy -c:v hevc_vulkan -f avi /dev/null ffmpeg version 7.1.1 Copyright (c) 2000-2025 the FFmpeg developers built with gcc 11.2.0 (GCC) configuration: --enable-opencl --disable-debug --enable-libx265 --enable-libx264 --enable-gpl --enable-libplacebo --enable-vulkan --enable-libshaderc 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 Invalid filter device vulkan. Failed to set value 'vulkan' for option 'filter_hw_device': Invalid argument Error parsing global options: Invalid argument
Any idea how to proceed?
have you set the following environment variables? RADV_PERFTEST=video_encode RADV_PERFTEST=video_decode
Yes, I tried with those correct variables and vulkan hevc decoding worked! But it seems that vaapi/vulkan interoperability for libplacebo need "drm modifiers" and they not implemented for gfx8, only gfx9+ (and this leaves Polaris out). And vulkan video encoding indeed does not work on my card either ... So libplacebo need to push frames up for sw encoder, and this slows whole pipeline (for tonemapping). RADV_PERFTEST=video_decode,video_encode time -p ./ffmpeg -init_hw_device vulkan=vulkan -filter_hw_device vulkan -hwaccel vulkan -i ~/K38_sdcard1/Documents/iPhone11_4K-recorder_59.940HDR10.mov -vf libplacebo=w=1920:h=1080:force_original_aspect_ratio=decrease:normalize_sar=true:upscaler=ewa_lanczos:downscaler=ewa_lanczos:colorspace=bt709:color_primaries=bt709:color_trc=bt709:range=tv -c:a copy -c:v libx264 -f mp4 -benchmark /dev/shm/ffmpeg-git-libplacebo-vulkan-2k.mp4 There is ffv1_vulkan encoder in ffmpeg.git, it worked but again was too slow (6 fps for prescaled to 1080p image) for being practical ... RADV_PERFTEST=video_decode,video_encode time -p ./ffmpeg -init_hw_device vulkan=vulkan -filter_hw_device vulkan -hwaccel vulkan -i ~/K38_sdcard1/Documents/iPhone11_4K-recorder_59.940HDR10.mov -vf libplacebo=format=yuv444p:w=1920:h=1080:force_original_aspect_ratio=decrease:normalize_sar=true:upscaler=ewa_lanczos:downscaler=ewa_lanczos:colorspace=bt709:color_primaries=bt709:color_trc=bt709:range=tv -c:a copy -c:v ffv1_vulkan -slicecrc 0 -level 4 -strict -2 -async_depth 5 -slices_v 32 -slices_h 32 -f matroska -benchmark /dev/null But something works already!
But it can also be that you're out of luck because somewhere I came across this (for an older version of FFmpeg: It (vulkan decoding) doesn't work on Polaris: |0.339][e][ffmpeg/video] h264: Device does not support the VK_KHR_video_decode_queue extension!
| _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
participants (2)
-
Andrew Randrianasulu -
Ferdi Scholten