bvsfunc

This is the documentation of bvsfunc.

Functions

bvsfunc.mods.DescaleAAMod(src[, w, h, thr, …])

Mod of DescaleAA to use nnedi3_resample, which produces sharper results than nnedi3 rpow2.

bvsfunc.util.ap_video_source(in_file[, …])

Processes audio from a given video file.

bvsfunc.util.ap_mpls_source(mpls_dict[, …])

Processes audio from a given mpls file.

bvsfunc.mods

bvsfunc.mods.descaleaamod.DescaleAAMod(src: vapoursynth.VideoNode, w: Optional[int] = None, h: int = 720, thr: int = 10, kernel: str = 'bicubic', b: Union[float, fractions.Fraction] = Fraction(0, 1), c: Union[float, fractions.Fraction] = Fraction(1, 2), taps: int = 4, expand: int = 3, inflate: int = 3, showmask: bool = False) → vapoursynth.VideoNode[source]

Mod of DescaleAA to use nnedi3_resample, which produces sharper results than nnedi3 rpow2.

Original script by Frechdachs

Original Summary:

Downscale only lineart with an inverted kernel and interpolate it back to its original resolution with NNEDI3.

Parts of higher resolution like credits are protected by a mask.

Basic idea stolen from a script made by Daiz.

Parameters
  • src (VideoNode) – Source clip

  • w (int, optional) – Downscale resolution width, defaults to 1280

  • h (int) – Downscale resolution height, defaults to 720

  • thr (int) – Threshhold used in masking, defaults to 10

  • kernel (str) – Downscaling kernel, defaults to ‘bilinear’

  • b (var) – Downscaling parameter used in fvf.Resize, defaults to 0

  • c (var) – Downscaling parameter used in fvf.Resize, defaults to 1/2

  • taps (int) – Downscaling parameter used in fvf.Resize, defaults to 4

  • expand (int) – Number of times to expand the difference mask, defaults to 3

  • inflate (int) – Number of times to inflate the difference mask, defaults to 3

  • showmask (bool) – Return mask created, defaults to False

Returns

The filtered video

Return type

VideoNode

bvsfunc.util

AudioProcessor PATH Executable Dependencies

AudioProcessor Examples

import bvsfunc as bvs

# m2ts example
filepath = r"E:\0000.m2ts"
src = SourceFilter(filepath)
src = src[:500] + src[1000:2000]
process = False
if process:
    audiotrims = [[None,500],[1000,2000]]
    files = bvs.util.ap_video_source(infile=filepath, trimlist=autotrims, noflac=True, silent=True)

# mpls example
filepath = r"E:\BD_VIDEO"
mpls = core.mpls.Read(filepath, 2)
src = core.std.Splice([core.lsmas.LWLibavSource(mpls['clip'][i]) for i in range(mpls['count'])])
src = src[:500] + src[1000:2000]
process = False
if process:
    audiotrims = [[None,500],[1000,2000]]
    files = bvs.util.ap_mpls_source(mplsdict=mpls, trimlist=audiotrims, noflac=True, silent=False)

AudioProcessor Tips

  • For a truly silent experience with eac3to, delete the success.wav and error.wav files in your install directory

bvsfunc.util.AudioProcessor.mpls_source(mpls_dict: str, trim_list: Union[List[Optional[int]], List[List[Optional[int]]]] = None, out_file: Optional[str] = None, out_dir: Optional[str] = None, trims_framerate: Optional[fractions.Fraction] = None, flac: bool = True, aac: bool = True, wav: bool = False, overwrite: bool = False, silent: bool = True)[source]

Processes audio from a given mpls file. Functions include trimming losslessly and encoding to flac and/or aac. Will concatonate the aligned audio streams when mpls defines multiple video files.

Notes on trim_list:

Supports: single, multiple, empty ended, and negative trims.

Format: [[inclusive,exclusive],…].

Examples:

trim_list = [100,500]

trim_list = [None,500]

trim_list = [100,None]

trim_list = [[None,500],[1000,2000],[100,None]]

trim_list = [-1000,None]

trim_list = [None,-24]

Note: Trims are absolute references to the source, not relative to each other.

Parameters
  • mpls_dict ([type]) – The full filepath to the mpls file containing videos to process.

  • trim_list (list, optional) – A list or a list of lists of trims following python slice syntax, defaults to None.

  • trims_framerate (Fraction, optional) – Framerate of your source. Overrides automatic detection. If your source framerate is not the same as your output framerate, such as with interlaced sources, you Can be retrieved with core.fps(). Defaults to None.

  • out_dir (string) – A string path for the file output directory. Defaults the script file location. Requires the string format to be: r”path”

  • out_file (string) – A string prefix to name the output files with.

  • frames_total (int, optional) – The total number of frames in the clip before trimming. Useful for VFR, where this must be the total before any trimming. Otherwise, probably just leave it blank.

  • flac (bool, optional) – Enable FLAC encoding, defaults to True.

  • aac (bool, optional) – Enable AAC encoding, defaults to True.

  • wav (bool, optional) – Retain output of trimmed wav files, defaults to False.

  • overwrite (bool, optional) – Overwrite existing files (including wav) and forces re-extract and re-encode, deaults to False.

  • silent (bool, optional) – Silence eac3to, ffmpeg, flac, and qaac, defaults to True.

Returns

A list of filepaths to all of the final processed files.

Return type

list

bvsfunc.util.AudioProcessor.video_source(in_file: str, trim_list: Union[List[Optional[int]], List[List[Optional[int]]]] = None, out_file: Optional[str] = None, out_dir: Optional[str] = None, trims_framerate: Optional[fractions.Fraction] = None, frames_total: Optional[int] = None, flac: bool = True, aac: bool = True, wav: bool = False, overwrite: bool = False, silent: bool = True)[source]

Processes audio from a given video file. Functions include trimming losslessly and encoding to flac and/or aac.

Notes on trim_list:

Supports: single, multiple, empty ended, and negative trims.

Format: [[inclusive,exclusive],…].

Examples:

trim_list = [100,500]

trim_list = [None,500]

trim_list = [100,None]

trim_list = [[None,500],[1000,2000],[100,None]]

trim_list = [-1000,None]

trim_list = [None,-24]

Note: Trims are absolute references to the source, not relative to each other.

Parameters
  • in_file (string) – The full filepath to the video file containing audio to process.

  • trim_list (list, optional) – A list or a list of lists of trims following python slice syntax, defaults to None.

  • trims_framerate (Fraction, optional) – Framerate of your source. Overrides automatic detection. If your source framerate is not the same as your output framerate, such as with interlaced sources, you Can be retrieved with core.fps(). Defaults to None.

  • out_dir (string) – A string path for the file output directory. Defaults the script file location. Requires the string format to be: r”path”

  • out_file (string) – A string prefix to name the output files with.

  • frames_total (int, optional) – The total number of frames in the clip before trimming. Useful for VFR, where this must be the total before any trimming. Otherwise, probably just leave it blank.

  • flac (bool, optional) – Enable FLAC encoding, defaults to True.

  • aac (bool, optional) – Enable AAC encoding, defaults to True.

  • wav (bool, optional) – Retain output of trimmed wav files, defaults to False.

  • overwrite (bool, optional) – Overwrite existing files (including wav) and forces re-extract and re-encode, deaults to False.

  • silent (bool, optional) – Silence eac3to, ffmpeg, flac, and qaac, defaults to True.

Raises

SystemExit – Missing dependencies.

Returns

A list of filepaths to all of the final processed files.

Return type

list