vsmuxtools.extension.sub
SubFile
SubFile(file: PathLike | Sequence[PathLike] | GlobSearch, container_delay: int = 0, source: PathLike | None = None, tags: dict[str, str] | None = None, encoding: str = 'utf_8_sig')
Bases: SubFile
Utility class representing an ASS/SSA subtitle file with various functions to run on.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file
|
PathLike | Sequence[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
|
str
|
Encoding used for reading and writing the subtitle files. |
'utf_8_sig'
|
Source code in
muxtools/subtitle/sub.py
truncate_by_video
truncate_by_video(source: PathLike | VideoTrack | MkvTrack | VideoFile | VideoNode, timesource: TimeSourceT = None, timescale: TimeScaleT = TimeScale.MKV) -> Self
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 |
timesource
|
TimeSourceT
|
The source of timestamps/timecodes. For details check the docstring on the type. |
None
|
timescale
|
TimeScaleT
|
Unit of time (in seconds) in terms of which frame timestamps are represented. For details check the docstring on the type. |
MKV
|
Source code in
vsmuxtools/extension/sub.py
SubFilePGS
SubFilePGS(file: PathLike | list[PathLike] | GlobSearch, container_delay: int = 0, source: PathLike | None = None, tags: dict[str, str] | None = None)
Bases: SubFilePGS
Utility class representing a PGS/SUP subtitle file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file
|
PathLike | list[PathLike] | GlobSearch
|
Can be a string, Path object or GlobSearch. |
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
|
Source code in
muxtools/subtitle/sub_pgs.py
extract_from
classmethod
extract_from(fileIn: PathLike | src_file, track: int = 0, preserve_delay: bool = False, quiet: bool = True) -> Self
Extract a PGS subtitle track from a file using ffmpeg.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fileIn
|
PathLike | src_file
|
The input file to extract from. A src_file may have at most one trim range. |
required |
track
|
int
|
The track number to extract. |
0
|
preserve_delay
|
bool
|
If True, the container delay will be preserved. |
False
|
quiet
|
bool
|
If True, suppresses ffmpeg output. |
True
|
Returns:
| Type | Description |
|---|---|
Self
|
An instance of SubFilePGS containing the extracted subtitle. |