yuuno.vs.clip module

class yuuno.vs.clip.VapourSynthAlphaClip(clip)[source]

Bases: object

class yuuno.vs.clip.VapourSynthAlphaFrameWrapper(*args, **kwargs)[source]

Bases: traitlets.traitlets.HasTraits

alpha

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

clip

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

color
to_pil()[source]
class yuuno.vs.clip.VapourSynthClip(clip)[source]

Bases: yuuno.vs.clip.VapourSynthClipMixin, traitlets.traitlets.HasTraits

clip

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

class yuuno.vs.clip.VapourSynthClipMixin(*args, **kwargs)[source]

Bases: traitlets.traitlets.HasTraits

extension
to_compat_rgb32(frame: vapoursynth.VideoFrame) → vapoursynth.VideoNode[source]
class yuuno.vs.clip.VapourSynthFrame(frame)[source]

Bases: yuuno.vs.clip.VapourSynthClipMixin, traitlets.traitlets.HasTraits

clip

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

frame

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

class yuuno.vs.clip.VapourSynthFrameWrapper(*args, **kwargs)[source]

Bases: traitlets.traitlets.HasTraits, yuuno.clip.Frame

compat_frame

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

frame

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

pil_cache

A trait whose value must be an instance of a specified class.

The value can also be an instance of a subclass of the specified class.

Subclasses can declare default classes by overriding the klass attribute

to_pil() → PIL.Image.Image[source]
yuuno.vs.clip.calculate_size(frame: vapoursynth.VideoFrame, planeno: int) → typing.Tuple[int, int][source]

Calculates the size of the plane

Parameters:
  • frame – The frame
  • planeno – The plane
Returns:

(width, height)

yuuno.vs.clip.extract_plane(frame: vapoursynth.VideoFrame, planeno: int, *, compat: bool = False) → PIL.Image.Image[source]

Extracts the plane.

Will use the new VapourSynth API for extracting the plane that has been added in R37 when available. On older systems it will use the more error-prone get_read_ptr-API.

Parameters:
  • frame – The frame
  • planeno – The plane number
  • compat – Are we dealing with a compat format.
Returns:

The extracted image.

yuuno.vs.clip.extract_plane_new(frame: vapoursynth.VideoFrame, planeno: int, *, compat: bool = False) → PIL.Image.Image[source]

Extracts the plane with the VapourSynth R37+ array-API.

Parameters:
  • frame – The frame
  • planeno – The plane number
  • compat – Are we dealing with a compat format.
Returns:

The extracted image.

yuuno.vs.clip.extract_plane_r36compat(frame: vapoursynth.VideoFrame, planeno: int, *, compat: bool = False) → PIL.Image.Image[source]

Extracts the plane using the old VapourSynth API for reading a frame.

Since we are doing raw memory operations using ctypes, this function has proven to be prone to SIGSEGV while developing.

This code will subseqently be dropped from this codebase when VapourSynth r36 is officially dropped with the official release of R39.

Parameters:
  • frame – The frame
  • planeno – The plane number
  • compat – Are we dealing with a compat format.
Returns:

The extracted image.