Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def prepare_vs_output(vs_output: vs.VideoNode) -> vs.VideoNode:
def non_subsampled_format(fmt: vs.Format) -> vs.Format:
if fmt.id == vs.COMPATBGR32.value:
return vs.RGB24 # type: ignore
elif fmt.id == vs.COMPATYUY2.value:
return vs.YUV444P8 # type: ignore
else:
return vs.core.register_format(
color_family=fmt.color_family,
sample_type=fmt.sample_type,
bits_per_sample=fmt.bits_per_sample,
subsampling_w=0,
subsampling_h=0
)
return vs.core.resize.Bicubic(
vs_output,
format=non_subsampled_format(vs_output.format))
def Conv(clip,txt):
if (ref.width % clip.width == 0) and (ref.height % clip.height == 0):
clip = core.resize.Point(clip, ref.width, ref.height, matrix_s = matrix_s, format=dFormat, matrix_in=mvs.GetMatrix(clip, matrix, True, True), range_in=full, dither_type=dither, prefer_props=prefer_props)
else:
clip = core.resize.Bicubic(clip, ref.width, ref.height, matrix_s = matrix_s, format=dFormat, matrix_in=mvs.GetMatrix(clip, matrix, True, True), range_in=full, filter_param_a=0, filter_param_b=0.5, dither_type=dither, prefer_props=prefer_props)
if txt is not None:
clip = core.text.Text(clip, txt, alignment = alignment)
return clip
if not isinstance(label, str):
raise TypeError(
'Label of Scene is not a string. It\'s most probably corrupted.')
except KeyError:
raise KeyError(
'Scene lacks one or more of its fields. It\'s most probably corrupted. Check those: {}.'
.format(', '.join(self.__slots__)))
self.__init__(start, end, label) # type: ignore
class Output(YAMLObject):
yaml_tag = '!Output'
class Resizer:
Bilinear = vs.core.resize.Bilinear
Bicubic = vs.core.resize.Bicubic
Point = vs.core.resize.Point
Lanczos = vs.core.resize.Lanczos
Spline16 = vs.core.resize.Spline16
Spline36 = vs.core.resize.Spline36
class Matrix:
values = {
0: 'rgb',
1: '709',
2: 'unspec',
# 3: 'reserved',
4: 'fcc',
5: '470bg',
6: '170m',
7: '240m',
alphaclip = None
if key[4]:
clip, alphaclip = core.imwri.Read(sizeformatdict[key], mismatch=False, alpha=True)
else:
clip = core.imwri.Read(sizeformatdict[key], mismatch=False, alpha=False)
clip = core.std.AssumeFPS(clip, fpsnum=1)
original = clip
clip = func(clip)
if key[4]:
alphaclip = core.std.AssumeFPS(alphaclip, fpsnum=1)
origalpha = alphaclip
alphaclip = alphafunc(alphaclip)
#Defaults to resizing the alpha layer to the color clip size.
#Technically optional, but I'm not sure IMWRI supports a format where the alpha is smaller than the image.
if ((clip.width, clip.height) != (alphaclip.width, alphaclip.height)) and scalealpha:
alphaclip = core.resize.Spline36(alphaclip, clip.width, clip.height)
if writeimages:
if key[4]:
clip = core.imwri.Write(clip, imgformat = imgformat, filename = os.path.join(tempdir, r"%d." + imgformat ), firstnum = start, quality = quality, overwrite=True, compression_type = compression_type, alpha = alphaclip)
else:
clip = core.imwri.Write(clip, imgformat = imgformat, filename = os.path.join(tempdir, r"%d." + imgformat ), firstnum = start, quality = quality, overwrite=True, compression_type = compression_type)
#Don't bother converting if previewing is disabled
if nopreview:
return clip
if not key[4]:
alphaclip = None
origalpha = None
return previewfunc(clip, alphaclip, original, origalpha)
def Conv(clip,txt):
if (ref.width % clip.width == 0) and (ref.height % clip.height == 0):
clip = core.resize.Point(clip, ref.width, ref.height, matrix_s = matrix_s, format=dFormat, matrix_in=mvs.GetMatrix(clip, matrix, True, True), range_in=full, dither_type=dither, prefer_props=prefer_props)
else:
clip = core.resize.Bicubic(clip, ref.width, ref.height, matrix_s = matrix_s, format=dFormat, matrix_in=mvs.GetMatrix(clip, matrix, True, True), range_in=full, filter_param_a=0, filter_param_b=0.5, dither_type=dither, prefer_props=prefer_props)
if txt is not None:
clip = core.text.Text(clip, txt, alignment = alignment)
return clip
def __lt__(self, other: Scene) -> bool:
return not self.__ge__(other)
def duration(self) -> FrameInterval:
return self.end - self.start
def __contains__(self, frame: Frame) -> bool:
return self.start <= frame <= self.end
class Output:
from .customized import GraphicsItem
class Resizer:
Bilinear = vs_core.resize.Bilinear
Bicubic = vs_core.resize.Bicubic
Point = vs_core.resize.Point
Lanczos = vs_core.resize.Lanczos
Spline16 = vs_core.resize.Spline16
Spline36 = vs_core.resize.Spline36
class Matrix:
values = {
0: 'rgb',
1: '709',
2: 'unspec',
# 3: 'reserved',
4: 'fcc',
5: '470bg',
6: '170m',
7: '240m',
8: 'ycgco',
'Label of Scene is not a string. It\'s most probably corrupted.')
except KeyError:
raise KeyError(
'Scene lacks one or more of its fields. It\'s most probably corrupted. Check those: {}.'
.format(', '.join(self.__slots__)))
self.__init__(start, end, label) # type: ignore
class Output(YAMLObject):
yaml_tag = '!Output'
class Resizer:
Bilinear = vs.core.resize.Bilinear
Bicubic = vs.core.resize.Bicubic
Point = vs.core.resize.Point
Lanczos = vs.core.resize.Lanczos
Spline16 = vs.core.resize.Spline16
Spline36 = vs.core.resize.Spline36
class Matrix:
values = {
0: 'rgb',
1: '709',
2: 'unspec',
# 3: 'reserved',
4: 'fcc',
5: '470bg',
6: '170m',
7: '240m',
8: 'ycgco',
9: '2020ncl',
def __lt__(self, other: Scene) -> bool:
return not self.__ge__(other)
def duration(self) -> FrameInterval:
return self.end - self.start
def __contains__(self, frame: Frame) -> bool:
return self.start <= frame <= self.end
class Output:
from .customized import GraphicsItem
class Resizer:
Bilinear = vs_core.resize.Bilinear
Bicubic = vs_core.resize.Bicubic
Point = vs_core.resize.Point
Lanczos = vs_core.resize.Lanczos
Spline16 = vs_core.resize.Spline16
Spline36 = vs_core.resize.Spline36
class Matrix:
values = {
0: 'rgb',
1: '709',
2: 'unspec',
# 3: 'reserved',
4: 'fcc',
5: '470bg',
6: '170m',
7: '240m',