y5gfunc.encode.mux¶
mux
¶
Functions:
| Name | Description |
|---|---|
mux_mkv |
Muxes video, audio, subtitle tracks, chapters, and fonts into an MKV file. |
mux_mkv
¶
mux_mkv(output_path: Union[str, Path], videos: Optional[Union[list[dict[str, Union[str, Path, bool]]], dict[str, Union[str, Path, bool]]]] = None, audios: Optional[Union[list[dict[str, Union[str, Path, bool]]], dict[str, Union[str, Path, bool]]]] = None, subtitles: Optional[Union[list[dict[str, Union[str, Path, bool]]], dict[str, Union[str, Path, bool]]]] = None, fonts_dir: Optional[Union[str, Path]] = None, chapters: Optional[Union[str, Path]] = None) -> Path
Muxes video, audio, subtitle tracks, chapters, and fonts into an MKV file.
Uses mkvmerge for muxing tracks and chapters, and mkvpropedit for attaching fonts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Union[str, Path]
|
Path for the output MKV file. |
required |
|
Optional[Union[list[dict[str, Union[str, Path, bool]]], dict[str, Union[str, Path, bool]]]]
|
Video track(s). Can be a single dict or a list of dicts. |
None
|
|
Optional[Union[list[dict[str, Union[str, Path, bool]]], dict[str, Union[str, Path, bool]]]]
|
Audio track(s). Can be a single dict or a list of dicts. |
None
|
|
Optional[Union[list[dict[str, Union[str, Path, bool]]], dict[str, Union[str, Path, bool]]]]
|
Subtitle track(s). Can be a single dict or a list of dicts. |
None
|
|
Optional[Union[str, Path]]
|
Optional directory containing TTF/OTF fonts to attach. |
None
|
|
Optional[Union[str, Path]]
|
Optional path to an OGM chapter file. |
None
|
Note
Track dictionary structure:
The first track of each type (video, audio, subtitle) will be marked as default unless explicitly set otherwise via the "default" key.Returns:
| Type | Description |
|---|---|
Path
|
Path to the created MKV file. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no video, audio, subtitle, chapter, or font inputs are provided. |
FileNotFoundError
|
If an input file (track, chapter) is not found. |
RuntimeError
|
If mkvmerge or mkvpropedit encounters an error during execution. |
Source code in y5gfunc/encode/mux.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | |