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 > Video Encoding > High Efficiency Video Coding (HEVC)

Reply
 
Thread Tools Search this Thread Display Modes
Old 28th November 2023, 18:49   #1  |  Link
Mounter81
Registered User
 
Join Date: Sep 2020
Posts: 15
How/with what to convert HEVC HLG video to HEVC SDR video?

So I have a couple of HLG videos witch didn't play with fine colors (too dark) on my media player (but fine with MPC-BE on Windows). So I want them to be converted to SDR.

What is the best converter program and how to set it up to do this?

Thank you!
Mounter81 is offline   Reply With Quote
Old 28th November 2023, 21:21   #2  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,727
I believe zscale in ffmpeg also has a pretty good HLG to 709 conversion mode. Most HLG is close enough to SDR that it doesn't take a whole lot of processing; much simpler than converting from PQ.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 29th November 2023, 09:35   #3  |  Link
Mounter81
Registered User
 
Join Date: Sep 2020
Posts: 15
Ok, thanks to both, but where can I find some tutorials to do this conversion with the mentioned programs?
Mounter81 is offline   Reply With Quote
Old 29th November 2023, 15:26   #4  |  Link
Mounter81
Registered User
 
Join Date: Sep 2020
Posts: 15
Quote:
Originally Posted by eac3to_mod View Post
You're unlikely to find a tutorial covering all those things. Let's start by asking what experience do you have in multimedia? For example, have you ever used Avisynth(+)?
No never I have used Avisynth. I have used Handbrake sometimes for other purposes.
Mounter81 is offline   Reply With Quote
Old 29th November 2023, 16:17   #5  |  Link
Mounter81
Registered User
 
Join Date: Sep 2020
Posts: 15
Oh and for hardwarewitse I have a 10.th Gen i3 CPU with Intel UHD 630 IGP to do the encoding.
Mounter81 is offline   Reply With Quote
Old 29th November 2023, 17:14   #6  |  Link
Mounter81
Registered User
 
Join Date: Sep 2020
Posts: 15
Quote:
Originally Posted by eac3to_mod View Post
Looks like Handbrake can do it:

https://www.reddit.com/r/handbrake/c..._sdr_question/

If you want to get pedal-to-the-metal with this stuff, you're going to have to learn all the steps individually. You can start by researching and learning Avisynth(+) and filtering.
No Handbrake can't do the conversion it just convert it to SDR without the color correction (like HDR video on an SDR display).

I have found this Avisynth script somwhere:

LoadPlugin("path\LSMASHSource.dll")
LWLibavVideoSource("path of the video", format="YUV420P16")
loadplugin("path\dgdecodenv.dll")
loadplugin("path\dghdrtosdr.dll")
DGHDRtoSDR(mode="pq",white=2000)

I have loaded it into Virtualdub, but it doesn't work for me, because the dgdecodenv.dll file is for NVida GPUs only. I need a version that works with my intel IGP. Can someone help me in that?

Last edited by Mounter81; 29th November 2023 at 17:17.
Mounter81 is offline   Reply With Quote
Old 30th November 2023, 16:19   #7  |  Link
Mounter81
Registered User
 
Join Date: Sep 2020
Posts: 15
Quote:
Originally Posted by eac3to_mod View Post
You don't have to load DGDecodeNV.dll if you use LSMASHSource.dll:

LoadPlugin("path\LSMASHSource.dll")
LoadPlugin("path\dghdrtosdr.dll")
LWLibavVideoSource("path of the video", format="YUV420P16")
DGHDRtoSDR(mode="hlg", impl="sw") # kinda slow in sw mode

Read the accompanying DGHDRtoSDR text file for other options.

There are also other filters to do it. I'll let their authors chime in, or do a search.
I want to do it a hardware level mode, if possible. The UHD 630 IGP is capable of HEVC 10 encoding (intel QSV). Any ideas?
Mounter81 is offline   Reply With Quote
Old 1st December 2023, 05:58   #8  |  Link
Mounter81
Registered User
 
Join Date: Sep 2020
Posts: 15
Ok, I have loaded the script in Virtualdub, but don't know how to start the encoding...

So what option should I select in Vurtualdub next?
Mounter81 is offline   Reply With Quote
Old 1st December 2023, 07:03   #9  |  Link
Mounter81
Registered User
 
Join Date: Sep 2020
Posts: 15
And one more question, how do I add/enable x265.exe to Virtualdub?
Mounter81 is offline   Reply With Quote
Old 1st December 2023, 13:54   #10  |  Link
StvG
Registered User
 
Join Date: Jul 2018
Posts: 438
Quote:
Originally Posted by Mounter81 View Post
I want to do it a hardware level mode, if possible. The UHD 630 IGP is capable of HEVC 10 encoding (intel QSV). Any ideas?
There are libplacebo (Vulkan) implementations for VapourSynth/AviSynth that can do tonemapping.
StvG is offline   Reply With Quote
Old 3rd December 2023, 02:52   #11  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,853
Quote:
Originally Posted by Mounter81 View Post
And one more question, how do I add/enable x265.exe to Virtualdub?
x265 is generally used via command line, however if you wanna use it through VirtualDub, just make sure you're you using the latest version of VirtualDub, Build 44282 (2020) from here: Link

and you'll find it in "video -> compression":



then hit the "configure" button and you can pick a fraction of parameters like the preset, the crf and the bit depth.
If you want more parameters then I'm afraid you'll have to use the command line. If you were to actually use the command line, it might seem intimidating at frist, but you'll see that it's actually pretty straightforward and many of us here prefer it to any GUI.

About converting HDR HLG to SDR BT709, you can do:

Quote:
#Indexing
video=LWLibavVideoSource("your_video.m2ts")
audio=LWLibavAudioSource("your_audio.m2ts")
AudioDub(video, audio)

#Bringing everything to 16bit planar
ConvertBits(16)

#From YUV to XYZ
ConvertYUVtoXYZ(Color=0, HDRmode=2)

#HLG HDR to BT709 SDR tonemapping
ConvertXYZ_Reinhard_HDRtoSDR(exposure_X=2.1)

#Bringing everything back to YUV
ConvertXYZtoYUV(pColor=0)

#Dithering
ConvertBits(bits=8, dither=1)

but you'll need to put the DLLs in plugins64+ from here: Link - Link

Last edited by FranceBB; 3rd December 2023 at 02:58.
FranceBB is offline   Reply With Quote
Reply

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 00:40.


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