Skip to main content

pympv

A python wrapper for libmpv.

Basic usage

import sys
import mpv

def main(args):
    if len(args) != 1:
        print('pass a single media file as argument')
        return 1

    try:
        m = mpv.Context()
    except mpv.MPVError:
        print('failed creating context')
        return 1

    m.set_option('input-default-bindings')
    m.set_option('osc')
    m.set_option('input-vo-keyboard')
    m.initialize()

    m.command('loadfile', args[0])

    while True:
        event = m.wait_event(.01)
        if event.id == mpv.Events.none:
            continue
        print(event.name)
        if event.id in [mpv.Events.end_file, mpv.Events.shutdown]:
            break


if __name__ == '__main__':
    try:
        exit(main(sys.argv[1:]) or 0)
    except mpv.MPVError as e:
        print(str(e))
        exit(1)

More examples can be found in the samples directory.

libmpv is a client library for the media player mpv

For more info see: https://github.com/mpv-player/mpv/blob/master/libmpv/client.h

pympv was originally written by Andre D, and the PyPI package is maintained by Hector Martin.

Release files for pympv 0.9.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 pympv 0.9.0
File Size Uploaded
pympv-0.9.0.tar.gz 195.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pympv 0.9.0
File Interpreter ABI Platform
pympv-0.9.0-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details

Total release size: 26.8 MB

Release files / pympv-0.9.0.tar.gz

Download URL pympv-0.9.0.tar.gz
Size 195.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0c034dd1ea0dd6b948639a3c1149e03de6e6f235ad707d431c0ee270bec351ef
BLAKE2b-256 checksum
How to use checksums
3ce29903a1ac06235dd2ec995807952c41443dbfbe18d4ab5e8738f70d2426a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 26, 2025.

Transparency log

Release files / pympv-0.9.0-cp39-cp39-win_amd64.whl

Download URL pympv-0.9.0-cp39-cp39-win_amd64.whl
Size 26.6 MB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
adee635a7823ebaf856a62dd8dd04eaf18cb80ff2684f0abfc4ce9b50afc4c77
BLAKE2b-256 checksum
How to use checksums
f8495424ebf7c824af33b13ec82e50d68b8c472bac4c68016de53f0fa17770a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 26, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.9.0 This release

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.0

1 release file

0.5.1

1 release file

0.4.1

1 release file

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