mpv-player / mpv

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

Some HDR .PNGs do not open #14377

Open marat569 opened 3 months ago

marat569 commented 3 months ago

I found the root cause of the issue

Its the sBIT size being 4 (RGB + Alpha) -- while ffmpeg expects 3

image


mpv Information

MPV mpv-x86_64-v3-20240609-git-d2bd77a
FFMPEG ffmpeg-x86_64-v3-git-be2cabce3

Important Information

W11 pro 23h2 Nvidia 4090

Reproduction Steps

So some HDR .PNG files don't open, and if you open the console via hotkey, you get [vd] Error while decoding frame!

Some HDR .PNG files open, so I don't know the difference

To reproduce you'd use my .conf file + enable HDR in windows + open the .png file with MPV

The required files can all be found below under the log file section I zipped up all the HDR PNGs to avoid the browser from potentially "messing" with the file.

All my other programs and hdr viewers can open both images just fine. Just a tool I use often to take screenshots creates the HDR PNGs that don't work with mpv.

If ya'll need more info, I'll be happy to provide it.

Also sorry for not providing direct commands, hdr images need a fair few arguments -- so I thought sharing my entire conf would've been better for everybody.

Expected Behavior

MPV would open the hdr png -.-

Actual Behavior

It doesn't :c

Log Files / Sample Files

HDR PNG - WORKS.txt -- Log for working HDR PNG

Doesn't Work -- HDR PNG.txt -- Log for Broken HDR PNG

mpv.conf.zip -- My MPV.conf

HDR PNG - WORKS.zip -- Working HDR PNG

HDR PNG - DOESNT WORK.zip -- Broken HDR PNG

I carefully read all instruction and confirm that I did the following:

llyyr commented 3 months ago

This is an ffmpeg bug, I can confirm that it works in the browser but not with ffplay/ffmpeg.

richardpl commented 3 months ago

Happily to inform you that latest Librempeg does not have this bug.

MasterInQuestion commented 3 months ago

    "HDR PNG - WORKS.zip"?     Probably irrelevant of HDR.

    Mostly just certain PNG outright not decodable with FFmpeg.

    See also: https://trac.ffmpeg.org/ticket/11002#comment:21

    Fix related:     https://github.com/librempeg/librempeg/commit/86473583b4cd11595f2d372666115024124d429f \ \     Also, browsers typically don't do alike "messing".     (the hosting service may do: deeming the file unreasonably large and recompress)

marat569 commented 3 months ago

"HDR PNG - WORKS.zip"?     Probably irrelevant of HDR.

    Mostly just certain PNG outright not decodable with FFmpeg.

    See also: https://trac.ffmpeg.org/ticket/11002#comment:21

    Fix related:     https://github.com/librempeg/librempeg/commit/86473583b4cd11595f2d372666115024124d429f     Also, browsers typically don't do alike "messing".     (the hosting service may do: deeming the file unreasonably large and recompress)

What I had in mind is discord lol -- they sometimes mess with the hdr pngs when converting to webm . I know github embeds images, so I was worried it might "mess" with the png when making the embed.

but thanks for the fix!

hopefully they'll accept the commit soon :tm:

MasterInQuestion commented 3 months ago

    I have some doubt on whether the HDR thing could possibly make sense.

    See [ https://trac.ffmpeg.org/ticket/11002#comment:5 ] for relevant hints.

marat569 commented 3 months ago

@MasterInQuestion sorry for the spam, but would you be able to build me ffmpeg with the fix in your other post please; so I could try it out

I don't have tools setup rn to compile it myself

marat569 commented 2 months ago

I found the root cause of the issue

Its the sBIT size being 4 (RGB + Alpha) -- while ffmpeg expects 3

image