Selur's Little Message Board
[HELP] 4K HDR x265 to 1080p SDR AV1 - Printable Version

+- Selur's Little Message Board (https://forum.selur.net)
+-- Forum: Hybrid - Support (https://forum.selur.net/forum-1.html)
+--- Forum: Problems & Questions (https://forum.selur.net/forum-3.html)
+--- Thread: [HELP] 4K HDR x265 to 1080p SDR AV1 (/thread-3550.html)



4K HDR x265 to 1080p SDR AV1 - LuCa4S - 18.01.2024

Hello,

I have problem with conversion 4K HDR10 x265 to 1080p SDR AV1.
Almost everything works perfectly fine, but I can't achieved SDR colors.
I tried Filtering->Vapoursynth->Color->HDR to SDR->HDR10ToSDR but it doesn't effect. 
I tried also ToneMap setting, but I only enable it. I didnt change anything so... it also dont make effect Tongue
After conversion source and output videos looks the same.


I found this thread:
https://forum.selur.net/thread-249.html

But settings are completely different for AV1 codec. 
If I may please some guide to make through this. My ideas end Smile

I'll be grateful for any help.

Greetings
PS: Sorry I forgot. I using Windows 10 and newest hybrid (today downloaded) version.


RE: 4K HDR x265 to 1080p SDR AV1 - Selur - 18.01.2024

Quote:Filtering->Vapoursynth->Color->HDR to SDR->HDR10ToSDR but it doesn't effect.
Did a quick test, just enabling HDR10ToSDR and it works fine here:
[Image: HDR2SDR.png]
I also checked the Vapoursynth script view:
# Imports
import vapoursynth as vs
# getting Vapoursynth core
import sys
import os
core = vs.core
# Import scripts folder
scriptPath = 'F:/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# Loading Plugins
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV.dll")
# Import scripts
import tmap
# source: 'G:\TestClips&Co\files\HDR\HDR10\HDR 2020.mkv'
# current color space: YUV420P10, bit depth: 10, resolution: 3840x2160, fps: 23.976, color matrix: 2020ncl, yuv luminance scale: limited, scanorder: progressive
# Loading G:\TestClips&Co\files\HDR\HDR10\HDR 2020.mkv using DGSource
clip = core.dgdecodenv.DGSource("J:/tmp/mkv_7fdb93a272e97a08002fb0b6279a6406_853323747.dgi")# 23.976 fps, scanorder: progressive
frame = clip.get_frame(0)
# Setting detected color matrix (2020ncl).
clip = core.std.SetFrameProps(clip, _Matrix=9)
# Setting color transfer (to 2020ncl), if it is not set.
if '_Transfer' not in frame.props or not frame.props['_Transfer']:
  clip = core.std.SetFrameProps(clip, _Transfer=14)
# Setting color primaries info (to 9), if it is not set.
if '_Primaries' not in frame.props or not frame.props['_Primaries']:
  clip = core.std.SetFrameProps(clip, _Primaries=9)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# making sure frame rate is set to 23.976
clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=0) # progressive
# Color Adjustment
clip = tmap.hablehdr10tosdr(clip=clip, source_peak=1000, desat=50, tFormat=vs.YUV420P8, tMatrix="709", tRange="limited", color_loc="center", lin="True", show_satmask="False", show_clipped="False")
# adjusting output color from: YUV420P8 to YUV420P10 for NVEncModel
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, range_s="limited")
# set output frame rate to 23.976fps (progressive)
clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
# Output
clip.set_output()
and the script looks as it should.
I additionally tried the other HDR->SDR methods with their default values,... (settings usually should be adjusted)
I then disabled HDR10toSDR and enabled ToneMap:
[Image: ToneMap.png]
then I disabled ToneMap and enabled 'HDR10 to SDR (DG)'
[Image: grafik.png]
disabled 'HDR10 to SDR (DG)' and enabled 'ToneMap (Placebo)':
[Image: grafik.png]
disabled 'ToneMap (Placebo)' and enabled 'TimeCube with 'BT2020 to BT601_NTSC':
[Image: grafik.png]

Not sure, what you are doing. One thing that comes to mind is that you might want to check the VUI settings in your encoding settings.

Quote:After conversion source and output videos looks the same.
On an HDR monitor or with a media player that supports HDR to SDR conversion on-the-fly, this is the ideal outcome.
(ideally HDR->SDR converts the HDR data to change the SDR representation so that it looks as similar as possible to the HDR version)

Can't really reproduce your problem.

=> What does MediaInfo say about the input and the output?

Cu Selur

Ps.: in Comparison view for HDR content, the left always shows the SDR data in the stream without the HDR data applied. (so the same way a none-HDR capable player would show the video)


RE: 4K HDR x265 to 1080p SDR AV1 - LuCa4S - 18.01.2024

I'm sorry Mr. Selur.

Propably You have right, its working. Filters are working.
But look:
Screenshots:
[Image: vlcsnap-2024-01-18-18h39m17s463.png][Image: vlcsnap-2024-01-18-18h40m01s496.png]

On the left original file, on the right after conversion.
Differences are obvious...
But later i open both files in same time in 2 different vlc's and this is effect:

[Image: Screenshot-18-01.png]

Same here. Left are original. Right converted. For me difference are not that "big".
It's weird. I dont know what is happen. Thanks anyway Mr Selur Smile .


RE: 4K HDR x265 to 1080p SDR AV1 - Selur - 18.01.2024

Like I wrote, you might want to tweak the settings of the HDR->SDR conversion.
What HDR to SDR does is color grading, and there is no 'this is the way'-method/-standard to do it.

Also, not sure how well this can be captured on screen captures, since on a real hdr monitor the monitor does the hdr data handling, not the gpu/cpu.
Also, if you don't have an HDR monitor, the player also does HDR->SDR which might be similar/identical to the settings you used.
+ media player are often not that good running in parallel and using video overlays.

Cu Selur