Types
Note
You'll notice right away that there are absolutely no docstrings within these classes. The main reason for that was me being lazy. An additional, compounding factor is that many of these attributes actually lack any description even in the source material – the mkvmerge
identification output schema v20, which this library's structure is based on.
Because of the direct mapping to that schema (and, well, the laziness), I haven't attempted to document them here. The attributes represent exactly what's defined (or not defined) in the mkvmerge
documentation and that schema. Please refer to those resources for details.
MKVInfo
Bases: Base
Represents information about a matroska file as per the
mkvmerge-identification-output-schema-v20.json
.
The attributes represent exactly what's defined (or not defined)
in the mkvmerge
documentation and that schema.
Please refer to those resources for details.
identification_format_version
class-attribute
instance-attribute
identification_format_version: int | None = None
from_file
classmethod
from_file(
file: StrPath, /, *, mkvmerge: StrPath | None = None
) -> Self
Create an instance of this class from a file.
This method uses mkvmerge
in a subprocess
to extract the information.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file
|
StrPath
|
Path to the file. |
required |
mkvmerge
|
StrPath | None
|
Optional path to the |
None
|
Returns:
Type | Description |
---|---|
Self
|
An instance of this class. |
Raises:
Type | Description |
---|---|
FileNotFoundError
|
If the provided file path does not exist or is not a valid file. |
ExecutableNotFoundError
|
If the |
MKVInfoError
|
For other errors that occur during the execution of the |
Source code in src/mkvinfo/_types.py
Attachment
Bases: Base
Represents an attachment in a matroska file.
Container
Bases: Base
Represents the container.
properties
class-attribute
instance-attribute
properties: ContainerProperties = ContainerProperties()
ContainerProperties
Track
TrackProperties
Bases: Base
Represents the properties of a track.
audio_sampling_frequency
class-attribute
instance-attribute
audio_sampling_frequency: int | None = None
chromaticity_coordinates
class-attribute
instance-attribute
chromaticity_coordinates: str | None = None
content_encoding_algorithms
class-attribute
instance-attribute
content_encoding_algorithms: str | None = None
color_matrix_coefficients
class-attribute
instance-attribute
color_matrix_coefficients: int | None = None
color_transfer_characteristics
class-attribute
instance-attribute
color_transfer_characteristics: int | None = None
flag_text_descriptions
class-attribute
instance-attribute
flag_text_descriptions: bool | None = None
multiplexed_tracks
class-attribute
instance-attribute
white_color_coordinates
class-attribute
instance-attribute
white_color_coordinates: str | None = None
TrackType
Base
Bases: Struct
Base class for mkvmerge
data structures.
from_dict
classmethod
Create an instance of this class from a dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
dict[str, Any]
|
Dictionary representing the instance of this class. |
required |
Returns:
Type | Description |
---|---|
Self
|
An instance of this class. |
Source code in src/mkvinfo/_types.py
to_dict
from_json
classmethod
Create an instance of this class from JSON data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
str | bytes
|
JSON data representing the instance of this class. |
required |
Returns:
Type | Description |
---|---|
Self
|
An instance of this class. |
Source code in src/mkvinfo/_types.py
to_json
Serialize the instance of this class into a JSON string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
indent
|
int
|
Number of spaces for indentation. Set to 0 for a single line with spacing, or negative to minimize size by removing extra whitespace. |
2
|
Returns:
Type | Description |
---|---|
str
|
JSON string representing this class. |