Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Revan654 committed Sep 23, 2018
1 parent ed08a94 commit 8e59b71
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 39 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
$code = @"
# Convert Bluray Video (BT2020) to 10bit 1000nits (BT.709) High Dynamic Range Video for Full HDR10.
# Don't Forget to Disable No Open GOP and Set your VBV.
#You can Use other Color Options like Tweak, Level or Range to make any other needed changes to the Color & Brightness(If Needed).
SetFilterMTMode("z_ConvertFormat", MT_MULTI_INSTANCE) # May not be needed.
ConvertBits(10)
z_ConvertFormat(pixel_type="RGBPS",colorspace_op="2020ncl:st2084:2020:l=>rgb:linear:2020:l", dither_type="none")
DGHable()
z_ConvertFormat(pixel_type="YV12",colorspace_op="rgb:linear:2020:l=>709:709:709:l",dither_type="ordered")
prefetch(4)
"@

$activeProject = [ShortcutModule]::p

if ($activeProject.Script.Engine -ne [ScriptEngine]::Avisynth) {
[MainModule]::MsgError("Load Avisynth first", "Filters > Filter Setup > Avisynth")
exit
}

if ($activeProject.VideoEncoder.GetType().Name -ne "x265Enc") {
[MainModule]::MsgError("Load x265 first")
exit
}

$commands = [ShortcutModule]::g.DefaultCommands
$commands.SetFilter("HDR", "Color", $code)
$commands.ImportVideoEncoderCommandLine("--output-depth 10 --colorprim bt2020 --colormatrix bt2020nc --transfer smpte2084 --master-display G(8500,39850)B(6550,2300)R(35400,14600)WP(15635,16450)L(10000000,1) --hrd --aud --repeat-headers --max-cll 1000,180")
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
$code = @"
# Convert Bluray Video (BT2020) to 10bit 1000nits (BT.709) High Dynamic Range Video for Full HDR10.
# Don't Forget to Disable No Open GOP and Set your VBV.
clip = core.fmtc.resample(clip, css = '444')
clip = core.fmtc.matrix(clip, mat = '2020', fulls = False, fulld = True)
clip = core.fmtc.transfer(clip, transs = 'linear', transd = 'linear', gcor = 2.4)
clip = core.fmtc.transfer(clip, transs = 'linear', transd = '2084', cont = 1000 / 10000)
clip = core.fmtc.transfer(clip, transs = 'linear', transd = 'linear')
clip = core.fmtc.matrix(clip, mat = '709', fulls = True, fulld = False)
clip = core.fmtc.resample(clip, css = '420')
"@

$activeProject = [ShortcutModule]::p

if ($activeProject.Script.Engine -ne [ScriptEngine]::VapourSynth) {
[MainModule]::MsgError("Load VapourSynth first", "Filters > Filter Setup > VapourSynth")
exit
}

if ($activeProject.VideoEncoder.GetType().Name -ne "x265Enc") {
[MainModule]::MsgError("Load x265 first")
exit
}

$commands = [ShortcutModule]::g.DefaultCommands
$commands.SetFilter("HDR", "Color", $code)
$commands.ImportVideoEncoderCommandLine("--output-depth 10 --colorprim bt2020 --colormatrix bt2020nc --transfer smpte2084 --master-display G(8500,39850)B(6550,2300)R(35400,14600)WP(15635,16450)L(10000000,1) --hrd --aud --repeat-headers --max-cll 1000,180")
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
$code = @"
# Convert Bluray Video (BT709) to 10bit 400nits (MaxFALL) High Dynamic Range Video.
# In some scenes, HDR output of this script saves as much as 50% bitrate in x265 CRF mode and doubles the quality in x265 2pass CBR mode.
# You must have a HDR compliant TV to play the output file.
# Script is 100% compliant with current HDR standards and has been tested extensively on HDR compliant TVs.
# Do NOT modify the script. Input and output are guaranteed to look 100% identical with default script settings. All x265 HDR switches are automatically set by Staxrip.
# Current UHD Bluray and HDR TV specifications only support exactly 400nits MaxFALL. Not more, not less. Standards will not change for many years.
# Do NOT change MaxFALL. Hardware players and TVs will not correct/scale it for you. White level and brightness will be off.
# MaxFALL and MaxCLL are both equal to 400nits. You can not independently set them.
# Do not change the gamma extraction to a value other than 2.2 specified in the script. It is NOT related to the gamma correction values used by the studios when mastering Bluray video. It is NOT related to the gamma settings of your monitor/TV either.
# We are extracting 2.2 gamma only because the exact same amount will be added back by SMPTE 2084. Not more, not less.
# SMPTE 2084 is a specialized HDR perceptual quantizer that already has built in gamma encoding that is exactly equivalent to a 2.2 pure gamma function.
clip = core.fmtc.resample(clip, css = '444')
clip = core.fmtc.matrix(clip, mat = '709', fulls = False, fulld = True)
clip = core.fmtc.transfer(clip, transs = 'linear', transd = 'linear', gcor = 2.2)
clip = core.fmtc.transfer(clip, transs = 'linear', transd = '2084', cont = 400 / 10000)
clip = core.fmtc.transfer(clip, transs = 'linear', transd = 'linear')
clip = core.fmtc.matrix(clip, mat = '709', fulls = True, fulld = False)
clip = core.fmtc.resample(clip, css = '420')
"@

$activeProject = [ShortcutModule]::p

if ($activeProject.Script.Engine -ne [ScriptEngine]::VapourSynth) {
[MainModule]::MsgError("Load VapourSynth first", "Filters > Filter Setup > VapourSynth")
exit
}

if ($activeProject.VideoEncoder.GetType().Name -ne "x265Enc") {
[MainModule]::MsgError("Load x265 first")
exit
}

$commands = [ShortcutModule]::g.DefaultCommands
$commands.SetFilter("HDR", "Color", $code)
$code = @"
# Convert Bluray Video (BT709) to 10bit 400nits (MaxFALL) High Dynamic Range Video.
# In some scenes, HDR output of this script saves as much as 50% bitrate in x265 CRF mode and doubles the quality in x265 2pass CBR mode.
# You must have a HDR compliant TV to play the output file.
# Script is 100% compliant with current HDR standards and has been tested extensively on HDR compliant TVs.
# Do NOT modify the script. Input and output are guaranteed to look 100% identical with default script settings. All x265 HDR switches are automatically set by Staxrip.
# Current UHD Bluray and HDR TV specifications only support exactly 400nits MaxFALL. Not more, not less. Standards will not change for many years.
# Do NOT change MaxFALL. Hardware players and TVs will not correct/scale it for you. White level and brightness will be off.
# MaxFALL and MaxCLL are both equal to 400nits. You can not independently set them.
# Do not change the gamma extraction to a value other than 2.2 specified in the script. It is NOT related to the gamma correction values used by the studios when mastering Bluray video. It is NOT related to the gamma settings of your monitor/TV either.
# We are extracting 2.2 gamma only because the exact same amount will be added back by SMPTE 2084. Not more, not less.
# SMPTE 2084 is a specialized HDR perceptual quantizer that already has built in gamma encoding that is exactly equivalent to a 2.2 pure gamma function.
clip = core.fmtc.resample(clip, css = '444')
clip = core.fmtc.matrix(clip, mat = '709', fulls = False, fulld = True)
clip = core.fmtc.transfer(clip, transs = 'linear', transd = 'linear', gcor = 2.2)
clip = core.fmtc.transfer(clip, transs = 'linear', transd = '2084', cont = 400 / 10000)
clip = core.fmtc.transfer(clip, transs = 'linear', transd = 'linear')
clip = core.fmtc.matrix(clip, mat = '709', fulls = True, fulld = False)
clip = core.fmtc.resample(clip, css = '420')
"@

$activeProject = [ShortcutModule]::p

if ($activeProject.Script.Engine -ne [ScriptEngine]::VapourSynth) {
[MainModule]::MsgError("Load VapourSynth first", "Filters > Filter Setup > VapourSynth")
exit
}

if ($activeProject.VideoEncoder.GetType().Name -ne "x265Enc") {
[MainModule]::MsgError("Load x265 first")
exit
}

$commands = [ShortcutModule]::g.DefaultCommands
$commands.SetFilter("HDR", "Color", $code)
$commands.ImportVideoEncoderCommandLine("--output-depth 10 --colorprim bt709 --colormatrix bt709 --transfer smpte-st-2084 --master-display G(15000,30000)B(7500,3000)R(32000,16500)WP(15635,16450)L(4000000,1) --max-cll 400,400")
12 changes: 9 additions & 3 deletions docs/powershell/_AfterSourceLoaded.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# This script handles the AfterSourceLoaded event, remove the underscore from the
# filename in order to enable it. The script sets a deinterlace filter if the
# MediaInfo property 'ScanType' returns 'Interlaced'
# filename in order to enable it. The script sets QTGMC filter to type 0 (Interlaced) if the
# MediaInfo property 'ScanType' returns 'Interlaced'.
# However if it's not 'interlaced' and the Scantype is Progressive it will set QTGMC to type 1 (Progressive) if the
# MediaInfo property 'ScanType' returns 'Progressive'.

# active project
$p = [ShortcutModule]::p
Expand All @@ -10,5 +12,9 @@ $g = [ShortcutModule]::g

if ([MediaInfo]::GetVideo($p.FirstOriginalSourceFile, "ScanType") -eq "Interlaced")
{
$p.Script.SetFilter("yadifmod2", "Field", "yadifmod2()")
$p.Script.SetFilter("QTGMC", "Field", "QTGMC(Preset = "Medium", InputType=0, SourceMatch=3, Sharpness=0.2, EdiThreads=8)")
}
elif ([MediaInfo]::GetVideo($p.FirstOriginalSourceFile, "ScanType") -eq "Progressive")
{
$p.Script.SetFilter("QTGMC", "Field", "QTGMC(Preset = "Medium", InputType=1, Sharpness=0.2, EdiThreads=8)")
}

0 comments on commit 8e59b71

Please sign in to comment.