Skip to main content

PHOENiX's compilation of VapourSynth Script's and Functions

Project description

pvsfunc

pvsfunc (PHOENiX's VapourSynth Functions) is my compilation of VapourSynth Script's, Functions, and Helpers.

Python Version GitHub license CodeFactor Codacy GitHub Issues

Installation

  1. Install VapourSynth first! (this is different to the pypi/pip vapoursynth package!)
  2. pip install pvsfunc
  3. Make sure you have all the dependencies listed below installed.
  4. It's as simple as that!

Dependencies

Input File Codec Sourcer Used Dependencies
MPEG-1, MPEG-2 d2vsource (d2v) DGIndex v1.5.8 †1, mkvextract †2
Any other codec L-SMASH-WORKS (lsmas) mkvmerge †3

Installation of the sourcer cores:

  • Windows: vsrepo install package_name - You can get package names by searching for it on https://vsdb.top
  • Linux: You probably know the drill. Check your package repo's or compile it.
  • Mac: No idea how the python/vapoursynth eco-system works, sorry.

Information for Linux users:

  • If any windows-only program is a dependency, then it is supported by wine and confirmed to be safe to use with full compatability.
  • Add DGIndex to path via /etc/profile.d/ instead of ~/.profile, ~/.bashrc e.t.c as those are SHELL-exclusive PATH's, not global system-wide._

†1 Only used if the file path is not to a .d2v file, or there's no corresponding .d2v file next to the input file. Please note that this script uses this to make specifically configured .d2v files with specific settings. Supplying you're own .d2v files is unsafe.

†2 Only used if you're providing a file that isnt a .mpeg, .mpg, or .m2v (e.g. mkv, mp4) and there's no corresponding .d2v file. For efficiency and safety files are demuxed out of the container so DGIndex is reading a direct MPEG stream.

†3 Will only be used if the container has a manual frame rate set that differs to the encoded frame rate. For L-SMASH-WORKS to index the file with the correct source frame rate. PSourcer uses mkvmerge to re-mux the file, with the container-set FPS removed.

Documentation

Class Import
PSourcer from pvsfunc.psourcer import PSourcer
PDeinterlacer from pvsfunc.pdeinterlacer import PDeinterlacer

PSourcer (psourcer.py)

PSourcer (class) is a convenience wrapper for loading video files to clip variables. It's purpose is to load an input file path with the most optimal clip source based on the file. For example for an MPEG-2 video file (e.g. DVD file) will load using core.d2v.Source (and generate an optimized d2v if needed too!), whereas an MPEG-4/AVC/H.264 video will load using core.lsmas.LWLibavSource.

from pvsfunc.psourcer import PSourcer
PSourcer(str file_path[, bool debug=False])

  • file_path: Path to a file to import. Don't worry about which type of container (if any) you use.
  • debug: Use core.text to print verbose information about the file and how it has been loaded.

PDeinterlacer (pdeinterlacer.py)

PDeinterlacer (class) is a convenience wrapper for deinterlacing clips. Its unique feature is it can handle variable scan-type videos and therefore variable frame-rate videos as well. It will always return a progressive and CFR (constant frame-rate) video. It's similar to a retail DVD player as it deinterlaces only if the frame is marked as interlaced, no metrics or guessing is involved.

Just to clarify this is a deinterlacer wrapper, not it's own deinterlacer kernel. You must supply it with a kernel to use. To reduce dependencies, no base kernel is defaulted.

from pvsfunc.pdeinterlacer import PDeinterlacer
PDeinterlacer(clip, func kernel[, dict kernel_args=None, bool debug=False])

  • clip: Clip to deinterlace, this must be a clip loaded with PSourcer as it requires some of the props that PSourcer applies to clips.
  • kernel: Deinterlacer Kernel Function to use for deinterlacing. If you don't know which kernel to use, QTGMC is a good bet but may not be the answer for your specific source. For example, QTGMC isn't the best for Animated sources, or sources that have consistent amount of duplicate frames (e.g. animation).
  • kernel_args: Arguments to pass to the Kernel Function when deinterlacing.
  • debug: Debug Mode, Enable it if you want to debug frame information.

PDecimate (pdecimate.py)

PDecimate (class) is a convenience wrapper for Decimating operations. It can be used to delete frames in a variable or constant pattern, either by manual definition or by automated means (via VDecimate however, https://git.io/avoid-tdecimate). Decimation is often used for IVTC purposes to remove constant pattern pulldown frames (duplicate frames for changing frame rate).

from pvsfunc.pdecimate import PDecimate
PDecimate(clip, int cycle, list<int> offsets[, per_vob_id=True, mode=0, debug=False])

  • clip: Clip to decimate, this must be a clip loaded with PSourcer as it requires some of the props that PSourcer applies to clips.
  • cycle: Defines the amount of frames to calculate offsets on at a time.
  • offset: Mode 0's offsets are a zero-indexed list. This indicates which frames to KEEP from the cycle. Set to None when using mode=1.
  • per_vob_id: When Clip is a DVD-Video Object (.VOB): Reset the cycle every time the VOB Cell changes.
  • mode: 0=core.std.SelectEvery (recommended), 1=core.vivtc.VDecimate (be warned; its inaccurate!)
  • debug: Skip decimation and print debugging information. Useful to check if the frames that the cycle and offset settings you have provided are correct and actually decimate the right frames.

PDebox (pdebox.py)

PDebox (class) is a convenience wrapper for Deboxing operations. Ever encounter sources where there's black bars on the top and bottom, sides, or both? That means it's Letterboxed, Pillarboxed, or Windowboxed respectively. PDebox helps you remove Letterboxing and Pillarboxing, and through that Windowboxing too.

from pvsfunc.pdebox import PDebox
PDebox(clip, str aspect_ratio, [int mode=0, offset=0])

  • clip: Clip to debox.
  • aspect_ratio: Aspect Ratio you wish to crop to, in string form, e.g. "4:3".
  • mode: Mode of operation, 0=Pillarboxing, 1=Letterboxing.
  • offset: If the boxing is slightly more on one side than the other, than you can set this offset appropriately to move the area that PDebox returns. e.g. mode=0, and there's 1px more of a pillar on the right than on the left, the offset should be -1.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pvsfunc-3.11.0.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pvsfunc-3.11.0-py3-none-any.whl (29.9 kB view details)

Uploaded Python 3

File details

Details for the file pvsfunc-3.11.0.tar.gz.

File metadata

  • Download URL: pvsfunc-3.11.0.tar.gz
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for pvsfunc-3.11.0.tar.gz
Algorithm Hash digest
SHA256 a4a9626ed96c4cd7fc552c3dc4c2d618a99dd838880c9f310c4242fb0e235690
MD5 f604a030621869c822f72d5dcdddd1a1
BLAKE2b-256 b43f1b42d841c11e244eeaf37b8f73044eac7be1f694f72f1d2839058e659e1c

See more details on using hashes here.

File details

Details for the file pvsfunc-3.11.0-py3-none-any.whl.

File metadata

  • Download URL: pvsfunc-3.11.0-py3-none-any.whl
  • Upload date:
  • Size: 29.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for pvsfunc-3.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 feb783c0894810dbde1836075bf061933639abb3b475e593b01efb8ba3cc6388
MD5 0a7a9530669aec4494d40b0069793a96
BLAKE2b-256 3c77e0140551f8ff07be1aa98b704b0d5fe1fc3ecbf82090c11a975d8db3aa5e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page