Happy New 2018 Everyone!!
I have noticed that albeit slowly more discussions are surfacing about HDR to SDR conversion as folks are trying to find solutions to playback HDR content on their SDR devices and displays. I'm one of those folks. It seems that madVR is phenomenal for playing HDR on a SDR display but for my setup I'm leaning more towards transcoding. From what I learned thus far it looks like Davinci Resolve might be the way to go but I'm wondering about other solutions like RipBot264 combined with an AviSynth+ script. In case you're wondering why Ripbot264 it's to take advantage of its distributed encoding feature that makes encoding faster.
With that said, by doing some more digging I found the following VapourSynth script for HDR to SDR conversion and was wondering if those who are experts could perhaps write an AviSynth+ equivalent? Unfortunately, I'm a newb when it comes to scripting so would appreciate some help. In any for those using VapourSynth this might be helpful as well as so here is the script.
Thank you for your help in advance.Code:import vapoursynth as vs core = vs.get_core() c = core.ffms2.Source(source = 'path/to/file') source_peak=1200 #set manually c=core.resize.Bilinear(clip=c, format=vs.YUV444PS, range_in_s="limited", range_s="full",chromaloc_in_s="center",dither_type="none") c=core.resize.Bilinear(clip=c, format=vs.RGBS, matrix_in_s="2020ncl", range_in_s="full",dither_type="none") c=core.resize.Bilinear(clip=c, format=vs.RGBS, transfer_in_s="st2084", transfer_s="linear",dither_type="none", nominal_luminance=source_peak) exposure_bias=source_peak/100 #hable/uncharted tone mapping tm = core.std.Expr(c, expr="x {exposure_bias} * 0.15 x {exposure_bias} * * 0.05 + * 0.004 + x {exposure_bias} * 0.15 x {exposure_bias} * * 0.50 + * 0.06 + / 0.02 0.30 / - ".format(exposure_bias=exposure_bias),format=vs.RGBS)#12=1200 nits / 100 nits w = core.std.Expr(c, expr="{exposure_bias} 0.15 {exposure_bias} * 0.05 + * 0.004 + {exposure_bias} 0.15 {exposure_bias} * 0.50 + * 0.06 + / 0.02 0.30 / - ".format(exposure_bias=exposure_bias),format=vs.RGBS)# c = core.std.Expr(clips=[tm,w], expr=" x 1 y / * ",format=vs.RGBS) #c=core.fmtc.primaries(clip=c, prims="2020", primd="709") c=core.resize.Bilinear(clip=c, format=vs.RGBS, primaries_in_s="2020", primaries_s="709",dither_type="none") c=core.resize.Bilinear(clip=c, format=vs.RGBS, transfer_in_s="linear", transfer_s="709",dither_type="none") c=core.resize.Bilinear(clip=c, format=vs.YUV420P8, matrix_s="709", range_in_s="full",range_s="limited",chromaloc_in_s="center") c.set_output()
+ Reply to Thread
Results 1 to 3 of 3
-
-
As an alternative way you could:
1. process your video with Avisynth+ (while not messing with the color space, no RGB<>YUV conversions)
2. decode it with ffmpeg, while using toneMap from ffmpeg
3. feed the output of ffmpeg to your encoder
like Atak_Snajpera does over at: https://forum.doom9.org/showthread.php?p=1827936#post1827936
Sure this limits the processing through Avisynth+ somewhat, but might help in a few scenarios until someone using Avisynth+ ports it.
btw. for Vapoursynth the script isn't really necessary any more since there's a toneMap port for Vapoursynth now (https://github.com/ifb/vapoursynth-tonemap) thanks to ifb!
Cu Selurusers currently on my ignore list: deadrats, Stears555, marcorocchini -
Thanks Selur for the suggestion. Atak_Snajpera actually just recently released a new version of RipBot that does tone mapping when encoding from x265 to x264. I haven't tried it yet but I think this will be the best thing since with RipBot I can take advantage of the Distributed Encoding feature which is amazing.
Thanks again.
Similar Threads
-
Converting UHD HDR to SDR?
By tommy2010 in forum Blu-ray RippingReplies: 9Last Post: 19th Mar 2021, 04:12 -
HEVC HDR to x264 non-hdr
By mmace in forum Video ConversionReplies: 3Last Post: 20th Nov 2017, 11:19 -
If do not watch 4k hdr content, is it still worth buying a 4k hdr display o
By Stealth3si in forum Media Center PC / MediaCentersReplies: 5Last Post: 19th Sep 2016, 21:03 -
avisynth - How to write avisynth script for rgba overlay
By moelover in forum EditingReplies: 3Last Post: 13th Apr 2014, 13:24 -
My HDR function
By MattiasN in forum RestorationReplies: 6Last Post: 30th Aug 2013, 04:09