Code:
Script:
# Imports
import os
import sys
import vapoursynth as vs
# getting Vapoursynth core
core = vs.core
# Import scripts folder
scriptPath = '/Applications/Hybrid.app/Contents/MacOS/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# Import scripts
import edi_rpow2
import G41Fun
import mvsfunc
import lostfunc
import adjust
import havsfunc
# source: '/Volumes/Drobo/MyJobs/84. IBIZA CONNECTION/SUPPLIED/Ibiza Connection Master AVI PAL-ffmpeg.mov'
# current color space: YUV422P12, bit depth: 12, resolution: 720x576, fps: 25, color matrix: 470bg, yuv luminance scale: limited, scanorder: bottom field first
# Loading /Volumes/Drobo/MyJobs/84. IBIZA CONNECTION/SUPPLIED/Ibiza Connection Master AVI PAL-ffmpeg.mov using LWLibavSource
clip = core.lsmas.LWLibavSource(source="/Volumes/Drobo/MyJobs/84. IBIZA CONNECTION/SUPPLIED/Ibiza Connection Master AVI PAL-ffmpeg.mov", format="YUV422P12", cache=0, fpsnum=25, prefer_hw=0)
# Setting color matrix to 470bg.
clip = core.std.SetFrameProps(clip, _Matrix=5)
clip = clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip, _Transfer=5)
clip = clip if not core.text.FrameProps(clip,'_Primaries') else core.std.SetFrameProps(clip, _Primaries=5)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# making sure frame rate is set to 25
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# setting field order to what QTGMC should assume (bottom field first)
clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=1)
# Deinterlacing using QTGMC
clip = havsfunc.QTGMC(Input=clip, Preset="Fast", TFF=False) # new fps: 50
# make sure content is preceived as frame based
clip = core.std.SetFieldBased(clip, 0)
# adjusting frame count and rate with sRestore
clip = havsfunc.srestore(source=clip, frate=23.9760, omode=6, speed=9, thresh=16, mode=2)
# Color Adjustment
clip = adjust.Tweak(clip=clip, hue=5.00, sat=0.90, cont=0.95, bright=48, coring=True)
# adjusting color space from YUV422P12 to YUV444P16 for vsDeSpot
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P16, range_s="limited")
clip = lostfunc.DeSpot(o=clip)
clip = lostfunc.DeSpot(o=clip)
clip = lostfunc.DeSpot(o=clip)
# cropping the video to 680x544
clip = core.std.CropRel(clip=clip, left=20, right=20, top=18, bottom=14)
# adjusting color space from YUV444P16 to YUV444P8 for vsMLDegrain
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, range_s="limited")
# removing grain using MLDegrain
clip = G41Fun.MLDegrain(clip=clip, tr=1, rec=True, soft=[0,0,0])
# denoising using HQDN3D
clip = core.hqdn3d.Hqdn3d(clip=clip, lum_spac=0.00, chrom_spac=7.00, chrom_tmp=10.50)
# contrast sharpening using CAS
clip = core.cas.CAS(clip=clip, sharpness=0.700)
# deringing using HQDeringmod
clip = havsfunc.HQDeringmod(clip, nrmode=2, darkthr=3.0)
# resizing using ZNEDI3
clip = edi_rpow2.nnedi3_rpow2(clip=clip, rfactor=4) # 2720x2176
# adjusting resizing
clip = core.fmtc.resample(clip=clip, w=1440, h=1080, kernel="lanczos", interlaced=False, interlacedd=False)
# letterboxing 1440x1080 to 1920x1080
clip = core.std.AddBorders(clip=clip, left=240, right=240, top=0, bottom=0)
# adjusting output color from: YUV444P16 to YUV420P8 for x264Model
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8, range_s="limited")
# set output frame rate to 23.976fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
# Output
clip.set_output()