mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
27.83k stars 2.87k forks source link

gpu-next: HDR flickering is back... #11548

Open FCrane opened 1 year ago

FCrane commented 1 year ago

Hi!

An issue with gpu-next I reported long ago and which supposedly was fixed is back: brightness flickering of HDR content! I'm using libmpv-2.dll and these settings:

vo = gpu-next hdr-compute-peak = yes target-peak = 100 tone-mapping = auto saturation = -10 contrast = 0 brightness = 0

The target peak of 100 is needed, because auto is much too dark (again). I've noticed that lowering the target-peak below 100 does not increase the brightness anymore (which is a pitty, because 100 still is very dark compared to older versions of mpv). Also, the colors are (again or still) completely over-saturated! Lowering the saturation to -10 makes it somewhat watchable, but still the colors are much too strong in many scenes. Why is it not possible to once and for all solve these tone mapping, brightness, color issues? I suppose HDR causes the problems?

Anyway: the main problem is, that the new version again causes flickering in some HDR content (see attached test clip). In the 15 seconds of the clip, the brightness of the lamps in the scene flicker heavily 3 times - this is very annoying. It happens all the time during the whole film.

I've reported this issue long ago and it was fixed (for the test clips I posted back then), but now it seems to be back (although not happening with the old test clips). So maybe the HDR metadata is new or something else causes the issue again..

Would be nice if this could be fixed for good...

Thanks!

Important Information

Provide following Information:

Reproduction steps

Play the test clip with the config above.

Expected behavior

Constant brightness of the highlights and the scene.

Actual behavior

Heavy flickering.

Test Clip

https://www.dropbox.com/s/zhhyn0sthxshu5y/TestClip-The%20Fablemans.mkv?dl=0

quietvoid commented 1 year ago

The issue seems to only happen with --vf=format:dolbyvision=yes but I'm not exactly sure what's happening.
The brightness metadata never changes in the whole clip so that can't be it.

There's a heavy flicker near the I frame at frame 112, though.

The issue is that FFmpeg is missing some frames' metadata because there's a SEI_SUFFIX NALU at the end of the AU (of most I frames it seems), causing the flicker. So the real issue is the file, but the cause is probably that it was created with an old version of dovi_tool which could create such bitstreams.

Not sure there's a solution for this in mpv, it's something that would need to be discussed for a workaround in FFmpeg.

Since the file has HDR10+ metadata too, you could get around the issue using --vf=format:dolbyvision=no for now.

quietvoid commented 1 year ago

The workaround I came up with: https://github.com/quietvoid/FFmpeg/commit/2ae68ea2a52728f619b32c6692a84c09a2c7520c It's probably not ideal, so I should try to get some reviews before attempting to upstream.

kasper93 commented 1 year ago

I tested quickly with my samples with the same problem and your patch helps.

Problem is people seems to be still using old dovi_tool version. And those broken files seems to surface in the wild. So maybe indeed the workaround is needed to be upstreamed.

Also would be good to make some visibility on the issue so people actually update their tools, but well...