Skip to main content

pymkv2

PyPI Version License codecov versions

pymkv2 is a Python wrapper for mkvmerge and other tools in the MKVToolNix suite. It provides support for muxing, splitting, linking, chapters, tags, and attachments through the use of mkvmerge.

About pymkv2

it's a fork of the pymkv project. pymkv2 is a Python 3 library for manipulating MKV files with mkvmerge. Constructing mkvmerge commands manually can quickly become confusing and complex. To remedy this, I decided to write this library to make mkvmerge more scriptable and easier to use. Please open new issues for any bugs you find, support is greatly appreciated!

Installation

mkvmerge must be installed on your computer, it is needed to process files when creating MKV objects. It is also recommended to add it to your $PATH variable but a different path can be manually specified. mkvmerge can be found and downloaded from here or from most package managers.

To install pymkv from PyPI, use the following command:

$ pip install pymkv2

You can also clone the repo and run the following command in the project root to install the source code as editable:

$ pip install -e .

Language code utilities

pymkv exposes a normalized API for comparing and translating language codes across ISO 639-1, /B, /T, 639-3, BCP 47, and English language names. Use these helpers instead of comparing language strings directly — language_ietf="zh-Hans" and language="chi" should match, and they do via languages_match.

from pymkv import (
    MKVFile,
    get_iso639_2,
    languages_match,
    language_equivalents,
    normalize_language,
)

get_iso639_2("English")  # "eng"
get_iso639_2("fra")  # "fre"  (canonical /B)
normalize_language("zh-Hans")  # "chi"  (BCP 47 subtag stripped)
languages_match("zho", "zh")  # True
language_equivalents("eng")  # frozenset({"eng", "en"})

# MKVTrack setter is now lenient — any recognized form is accepted and
# canonicalized to /B on store.
mkv = MKVFile("path/to/file.mkv")
track = mkv.tracks[1]
track.language = "Chinese"  # stored as "chi"
track.matches_language("zh")  # True (works against language_ietf too)
track.effective_language  # "chi" — normalized /B

Documentation

The documentation for pymkv can be found here or in the project's docstrings.

Metadata

Release files for pymkv2 2.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pymkv2 2.4.0
File Size Uploaded Provenance Actions
pymkv2-2.4.0.tar.gz 94.9 kB Without provenance Details for pymkv2-2.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pymkv2 2.4.0
File Interpreter ABI Platform Actions
pymkv2-2.4.0-py3-none-any.whl Python 3 none any Details for pymkv2-2.4.0-py3-none-any.whl

Total release size: 153.4 kB

Release files / pymkv2-2.4.0.tar.gz

Download URL pymkv2-2.4.0.tar.gz
Size 94.9 kB
Tags Source
SHA-256 checksum
How to use checksums
fb28098343112e52e245b3d9b2fca45e3ad507aa2e9595f0f47c2b27c8b532ea
BLAKE2b-256 checksum
How to use checksums
842592edd57fce72e9f486755c00df9a90a051a08bd6ac6ca49a79e63b23df6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / pymkv2-2.4.0-py3-none-any.whl

Download URL pymkv2-2.4.0-py3-none-any.whl
Size 58.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a7e64ca027934a31f57648317ff75a35a7be344c456f2f0ed378ff503a5f9bbc
BLAKE2b-256 checksum
How to use checksums
247f2caf179ef64e4afe8685d3dfa3852b3dd078c588b9f17323cd9e2ac456a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for pymkv2 2.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page