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
dataclass
MKVInfo(
*,
file_name: str,
container: Container = Container(),
attachments: tuple[Attachment, ...] = (),
tracks: tuple[Track, ...] = (),
identification_format_version: int | None = None,
)
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.
container
class-attribute
instance-attribute
identification_format_version
class-attribute
instance-attribute
identification_format_version: int | None = None
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
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
dataclass
Attachment(
*,
file_name: str,
id: int,
size: int,
content_type: str | None = None,
description: str | None = None,
)
Represents an attachment in a matroska file.
Container
dataclass
Container(
*,
recognized: bool = False,
supported: bool = False,
properties: ContainerProperties = ContainerProperties(),
type: str | None = None,
)
Represents the container.
properties
class-attribute
instance-attribute
properties: ContainerProperties = field(
default_factory=ContainerProperties
)
ContainerProperties
dataclass
ContainerProperties(
*,
container_type: int | None = None,
date_local: datetime | None = None,
date_utc: datetime | None = None,
duration: int | None = None,
is_providing_timestamps: bool | None = None,
muxing_application: str | None = None,
timestamp_scale: int | None = None,
title: str | None = None,
writing_application: str | None = None,
)
Represents the properties of the container.
is_providing_timestamps
class-attribute
instance-attribute
is_providing_timestamps: bool | None = None
Track
dataclass
Track(
*,
codec: str,
id: int,
type: TrackType,
properties: TrackProperties = TrackProperties(),
)
Represents a track in a matroska file.
properties
class-attribute
instance-attribute
properties: TrackProperties = field(
default_factory=TrackProperties
)
TrackProperties
dataclass
TrackProperties(
*,
alpha_mode: int | None = None,
audio_bits_per_sample: int | None = None,
audio_channels: int | None = None,
audio_emphasis: int | None = None,
audio_sampling_frequency: int | None = None,
cb_subsample: str | None = None,
chroma_siting: str | None = None,
chroma_subsample: str | None = None,
chromaticity_coordinates: str | None = None,
codec_delay: int | None = None,
codec_id: str | None = None,
codec_name: str | None = None,
content_encoding_algorithms: str | None = None,
color_bits_per_channel: int | None = None,
color_matrix_coefficients: int | None = None,
color_primaries: int | None = None,
color_range: int | None = None,
color_transfer_characteristics: int | None = None,
default_duration: int | None = None,
default_track: bool | None = None,
display_dimensions: str | None = None,
display_unit: int | None = None,
enabled_track: bool | None = None,
encoding: str | None = None,
forced_track: bool | None = None,
flag_hearing_impaired: bool | None = None,
flag_visual_impaired: bool | None = None,
flag_text_descriptions: bool | None = None,
flag_original: bool | None = None,
flag_commentary: bool | None = None,
language: str | None = None,
language_ietf: str | None = None,
max_content_light: int | None = None,
max_frame_light: int | None = None,
max_luminance: float | None = None,
min_luminance: float | None = None,
minimum_timestamp: int | None = None,
multiplexed_tracks: tuple[int, ...] | None = None,
number: int | None = None,
num_index_entries: int | None = None,
packetizer: str | None = None,
pixel_dimensions: str | None = None,
program_number: int | None = None,
projection_pose_pitch: float | None = None,
projection_pose_roll: float | None = None,
projection_pose_yaw: float | None = None,
projection_private: str | None = None,
projection_type: int | None = None,
stereo_mode: int | None = None,
stream_id: int | None = None,
sub_stream_id: int | None = None,
teletext_page: int | None = None,
text_subtitles: bool | None = None,
track_name: str | None = None,
uid: int | None = None,
white_color_coordinates: str | None = None,
)
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