View Full Version : Opening HEVC 4K HDR 10bit problem
alexVS
3rd February 2022, 21:08
I'm working with Avisynth+, trying do decode HEVC 4K 10 bit video
And want to try to reecode it to usual AVC h264 8bit
But somehow I receive orange grass, green sky. After opening. Strange.
What am I doing wrong?
Maybe this is file for 3d glasses? (green, red) something like that...
My avisynth script is simple:
LoadPlugin("c:\Program Files (x86)\AviSynth+\plugins+\LSMASHSource.dll")
a1="dolby-vision_HEVC_4K_EAC3.mp4"
LWLibavVideoSource(a2, format = "YUV420P10")
ConvertBits(bits=8, dither=1)
converttoYV12()
File: https://disk.yandex.ru/d/njJQBo6mTMEaxg
Screenshot: https://disk.yandex.ru/i/VqX9ETvRPckgXQ
quietvoid
4th February 2022, 00:36
Your file is Dolby Vision profile 5, it uses a special colorspace.
Not sure there's a solution for converting it in AVS, but FFmpeg 5.0 with vf_libplacebo should be able to convert it.
FranceBB
4th February 2022, 08:48
Working on it...
Well, I know that the sky is supposed to be blue, but what about the rest? XD
Do you have any official specs about which color scheme is using?
Anyway, this is the first beta attempt
Original:
https://i.imgur.com/vDN3mt6.png
LinearTransformation() (https://github.com/FranceBB/LinearTransformation):
https://i.imgur.com/CPxZSR3.png
expect a new beta soon... (after breakfast)
FranceBB
4th February 2022, 10:06
Ok, I've updated the master (https://github.com/FranceBB/LinearTransformation), try with:
LinearTransformation(Input="dvhe0509", Output="Linear_BT709")
right after indexing.
We're still far far off from a real implementation, but I can't find any official document on the web... :(
Reverse engineering everything is hard, especially 'cause I don't have a color palette anywhere in the video... Anyway, so far it produces this on your particular sample:
https://i.imgur.com/7vU2QGY.png
https://i.imgur.com/93HWbKk.png
https://i.imgur.com/GORN798.png
High res pics here: https://i.imgur.com/mI0qbKs.png - https://i.imgur.com/y20y40f.png - https://i.imgur.com/5ZFcmvU.png
EDIT: Work in progress here too https://code.videolan.org/videolan/libplacebo/-/merge_requests/207/diffs
quietvoid
4th February 2022, 14:36
We're still far far off from a real implementation, but I can't find any official document on the web...
Well until the SMPTE standard drops for IPT PQ c2 (which was teased in the journal), there isn't really an official document.
Apparently Dolby only has code.
Basically you have some form of ICtCp with ST2084 transfer function, with luma being reshaped into pseudo-SDR.
So it requires the metadata/RPU to decode/reshape properly.
Both FFmpeg 5.0 (decoding) and libplacebo/mpv (rendering) support this now.
It could be added to ffms2 for AVS (it's already there for the VapourSynth plugin).
See https://github.com/FFMS/ffms2/commit/90975eccfe7e2913dc8a66783ef9c021653d50f5
Though that only propagates the metadata.
The original info comes from ETSI GS CCM 001 V1.1.1, which describes the process in pseudocode.
Selur
4th February 2022, 18:36
Nice!
alexVS
5th February 2022, 18:06
Ok, I've updated the master (https://github.com/FranceBB/LinearTransformation), try with:
LinearTransformation(Input="dvhe0509", Output="Linear_BT709")
Works great! :)
FranceBB
5th February 2022, 19:29
Works great! :)
Yeah but I'm not totally happy with the result ehehehheh
Do you happen to have colorbars in dvhe0509?
Selur
6th February 2022, 10:50
may be those over at https://www.murideo.com/test-pattern-library.html help,... (not sure they have the right version)
Balling
15th February 2022, 16:17
This is now supported by mpv, reference with decode to PQ. You cannot reverse it. The spec is public and very complex, but we did it!
Balling
15th February 2022, 16:20
Yeah but I'm not totally happy with the result ehehehheh
Do you happen to have colorbars in dvhe0509?
Yes, there is. On trac.ffmpeg. but you do not need to waste time on it, mpv implemented it. The hardest part is reshaping and that is done too.
Selur
15th February 2022, 18:08
@Balling: I'm happy that mpv can playback dolby vision files, but how does that help with decoding a dolby vision file in Avisynth?
FranceBB
25th February 2022, 21:29
Just FYI in case anyone is interested, we now have a proper version: https://forum.doom9.org/showthread.php?p=1964642#post1964642
Selur
26th February 2022, 06:32
Nice! Thanks for the info!
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.