Skip to main content

PHOENiX's compilation of VapourSynth Script's and Functions

Project description

pvsfunc

PHOENiX's compilation of VapourSynth Script's and Functions

pip install pvsfunc

GitHub license CodeFactor GitHub issues

Functions

Function Import
MpegProcessor from pvsfunc.mpegprocessor import MpegProcessor
decimate from pvsfunc.__init__ import decimate
debox from pvsfunc.__init__ import debox

MpegProcessor (mpegprocessor.py)

MpegProcessor (class) is a convenience wrapper for loading and using MPEG videos. It's primary function is to handle the loading and handle video fields to return a CFR (Constant frame-rate) progressive video.

from pvsfunc.mpegprocessor import MpegProcessor
MpegProcessor(filepath[, dict source_cfg={}, str dgindex_path="DGIndex.exe", bool debug=False])

  • filepath: Path to a file to import. An MKV file is recommended no matter what the video codec is.
  • source_cfg: A dictionary of key=value pairs that will be unpacked and provided to whatever clip Sourcing function get's used. You must provide a dictionary where it's key's are the source function, e.g. {"core.d2v.Source": { "rff": True }, "core.ffms2.Source": { "alpha": False }}
  • dgindex_path: A filepath to DGIndex. On Windows if the exe is in your Environment Path, you may simply put "DGIndex" or "DGIndex.exe".
  • debug: Debug Mode, Enable it if you want to debug frame information.

MpegProcessor.deinterlace

Deinterlaces frames of a video only if the frame is interlaced. All information required for deinterlacing is gotten from the frame itself, which is why you don't need to specify Field Order (tff=None is automated). It deinterlaces interlaced frames using vivtc.VFM and only uses havsfunc.QTGMC if it could not find a field match. The entire process is much quicker and much more accurate than other deinterlacing methods and even supports working on videos with multiple scan-types, frame-rates and scan-orders. The output will be CFR (Constant frame-rate).

MpegHelper.deinterlace([dict vfm_cfg={}, dict qtgmc_cfg={}, bool tff=None])

  • vfm_cfg: key=value settings to pass to core.vivtc.VFM as unpacked arguments (e.g. {"order": 1, "mode": 5}). It defaults to {"order": based on tff arg, "field": 2, "mode": 0}.
  • qtgmc_cfg: key=value settings to pass to havsfunc.QTGMC as unpacked arguments (e.g. {"FPSDivisor": 1, "Preset": "Medium"}). It defaults to Single-rate Placebo optimized output based on tff, See code for actual settings used, it will be very slow but great quality wise.
  • tff: Wheter to use Top-Field-First or not. None will automatically decide based on the first frame if possible, otherwise it defaults to True.

decimate (init.py)

IVTC (Inverse-telecine) the clip using decimation (frame deletion). This would commonly be used to revert the telecine process of FILM to NTSC but can be used for other rate changes.

from pvsfunc.__init__ import decimate
decimate([int mode=0, int cycle=5, list offsets=[0, 1, 3, 4], bool debug=False])

  • mode: 0=core.std.SelectEvery, 1=core.vivtc.VDecimate, If your source uses a constant offsets value throughout the entire source I recommend using mode=0 and ensure offsets are correct. If you need automation or the offsets tend to change throughout the source, use mode=1.
  • cycle: Chunks the clip into n frames, then deletes frames specified by offsets (if any).
  • offsets: Only used if mode=0 Starting from index of 0 which is frame 1 of the cycle, this indicates which frames to KEEP from the cycle. For example, cycle of 5, and the default offsets ([0, 1, 3, 4]) will delete the 3rd frame (because index 2 isn't in the list) every 5 (cycle) frames.
  • debug: Print debugging information

debox (init.py)

Remove Pillarboxing, Letterboxing or Windowboxing from the video by calculating a crop area based on aspect_ratio calculated against clip width and height. If it's windowboxed, use this function twice, first for Pillarboxing, then for Letterboxing.

from pvsfunc.__init__ import debox
debox(str aspect_ratio[, int mode=0, int offset=0])

  • aspect_ratio: The Aspect Ratio you wish to crop to, for example: 4:3 to crop to 4:3, 16:9 to crop to 16:9
  • mode: The Direction you wish to crop. 0=Pillarboxing (would crop sides), 1=Letterboxing (would crop top/bottom).
  • offset: If the content isnt exactly in the center of the frame, you can modify offset to move the crop area. For example, if its a mode=0 (boxing on the left and right) and the content is 2 pixels towards the right (2 pixels away from being centered), use offset=2, if the content is 2 pixels towards the left, use offset=-2

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-2.1.0.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

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

pvsfunc-2.1.0-py3-none-any.whl (20.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pvsfunc-2.1.0.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.1

File hashes

Hashes for pvsfunc-2.1.0.tar.gz
Algorithm Hash digest
SHA256 3a009600e6543db62ea4d0144198947d826ff4da482bb0880fb5d81207a04f24
MD5 62f05dbf39bd8552442c6d2e08eee6db
BLAKE2b-256 3f113f6c72061ed71d1ce0b0f43c72e93e17b14d853df490083715ee917fc31a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pvsfunc-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.1

File hashes

Hashes for pvsfunc-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4134995964b789b4e7d85eb83028e78cbd06e55928ff65e35abf5fa845df7f58
MD5 3608c176808738d53449853c573529d0
BLAKE2b-256 e5ca5f461423b2a89835ec95d4ea2a521dec51defbf2a475ed6bcb65741d8d11

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