Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 3rd February 2022, 21:08   #1  |  Link
alexVS
Registered User
 
Join Date: Sep 2004
Posts: 147
Opening HEVC 4K HDR 10bit problem

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
alexVS is offline   Reply With Quote
Old 4th February 2022, 00:36   #2  |  Link
quietvoid
Registered User
 
Join Date: Jan 2019
Location: Canada
Posts: 570
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.
__________________
LG C2 OLED | GitHub Projects

Last edited by quietvoid; 4th February 2022 at 01:46.
quietvoid is offline   Reply With Quote
Old 4th February 2022, 08:48   #3  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
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:



LinearTransformation():




expect a new beta soon... (after breakfast)
FranceBB is offline   Reply With Quote
Old 4th February 2022, 10:06   #4  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
Ok, I've updated the master, try with:

Code:
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:





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/l...ests/207/diffs

Last edited by FranceBB; 4th February 2022 at 10:26.
FranceBB is offline   Reply With Quote
Old 4th February 2022, 14:36   #5  |  Link
quietvoid
Registered User
 
Join Date: Jan 2019
Location: Canada
Posts: 570
Quote:
Originally Posted by FranceBB View Post
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...f9c021653d50f5
Though that only propagates the metadata.

The original info comes from ETSI GS CCM 001 V1.1.1, which describes the process in pseudocode.
__________________
LG C2 OLED | GitHub Projects

Last edited by quietvoid; 4th February 2022 at 14:52.
quietvoid is offline   Reply With Quote
Old 4th February 2022, 18:36   #6  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,259
Nice!
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 5th February 2022, 18:06   #7  |  Link
alexVS
Registered User
 
Join Date: Sep 2004
Posts: 147
Quote:
Originally Posted by FranceBB View Post
Ok, I've updated the master, try with:

Code:
LinearTransformation(Input="dvhe0509", Output="Linear_BT709")
Works great!
alexVS is offline   Reply With Quote
Old 5th February 2022, 19:29   #8  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
Quote:
Originally Posted by alexVS View Post
Works great!
Yeah but I'm not totally happy with the result ehehehheh
Do you happen to have colorbars in dvhe0509?
FranceBB is offline   Reply With Quote
Old 6th February 2022, 10:50   #9  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,259
may be those over at https://www.murideo.com/test-pattern-library.html help,... (not sure they have the right version)
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 15th February 2022, 16:17   #10  |  Link
Balling
Registered User
 
Join Date: Feb 2020
Posts: 539
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 is offline   Reply With Quote
Old 15th February 2022, 16:20   #11  |  Link
Balling
Registered User
 
Join Date: Feb 2020
Posts: 539
Quote:
Originally Posted by FranceBB View Post
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.

Last edited by Balling; 15th February 2022 at 16:31.
Balling is offline   Reply With Quote
Old 15th February 2022, 18:08   #12  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,259
@Balling: I'm happy that mpv can playback dolby vision files, but how does that help with decoding a dolby vision file in Avisynth?
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 25th February 2022, 21:29   #13  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
Just FYI in case anyone is interested, we now have a proper version: https://forum.doom9.org/showthread.p...42#post1964642
FranceBB is offline   Reply With Quote
Old 26th February 2022, 06:32   #14  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,259
Nice! Thanks for the info!
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Reply

Tags
10bits, avisynth, hdr, hevc. h.265

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 16:49.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.