muxtools.muxing.tracks
_track
_track(file: PathLike, type: str | int | TrackType, name: str = '', lang: str = '', default: bool = True, forced: bool = False, delay: int = 0, args: list[str] | None = None, tags: dict[str, str] | None = None, **kwargs: Any)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file
|
PathLike
|
Filepath as string or Path object |
required |
type
|
str | int | TrackType
|
TrackType enum, or int or string (1 = 'video', 2 = 'audio', 3 = 'sub') |
required |
name
|
str
|
The track name in the resulting mkv file |
''
|
lang
|
str
|
The language tag for the track |
''
|
default
|
bool
|
Default flag |
True
|
forced
|
bool
|
Forced flag |
False
|
delay
|
int
|
Container delay of track in ms |
0
|
args
|
list[str] | None
|
Custom parameters as a list of strings to be applied to the track. |
None
|
tags
|
dict[str, str] | None
|
Custom tags to be applied to the track. |
None
|
kwargs
|
Any
|
Any other custom parameters to be added to the track. This follows the same patterns as the dynamic dataclasses. |
{}
|
Source code in
muxtools/muxing/tracks.py
delay
instance-attribute
type
instance-attribute
type: TrackType = type if isinstance(type, TrackType) else TrackType(type) if isinstance(type, int) else TrackType[type.upper()]
mkvmerge_args
Source code in
muxtools/muxing/tracks.py
VideoTrack
VideoTrack(file: PathLike | GlobSearch, name: str = '', lang: str = 'ja', default: bool = True, forced: bool = False, delay: int = 0, timecode_file: PathLike | GlobSearch | None = None, crop: int | tuple[int, int] | tuple[int, int, int, int] | None = None, args: list[str] | None = None, tags: dict[str, str] | None = None, **kwargs: Any)
Bases: _track
_track object with VIDEO type preselected and japanese language default
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timecode_file
|
PathLike | GlobSearch | None
|
Pass a path for proper vfr playback if needed. |
None
|
crop
|
int | tuple[int, int] | tuple[int, int, int, int] | None
|
Container based cropping with (horizontal, vertical) or (left, top, right, bottom). Will crop the same on all sides if passed a single integer. |
None
|
Source code in
muxtools/muxing/tracks.py
type
instance-attribute
type: TrackType = type if isinstance(type, TrackType) else TrackType(type) if isinstance(type, int) else TrackType[type.upper()]
delay
instance-attribute
mkvmerge_args
Source code in
muxtools/muxing/tracks.py
AudioTrack
AudioTrack(file: PathLike | GlobSearch, name: str = '', lang: str = 'ja', default: bool = True, forced: bool = False, delay: int = 0, args: list[str] | None = None, tags: dict[str, str] | None = None, **kwargs: Any)
Bases: _track
_track object with AUDIO type preselected and japanese language default
Source code in
muxtools/muxing/tracks.py
type
instance-attribute
type: TrackType = type if isinstance(type, TrackType) else TrackType(type) if isinstance(type, int) else TrackType[type.upper()]
delay
instance-attribute
mkvmerge_args
Source code in
muxtools/muxing/tracks.py
SubTrack
SubTrack(file: PathLike | GlobSearch, name: str = '', lang: str = 'en', default: bool = True, forced: bool = False, delay: int = 0, args: list[str] | None = None, tags: dict[str, str] | None = None, **kwargs: Any)
Bases: _track
_track object with SUB type preselected and english language default
Supports merging multiple files by passing a List of Path objects or filepath strings and of course also a GlobSearch
Source code in
muxtools/muxing/tracks.py
type
instance-attribute
type: TrackType = type if isinstance(type, TrackType) else TrackType(type) if isinstance(type, int) else TrackType[type.upper()]
delay
instance-attribute
mkvmerge_args
Source code in
muxtools/muxing/tracks.py
Premux
Premux(file: PathLike | GlobSearch, video: int | list[int] | None = -1, audio: int | list[int] | None = -1, subtitles: int | list[int] | None = -1, keep_attachments: bool = True, keep_chapters: bool = True, mkvmerge_args: str | list[str] = '--no-global-tags', assume_absolute: bool = False)
Bases: _track
Custom Track object to arbitrarily grab tracks from an existing file.
For all track params:
None means there won't be any chosen and -1 means all will be chosen.
You can also specify a single or multiple relative track numbers to choose any.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
video
|
int | list[int] | None
|
Video Track(s) to choose |
-1
|
audio
|
int | list[int] | None
|
Audio Track(s) to choose |
-1
|
subtitles
|
int | list[int] | None
|
Subtitle Track(s) to choose |
-1
|
keep_attachments
|
bool
|
Whether to keep attachments from the file. Fonts for example. |
True
|
keep_chapters
|
bool
|
Whether or not you want to keep existing chapters in the file. |
True
|
mkvmerge_args
|
str | list[str]
|
Any other args you may want to pass. |
'--no-global-tags'
|
assume_absolute
|
bool
|
Assume that the track numbers passed were already absolute to begin with. If False it will simply get absolute numbers derived from the relative ones. |
False
|
Source code in
muxtools/muxing/tracks.py
type
instance-attribute
type: TrackType = type if isinstance(type, TrackType) else TrackType(type) if isinstance(type, int) else TrackType[type.upper()]
delay
instance-attribute
mkvmerge_args
Source code in
muxtools/muxing/tracks.py
Attachment
Bases: _track
pseudo _track object for attachments
Source code in
muxtools/muxing/tracks.py
type
instance-attribute
type: TrackType = type if isinstance(type, TrackType) else TrackType(type) if isinstance(type, int) else TrackType[type.upper()]