extension
do_audio(fileIn, track=0, trims=None, fps=None, num_frames=0, extractor=FFMpeg.Extractor(), trimmer=AutoTrimmer(), encoder=AutoEncoder(), quiet=True, output=None)
One-liner to handle the whole audio processing
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fileIn
|
PathLike | src_file | AudioNode
|
Input file or src_file/FileInfo or AudioNode |
required |
track
|
int
|
Audio track number |
0
|
trims
|
Trim | list[Trim] | None
|
Frame ranges to trim and/or combine, e.g. (24, -24) or [(24, 500), (700, 900)] If your passed src_file has a trim it will use it. Any other trims passed here will overwrite it. |
None
|
fps
|
Fraction | PathLike | None
|
FPS Fraction used for the conversion to time Will be taken from input if it's a src_file and assume the usual 24 if not. Also accepts a timecode (v2) file. |
None
|
num_frames
|
int
|
Total number of frames, used for negative numbers in trims Will be taken from input if it's a src_file |
0
|
extractor
|
Extractor
|
Tool used to extract the audio (Will default to None if an AudioNode gets passed) |
Extractor()
|
trimmer
|
Trimmer | None
|
Tool used to trim the audio AutoTrimmer means it will choose ffmpeg for lossy and Sox for lossless |
AutoTrimmer()
|
encoder
|
Encoder | None
|
Tool used to encode the audio AutoEncoder means it won't reencode lossy and choose opus otherwise |
AutoEncoder()
|
quiet
|
bool
|
Whether the tool output should be visible |
True
|
output
|
PathLike | None
|
Custom output file or directory, extensions will be automatically added |
None
|
Returns:
Type | Description |
---|---|
AudioFile
|
AudioFile Object containing file path, delays and source |
Source code in vsmuxtools/extension/audio.py
export_audionode(node, outfile=None)
Exports an audionode to a wav/w64 file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node
|
AudioNode
|
Your audionode |
required |
outfile
|
PathLike | None
|
Custom output path if any |
None
|
Returns:
Type | Description |
---|---|
Path
|
Returns path |
Source code in vsmuxtools/extension/audio.py
Chapters
Bases: Chapters
Source code in vsmuxtools/extension/chapters.py
__init__(chapter_source, fps=None, _print=True)
Convenience class for chapters
Parameters:
Name | Type | Description | Default |
---|---|---|---|
chapter_source
|
src_file | PathLike | GlobSearch | Chapter | list[Chapter]
|
Input either src_file/FileInfo, txt with ogm chapters, xml or (a list of) self defined chapters. |
required |
fps
|
Fraction | PathLike | None
|
Needed for timestamp convertion. Gets the fps from the clip if src_file and otherwise assumes 24000/1001. Also accepts a timecode (v2) file. |
None
|
_print
|
bool
|
Prints chapters after parsing and after trimming. |
True
|
Source code in vsmuxtools/extension/chapters.py
SubFile
dataclass
Bases: SubFile
Utility class representing a subtitle file with various functions to run on.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file
|
PathLike | list[PathLike] | GlobSearch
|
Can be a string, Path object or GlobSearch. If the GlobSearch returns multiple results or if a list was passed it will merge them. |
required |
container_delay
|
int
|
Set a container delay used in the muxing process later. |
0
|
source
|
PathLike | None
|
The file this sub originates from, will be set by the constructor. |
None
|
encoding
|
Encoding used for reading and writing the subtitle files. |
required |
Source code in vsmuxtools/extension/sub.py
truncate_by_video(source, fps=None)
Removes lines that start after the video ends and trims lines that extend past it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source
|
PathLike | VideoTrack | MkvTrack | VideoFile | VideoNode
|
Can be any video file or a VideoNode |
required |
fps
|
Fraction | PathLike | None
|
FPS Fraction; Will be parsed from the video by default. Also accepts a timecode (v2) file. |
None
|