-
-
Save rlaphoenix/6070c5efd04a987e5d3e2366ce6e59eb to your computer and use it in GitHub Desktop.
VapourSynth Script to work on Mew Mew Power (DUB) South African PAL DVDs (WIP)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import vapoursynth as vs | |
from vapoursynth import core | |
import functools | |
from mpgg import MPGG | |
from vsdpir import dpir | |
from havsfunc import QTGMC | |
clip = MPGG("title.mkv").clip | |
clip = core.std.SetFieldBased(clip, value=2) # dwbuiten/d2vsource/issues/54 | |
clip = QTGMC(clip, TFF=True, FPSDivisor=1, Preset="Placebo") | |
# using vdecimate over selectevery so it can decide by metrics which frame is better. | |
# we know its now inconsistent with frame blending and stuff, so I think it makes more sense. | |
clip = core.vivtc.VDecimate(clip, cycle=2) | |
# convert from BT.601 to BT.709, resample as YUV444P16 temporarily | |
clip = clip.fmtc.resample(css="444").\ | |
fmtc.matrix(mats="601").\ | |
fmtc.transfer(transs="1886", transd="linear").\ | |
fmtc.primaries(prims="601-525", primd="709").\ | |
fmtc.transfer(transs="linear", transd="1886").\ | |
fmtc.matrix(matd="709").\ | |
fmtc.resample(css="444").\ | |
fmtc.bitdepth(bits=16) | |
# darken lines using Anime4K Darken HQ | |
with open("Anime4K_Darken_HQ.glsl", "r", encoding="utf8") as f: | |
glsl = f.read() | |
glsl = glsl.replace("#define STRENGTH 1.5", "#define STRENGTH 2.5") | |
clip = core.placebo.Shader(clip, shader_s=glsl) | |
# convert to RGBS, needed for DPIR | |
clip = core.resize.Spline16(clip, format=vs.RGBS) | |
# slow yet quite efficient denoising, deblocking is meh | |
clip = dpir(clip, task="denoise", strength=8) | |
# run extra DPIR(deblock) on the intro as its very blocky | |
intro_frames = list(range(2261, 3810 + 1)) | |
intro = clip[intro_frames[0]:intro_frames[-1] + 1] | |
intro = dpir(intro, task="deblock", strength=50) | |
clip = clip[0:intro_frames[0]] + intro + clip[intro_frames[-1] + 1:] | |
# srestore not helping :( | |
#clip = srestore(clip, speed=-25, thresh=12, mode=2, omode=6) | |
# remove PAR adjustments, stretch to DAR of 4:3 | |
clip = core.resize.Spline16(clip, 768, 576, src_width=720-6, src_height=576-2) | |
# convert back to YUV420P8 for encoding as YUV | |
clip = core.resize.Spline16(clip, format=vs.YUV420P8, matrix_s="709") | |
clip.set_output() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment