Skip to content

feat: tonemap HDR content to SDR using a libplacebo filter#250

Draft
JB26 wants to merge 1 commit into
dirkvdb:masterfrom
JB26:hdr_tonemapping
Draft

feat: tonemap HDR content to SDR using a libplacebo filter#250
JB26 wants to merge 1 commit into
dirkvdb:masterfrom
JB26:hdr_tonemapping

Conversation

@JB26

@JB26 JB26 commented Feb 8, 2026

Copy link
Copy Markdown

fixes #236

@dirkvdb

dirkvdb commented Feb 8, 2026

Copy link
Copy Markdown
Owner

Thanks! I will try to find some time in the coming week to check and merge

@dirkvdb

dirkvdb commented Feb 13, 2026

Copy link
Copy Markdown
Owner

If I download an HDR sample from https://kodi.wiki/view/Samples and compare the output against main I don't see a difference. How should I test this?

@JB26

JB26 commented Feb 13, 2026

Copy link
Copy Markdown
Author

Thank you for testing

I wanted to prepare some samples and was using ubuntu 25.10 (I developed the change on arch) and was hit by this back trace :(

[libplacebo @ 0x584e6be18240] Validation failed: images->vsync_duration > 0.0 (src/renderer.c:3312)
[libplacebo @ 0x584e6be18240]   Backtrace:
[libplacebo @ 0x584e6be18240]     #0  /lib/x86_64-linux-gnu/libplacebo.so.349(pl_render_image_mix+0x125d) [0x76e604c8bacd]
[libplacebo @ 0x584e6be18240]     #1  /lib/x86_64-linux-gnu/libavfilter.so.10(+0x2f381b) [0x76e60caf381b]
[libplacebo @ 0x584e6be18240]     #2  /lib/x86_64-linux-gnu/libavfilter.so.10(+0x2f4860) [0x76e60caf4860]
[libplacebo @ 0x584e6be18240]     #3  /lib/x86_64-linux-gnu/libavfilter.so.10(+0x1d765d) [0x76e60c9d765d]
[libplacebo @ 0x584e6be18240]     #4  /lib/x86_64-linux-gnu/libavfilter.so.10(+0x1dc286) [0x76e60c9dc286]
[libplacebo @ 0x584e6be18240]     #5  /home/jbroders/Projekte/ffmpegthumbnailer/libffmpegthumbnailer.so.4(_ZN17ffmpegthumbnailer12MovieDecoder19getScaledVideoFrameERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEbRNS_10VideoFrameE+0x1c0) [0x76e610b4f756]
[libplacebo @ 0x584e6be18240]     #6  /home/jbroders/Projekte/ffmpegthumbnailer/libffmpegthumbnailer.so.4(_ZN17ffmpegthumbnailer16VideoThumbnailer17generateThumbnailERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERNS_11ImageWriterEP15AVFormatContext+0x1bc) [0x76e610b85b0c]
[libplacebo @ 0x584e6be18240]     #7  /home/jbroders/Projekte/ffmpegthumbnailer/libffmpegthumbnailer.so.4(_ZN17ffmpegthumbnailer16VideoThumbnailer17generateThumbnailERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE24ThumbnailerImageTypeEnumS8_P15AVFormatContext+0x7b) [0x76e610b862a1]
[libplacebo @ 0x584e6be18240]     #8  ./ffmpegthumbnailer(+0x5dfe) [0x584e401a5dfe]
[libplacebo @ 0x584e6be18240]     #9  /lib/x86_64-linux-gnu/libc.so.6(+0x2a575) [0x76e61042a575]
[libplacebo @ 0x584e6be18240]     #10 /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x88) [0x76e61042a628]
[libplacebo @ 0x584e6be18240]     #11 ./ffmpegthumbnailer(+0x54e5) [0x584e401a54e5]

I then tested it in a vm to check if it would work on the daily build of ubuntu 26.04 which shows another error:

ubuntu@ubuntu:~/ffmpegthumbnailer$ ./ffmpegthumbnailer -i ~/Downloads/Mystery\ Box\ Dolby\ Vision\ Profile\ 5.mp4 -o /tmp/foobar.png -t 30 -s 720
[libplacebo @ 0x59a227fe8c80] Found no suitable device, giving up.
[libplacebo @ 0x59a227fe8c80] Failed initializing vulkan device
[libplacebo @ 0x59a227fe8c80] Failed creating Vulkan device!
Error: Failed to create libplacebo filter Generic error in an external library

I guess what I'm trying to say is, that I think I made a mistake by choosing libplacebo. I will try if the zscale filter is more stable and works without vulkan. That means no dolby vision support, but most videos have an hdr fallback layer. So I think it would still be helpful.

Again thanks for checking this out and sorry for the noise :/

@JB26 JB26 marked this pull request as draft February 13, 2026 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Thumbnails look wrong for HDR videos

2 participants