Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cropping a Dolby Vision video breaks tone mapping #19

Open
GH0STDATA opened this issue Jun 21, 2023 · 4 comments
Open

Cropping a Dolby Vision video breaks tone mapping #19

GH0STDATA opened this issue Jun 21, 2023 · 4 comments
Labels
dynamic-crop Script dynamic-crop

Comments

@GH0STDATA
Copy link

GH0STDATA commented Jun 21, 2023

Setup (please complete the following information):

  • OS: Windows 11 22H2
  • Player: mpv
  • Player Version: 0.35.0-210-ge439ddc0
  • Video Quality: 1080p HEVC Dolby Vision Profile 5

Describe the bug
This is a very specific use case and is definitely not common, but I figured I'd mention it here anyway. While the dynamic crop script does work perfectly in cropping black bars, if the video needs tone mapping of any kind, such as with vo=gpu-next and target-colorspace-hint=yes, this script makes it no longer possible. I'm assuming this is due to the fact that its using LAV filters to determine the black bars, and the images the filters are grabbing are not tone mapped.

I've tried using vf-append or vf-pre to add the correct tone mapping filters back to the video after cropping, but that did not work either.

@GH0STDATA GH0STDATA added the dynamic-crop Script dynamic-crop label Jun 21, 2023
@Ashyni
Copy link
Owner

Ashyni commented Jun 21, 2023

Hello, do you use hardware decoding ? it can be the cause for color issue (cropdetect auto insert a pixel format conversion, and we lose 10bit color), try hwdec=no.
Also make sure to have the most up to date mpv version.

Then i'm going to need the logs of mpv if it's still an issue, i can only replicate it with the HEVC DolbyVision video i have and hwdec=auto-copy like explain above.

@GH0STDATA
Copy link
Author

GH0STDATA commented Jun 21, 2023

It looks like that was the culprit, thank you! I'm surprised that shaders and tone mapping still work with HW decoding being disabled. It didn't drop any frames either. That was my main concern which is why I didn't even try disabling it in the first place.

@signin404
Copy link

(cropdetect auto insert a pixel format conversion, and we lose 10bit color)

Does pixel format conversion only happen in hardware decoding or HDR video?
Will 10bit SDR be affected?

@Ashyni
Copy link
Owner

Ashyni commented Jun 22, 2024

(cropdetect auto insert a pixel format conversion, and we lose 10bit color)

Does pixel format conversion only happen in hardware decoding or HDR video? Will 10bit SDR be affected?

Pixel format conversion is more likely to happened with HW dec and for HDR/SDR/8bit/10bit I'm not sure.

Looks fine with recent mpv/ffmpeg build (without the ffmpeg patch provided in this repo, which suppose to output an unmodified video stream, and the read_ahead feature), can't be sure it's the case for everyone.
You have to try different setup.

my mpv.conf: (with RX7900XT)

vo=gpu-next
gpu-api=vulkan
hwdec=vulkan-copy 
fbo-format=rgba16hf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dynamic-crop Script dynamic-crop
Projects
None yet
Development

No branches or pull requests

3 participants