Opened 19 months ago

Last modified 13 months ago

#9925 new defect

libplacebo hdr tonemap not working

Reported by: acedogblast Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: libplacebo hdr vulkan
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
When tonemaping a HDR video to SDR using libplacebo filter, ffmpeg will fail the conversion. This is the error that ffmpeg outputs:

[AVHWFramesContext @ 0x5596b2d8b740] There are no supported modifiers for the given sw_format
[Parsed_hwupload_0 @ 0x5596b2cc75c0] Failed to configure output pad on Parsed_hwupload_0
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument

How to reproduce:
./ffmpeg -i "$INPUT" -map 0:v:0 -init_hw_device vulkan=gpu:0.0 -vf "hwupload,libplacebo=tonemapping=bt.2446a:colorspace=bt709:color_primaries=bt709:color_trc=bt709:range=limited:format=yuv420p10le,hwdownload" -c:v libx265 -crf 20 -preset:v slow -pix_fmt yuv420p10le "test.mkv"
ffmpeg version N-108133-gf976ed7fcf # This is git master as of 9/14/2022

Change History (7)

comment:1 by acedogblast, 19 months ago

Summary: libplacebolibplacebo hdr tonemap not working

comment:2 by acedogblast, 19 months ago

Version: unspecifiedgit-master

comment:3 by Anton1699, 19 months ago

If you are the same person that opened this thread on the FFmpeg subreddit, you said there that you're using the integrated graphics on an Intel Core i5-2540M.

According to this Intel support article, your GPU does not support Vulkan.

comment:4 by Ezav, 18 months ago

Keywords: libplacebo vulkan added; libplacbo removed

I have the same issue.

My graphic card work correctly with vulkan, I frequently play some games that require vulkan. What I want to do is applying GLSL shaders with libplacebo but I have the same error.

The first example from the libplacebo doc (https://www.ffmpeg.org/ffmpeg-filters.html#Examples-89) produce the same error. Compiled on git-master (299253ae).

comment:5 by acedogblast, 18 months ago

I am not the original poster for that reddit page but I do have a comment on it. The gpu I am using is RTX3080 with defiantly supports vulkan.

comment:6 by wammer, 17 months ago

I'm seeing the same error with a Tesla T4 GPU:

ffmpeg -i in.mp4 -init_hw_device vulkan -vf hwupload,libplacebo=format=yuv420p,hwdownload,format=yuv420p out.mp4
[Parsed_libplacebo_1 @ 0x555e8305b780] Setting 'format' to value 'yuv420p'
[libplacebo @ 0x555e8305b880] Initialized libplacebo v5.229.1-28-g27e38da (API v233)
[Parsed_format_3 @ 0x555e8329dc80] Setting 'pix_fmts' to value 'yuv420p'
[graph 0 input from stream 0:0 @ 0x555e8329d580] Setting 'video_size' to value '720x1280'
[graph 0 input from stream 0:0 @ 0x555e8329d580] Setting 'pix_fmt' to value '0'
[graph 0 input from stream 0:0 @ 0x555e8329d580] Setting 'time_base' to value '1/90000'
[graph 0 input from stream 0:0 @ 0x555e8329d580] Setting 'pixel_aspect' to value '1/1'
[graph 0 input from stream 0:0 @ 0x555e8329d580] Setting 'frame_rate' to value '30/1'
[graph 0 input from stream 0:0 @ 0x555e8329d580] w:720 h:1280 pixfmt:yuv420p tb:1/90000 fr:30/1 sar:1/1
[format @ 0x555e8329d0c0] Setting 'pix_fmts' to value 'yuv420p|yuvj420p|yuv422p|yuvj422p|yuv444p|yuvj444p|nv12|nv16|nv21|yuv420p10le|yuv422p10le|yuv444p10le|nv20le|gray|gray10le'
[AVFilterGraph @ 0x555e8305a3c0] query_formats: 7 queried, 6 merged, 0 already done, 0 delayed
[hwupload @ 0x555e8305b180] Surface format is yuv420p.
[AVHWFramesContext @ 0x555e8305ec40] There are no supported modifiers for the given sw_format
[Parsed_hwupload_0 @ 0x555e8305b040] Failed to configure output pad on Parsed_hwupload_0

Ubuntu 22.04.1 LTS
Vulkan Instance Version: 1.3.231
CUDA Version: 11.7
Input file: Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive)

Last edited 17 months ago by wammer (previous) (diff)

comment:7 by hronek, 13 months ago

This patch make it work as a workaround: https://github.com/jellyfin/jellyfin-ffmpeg/issues/215#issuecomment-1410146318

FFmpeg 6.0 can also be patched and starts working. You need libplacebo 5.229.1 (maybe 5.229.2 also works)

Note: See TracTickets for help on using tickets.