python-mpv
A python interface to the mpv media player
What it is and what it does
python-mpv is a Python wrapper around libmpv, the mpv media player's C library, using ctypes to expose mpv's full command and property API. It lets you programmatically control video and audio playback—play files or streams, adjust properties like fullscreen and volume, bind keyboard shortcuts, capture screenshots, and handle playback events—all from Python code.
The package is single-file and self-contained, with no Python runtime dependencies; you only need libmpv installed on your system. It handles threading internally for event processing, though you can disable that and integrate with external event loops if needed. The API closely mirrors mpv's native input commands and properties, so the mpv manual is your primary reference for what you can do.
Use it for:
- Build a media player application with custom UI by controlling mpv playback and reading properties like time position and metadata
- Automate video or audio processing workflows that need frame-accurate playback control or filter chain manipulation
- Create a playlist manager or streaming client that plays URLs (including YouTube via youtube-dl) programmatically
- Capture screenshots or overlays from video during playback for analysis or annotation
- Integrate mpv playback into a larger Python application without reimplementing media handling
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Python ctypes-based interface to the mpv media player, exposing mpv's API for programmatic control of video and audio playback.
Yes, if you need programmatic control of mpv playback and can manage the external libmpv dependency. The package is stable and production-ready, with low install friction and no Python dependencies. However, the 476-day release gap and known macOS event-handling issues warrant checking current compatibility with your mpv version and target platform before committing to production use.
Install
python-mpv on PyPI
pip
pip install python-mpvuv
uv add python-mpvpoetry
poetry add python-mpvInstalling python-mpv
Before you install
Low install friction; pure Python wheel with no runtime dependencies. Maintenance is aging (476 days since last release), though the repository remains active and the package is marked Production/Stable. Requires libmpv as an external system library.
License in practice
Dual-licensed under GPLv2+ or LGPLv2.1+ (copyleft). Users must comply with GPL or LGPL terms; commercial use requires careful license review or relicensing negotiation.
Quickstart
import mpv
player = mpv.MPV(ytdl=True)
player.play('https://youtu.be/DOmdB7D-pUU')
player.wait_for_playback()
libmpv must be installed and discoverable on your system (in PATH on Windows, system library path on Linux/macOS). Python >= 3.9 required.
Verify before relying
- Whether the 476-day release gap reflects active maintenance or de facto dormancy
- Current compatibility status with recent mpv releases and their API changes
- Stability of event handling on macOS (documentation mentions known bugs in event logic)
Package facts
| License | GPLv2+ or LGPLv2.1+ (copyleft) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | aging — 476 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 111,608/month — #12,408 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: python_mpv-1.0.8-py3-none-any.whl
Keywords: mpv, library, video, audio, player, display, multimedia
Tags
More Players packages
Server-side SDK for generating OpenTok…
permissive · top 5,000 on PyPI
miniaudioMiniaudio provides Python bindings for…
permissive · top 15,000 on PyPI
KivyKivy is a Python framework for building…
permissive · top 15,000 on PyPI
socoSoCo is a Python library for programmatic…
permissive · top 15,000 on PyPI
SoundCardSoundCard plays and records audio across Linux,…
permissive · top 15,000 on PyPI
playsoundPlays audio files (MP3, WAV) and URLs from…
permissive · top 15,000 on PyPI
python-vlcPython ctypes-based bindings to libvlc that let…
copyleft · top 15,000 on PyPI
ffmpeg-pythonffmpeg-python provides a Python interface to…
permissive · top 5,000 on PyPI
ffmpyffmpy is a Python wrapper around FFmpeg that…
permissive · top 5,000 on PyPI
typed-ffmpegA Python wrapper around FFmpeg with full type…
permissive · top 15,000 on PyPI
pyobjc-framework-MediaPlayerProvides Python bindings to macOS's MediaPlayer…
permissive · top 15,000 on PyPI
pyobjc-framework-AVKitProvides Python bindings to macOS's AVKit…
permissive · top 15,000 on PyPI
pyfmodexPyfmodex provides Python bindings to the FMOD…
permissive · top 15,000 on PyPI
casttubeInteract with YouTube on Chromecast devices by…
permissive · top 15,000 on PyPI
pyobjc-framework-CoreMediaProvides Python bindings to macOS's CoreMedia…
permissive · top 15,000 on PyPI
opencv-contrib-pythonopencv-contrib-python provides Python bindings…
permissive · top 5,000 on PyPI