mpv-player / mpv

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

vo=gpu-next has no effect on DV format files with hwdec=mediacodec-copy #10287

Open tonyliangli opened 2 years ago

tonyliangli commented 2 years ago

Important Information

Screenshot_20220613-175619_mpv

Reproduction steps

I'm using a custom build mpv-android with the latest libplacebo (> 4.192.0) and ffmpeg (>5.0). The build is from the following locations:

https://www.reddit.com/r/AV1/comments/v55ukc/custom_build_the_endgame_is_approaching_leading/ https://github.com/Quackdoc/mpv-android/tree/testvk

I'm using the following config:

vo=gpu-next gpu-api=vulkan vd-lavc-film-grain=gpu

Only when using software decoding the color tone mapping is correct for a DV format file. Once I changed to hardware decoding (mediacodec-copy), the color tone is still incorrect. I'm using a samsung Snapdragon 8 Gen 1 device with no DV license.

Expected behavior

The color tone should be normal same as using software decoding. Screenshot_20220613-175927_mpv

Actual behavior

Instead the color is still purple or green. Screenshot_20220613-175947_mpv

Log file

Sample files

Any dolby vision format files.

haasn commented 2 years ago

Seems the metadata is not being copied correctly. Other hardware codecs don't have this issue so I doubt the issue is on the side of mpv or FFmpeg. If you're unlucky the bug might be in mediacodec.

tonyliangli commented 2 years ago

Seems the metadata is not being copied correctly. Other hardware codecs don't have this issue so I doubt the issue is on the side of mpv or FFmpeg. If you're unlucky the bug might be in mediacodec.

Hope it's not related to mediacodec. It's the only HW codec on Android.

nyanmisaka commented 2 years ago

AFAIK only hw accelerators(-hwaccels) and sw decoders can parse DoVi metadata into the side_data of AVframes, but mediacodec in ffmpeg is a hw decoder(-decoders), not an accelerator, which may requires extra effort to handle the DoVi side_data.

https://github.com/FFmpeg/FFmpeg/blob/e85958ece84a8d3a6390f50ac2690addf28a082e/libavcodec/hwconfig.h#L67-L80