Add script for interlaced footage

This commit is contained in:
Jonatan Nilsson 2023-12-07 03:13:55 +00:00
parent 372d50cdc9
commit 09c46afad4
3 changed files with 85 additions and 0 deletions

View file

@ -0,0 +1,13 @@
@ECHO OFF
REM TestWrapper.bat
cd /D "%~dp0"
SET args='%1'
:More
SHIFT
IF '%1' == '' GOTO Done
SET args=%args%,'%1'
GOTO More
:Done
Powershell.exe -noprofile -command "& {.\Script_Interlaced.ps1 %args%}"
pause
exit

39
Script_Interlaced.ps1 Normal file
View file

@ -0,0 +1,39 @@
param ( [string[]] $Paths )
Write-Host ""
cd Programs
$Paths | foreach {
$Path = $_
$WithoutExtension = [IO.Path]::ChangeExtension($Path, '')
$ScriptFile = $WithoutExtension + "script.vpy"
$ArchiveFile = $WithoutExtension + "archive.mkv"
Write-Host "==============================================================================="
Write-Host ""
Write-Host " Input video: $Path"
Write-Host " Script file: $ScriptFile"
Write-Host " Output video: $ArchiveFile"
Write-Host ""
Write-Host ""
(Get-Content ..\template_interlaced.vpy).replace('[INPUTFILE]', $Path.replace('\', '/')) | Set-Content -LiteralPath "$ScriptFile"
.\ffmpeg.exe -hide_banner -y -f vapoursynth -i "$ScriptFile" -i "$Path" -map 0:v:0 -map 1:a:0 -c:v libx265 -profile:v main10 -crf 17.4 -x265-params "me=star:subme=5:limit-modes=1:rect=1:amp=1:max-merge=5:no-early-skip=1:bframes=16:ref=6:rc-lookahead=60:limit-refs=0:rd=6:rdoq-level=2:psy-rdoq=1.00:sao=0" -c:a copy "$ArchiveFile"
Remove-Item $ScriptFile
Remove-Item "$($Path).lwi"
cd ..
.\Script_Web.ps1 "$ArchiveFile"
cd Programs
Write-Host "==============================================================================="
}
cd ..

33
template_interlaced.vpy Normal file
View file

@ -0,0 +1,33 @@
import vapoursynth as vs
core = vs.core
import havsfunc
clip = core.lsmas.LWLibavSource(source="[INPUTFILE]")
clip = havsfunc.QTGMC(Input=clip, Preset="Slow", InputType=0, TFF=True, FPSDivisor=1, TR2=2, Sharpness=0.3, SourceMatch=1, Lossless=2, MatchPreset="Slow", MatchPreset2="Slow")
clip = core.resize.Spline36(clip, format=vs.YUV420P10)
compSharp = core.cas.CAS(clip, sharpness=0.2) # Sharpen clip for non-shown motion compensated frames, helps retain higher frequency detail at the expense of denoise strength
super = core.mv.Super(clip, hpad=16, vpad=16, rfilter=4) # all levels for MAnalyse
superSharp = core.mv.Super(compSharp, hpad=16, vpad=16, rfilter=4) # all levels for MAnalyse
backward2 = core.mv.Analyse(super, isb=True, blksize=16, overlap=8, delta=2, search=3, dct=6)
backward = core.mv.Analyse(super, isb=True, blksize=16, overlap=8, search=3, dct=6)
forward = core.mv.Analyse(super, isb=False, blksize=16, overlap=8, search=3, dct=6)
forward2 = core.mv.Analyse(super, isb=False, blksize=16, overlap=8, delta=2, search=3, dct=6)
backward2 = core.mv.Recalculate(super, backward2, blksize=8, overlap=4, search=3, divide=2, dct=6) # Optionally Recalculate for higher consistency / quality
backward = core.mv.Recalculate(super, backward, blksize=8, overlap=4, search=3, divide=2, dct=6)
forward = core.mv.Recalculate(super, forward, blksize=8, overlap=4, search=3, divide=2, dct=6)
forward2 = core.mv.Recalculate(super, forward2, blksize=8, overlap=4, search=3, divide=2, dct=6)
backward_re2 = core.mv.Finest(backward2)
backward_re = core.mv.Finest(backward)
forward_re = core.mv.Finest(forward)
forward_re2 = core.mv.Finest(forward2)
clip = core.mv.Degrain2(clip, superSharp, backward_re, forward_re, backward_re2, forward_re2, thsad=220, thscd1=300)
clip.set_output(0)