muxtools.subtitle.sub_pgs
SubFilePGS
SubFilePGS(file: PathLike | list[PathLike] | GlobSearch, container_delay: int = 0, source: PathLike | None = None, tags: dict[str, str] | None = None)
Bases: MuxingFile
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. |
None
|
tags
|
dict[str, str] | None
|
Custom matroska tags to assign to this as a track later on. |
None
|
Source code in
muxtools/subtitle/sub_pgs.py
shift
shift(shift: int, shift_is_ms: bool = False, timesource: TimeSourceT = None, timescale: TimeScaleT = None, quiet: bool = True) -> Self
Shifts all lines by any frame number with supmover.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shift
|
int
|
Number of frames to shift by |
required |
shift_is_ms
|
bool
|
If True, the shift is in milliseconds. |
False
|
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. |
None
|
quiet
|
bool
|
If True, suppresses supmover output. |
True
|
Source code in
muxtools/subtitle/sub_pgs.py
extract_from
classmethod
extract_from(fileIn: PathLike, 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
|
The input file to extract from. |
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. |