10.10.2021, 18:11
# Imports
import os
import sys
import vapoursynth as vs
# getting Vapoursynth core
core = vs.core
# Import scripts folder
scriptPath = 'C:/Program Files/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# Loading Plugins
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/SubtitleFilter/SubText/SubText.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/Support/TCanny.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
# Import scripts
import mcdegrainsharp
# source: 'C:\Users\Michael\Desktop\New folder\Scenes From a Marriage S01E01.mkv'
# current color space: YUV420P8, bit depth: 8, resolution: 1920x1080, fps: 23.976, color matrix: 709, yuv luminance scale: limited, scanorder: progressive
# Loading C:\Users\Michael\Desktop\New folder\Scenes From a Marriage S01E01.mkv using LWLibavSource
clip = core.lsmas.LWLibavSource(source="C:/Users/Michael/Desktop/New folder/Scenes From a Marriage S01E01.mkv", format="YUV420P8", cache=0, prefer_hw=0)
# making sure input color matrix is set as 709
clip = core.resize.Bicubic(clip, matrix_in_s="709",range_s="limited")
# making sure frame rate is set to 23.976
clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# removing grain using MCDegrain
clip = mcdegrainsharp.mcdegrainsharp(clip=clip)
# Loading image based subtitle C:\Video\Hybrid Output\Scenes From a Marriage S01E01_id_2_lang_en.sup using Subtitle
subs = core.sub.ImageFile(clip=clip, file="C:/Video/Hybrid Output/Scenes From a Marriage S01E01_id_2_lang_en.sup", blend=False)
alpha = core.std.PropToClip(subs)
subs = core.resize.Bicubic(subs, width=clip.width, height=clip.height, format=clip.format.id, matrix_s="709", range_s="limited")
gray_format = core.register_format(vs.GRAY, clip.format.sample_type, clip.format.bits_per_sample, 0, 0)
alpha = core.resize.Bicubic(alpha, width=clip.width, height=clip.height, format=gray_format.id, range_s="limited")
clip = core.std.MaskedMerge(clip, subs, alpha)
# set output frame rate to 23.976fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
# Output
clip.set_output()
Failed to evaluate the script:
Python exception: module 'vapoursynth' has no attribute 'get_core'
Traceback (most recent call last):
File "src\cython\vapoursynth.pyx", line 2756, in vapoursynth._vpy_evaluate
File "src\cython\vapoursynth.pyx", line 2757, in vapoursynth._vpy_evaluate
File "C:\Users\Michael\AppData\Local\Temp\tempPreviewVapoursynthFile11_10_00_658.vpy", line 28, in
clip = mcdegrainsharp.mcdegrainsharp(clip=clip)
File "C:\Program Files\Hybrid\64bit\vsscripts\mcdegrainsharp.py", line 42, in mcdegrainsharp
core = vs.get_core()
AttributeError: module 'vapoursynth' has no attribute 'get_core'