Skip to content

Instantly share code, notes, and snippets.

@YellowOnion
Created September 7, 2020 03:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YellowOnion/cf53fb7e78881ec66846ed1a0d0a2ae8 to your computer and use it in GitHub Desktop.
Save YellowOnion/cf53fb7e78881ec66846ed1a0d0a2ae8 to your computer and use it in GitHub Desktop.
import vapoursynth as vs
import sys, os
sys.path.append(os.path.abspath(r'.\VapourSynth64Portable\Scripts'))
import LimitedSharpen2
from nnedi3_rpow2 import nnedi3_rpow2
core = vs.get_core()
video = core.ffms2.Source(source=r'YOUR FILE GOES HERE')
debug=False
w, h = 960, 720
def resize(c):
c = core.fmtc.resample (clip=c, css="444", flt=True)
c = core.fmtc.matrix (clip=c, mats="601")
c = core.fmtc.transfer (clip=c, transs="601", transd="linear", fulls=False, fulld=True)
c = core.fmtc.primaries (clip=c, prims="601-525", primd="709")
c = core.std.Expr([c], ["x " + str(270/213)+ " *",
"x " + str(270/241) + " *",
"x " + str(270/206) + " *"])
c = core.fmtc.resample (clip=c, w=w, h=h)
c = core.fmtc.transfer (clip=c, transs="linear", transd="709", fulls=True, fulld=False)
c = core.fmtc.matrix (clip=c, mat="709")
c = core.fmtc.resample (clip=c, css="420")
c = core.fmtc.bitdepth (clip=c, bits=8)
return c
video = core.deblock.Deblock(video)
video = core.std.Crop(video,4,4,0,0)
if debug:
video_old = video
video = core.knlm.KNLMeansCL(video,h=4.3,d=2)
video = core.knlm.KNLMeansCL(video,h=1.3,d=2, channels="UV")
video = core.warp.AWarpSharp2(video,thresh=128,type=0, depth=4)
video = resize(video)
video = core.warp.AWarpSharp2(video,thresh=90, type=1)
if debug:
video_old = core.resize.Lanczos(video_old, w, h)
if debug:
video = core.std.StackHorizontal([video, video_old])
video.set_output()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment