Skip to main content

Python MPV JSONIPC

This implements an interface similar to python-mpv, but it uses the JSON IPC protocol instead of the C API. This means you can control external instances of MPV including players like SMPlayer, and it can use MPV players that are prebuilt instead of needing libmpv1. It may also be more resistant to crashes such as Segmentation Faults, but since it isn't directly communicating with MPV via the C API the performance will be worse.

Please note that this only implements the subset of python-mpv that is used by plex-mpv-shim and jellyfin-mpv-shim. Other functionality has not been implemented.

Installation

sudo pip3 install python-mpv-jsonipc

Basic usage

Create an instance of MPV. You can use an already running MPV or have the library start a managed copy of MPV. Command arguments can be specified when initializing MPV if you are starting a managed copy of MPV.

Please also see the API Documentation.

from python_mpv_jsonipc import MPV

# Uses MPV that is in the PATH.
mpv = MPV()

# Use MPV that is running and connected to /tmp/mpv-socket.
mpv = MPV(start_mpv=False, ipc_socket="/tmp/mpv-socket")

# Uses MPV that is found at /path/to/mpv.
mpv = MPV(mpv_location="/path/to/mpv")

# After you have an MPV, you can read and set (if applicable) properties.
mpv.volume # 100.0 by default
mpv.volume = 20 

# You can also send commands.
mpv.command_name(arg1, arg2)

# Bind to key press events with a decorator
@mpv.on_key_press("space")
def space_handler():
    pass

# You can also observe and wait for properties.
@mpv.property_observer("eof-reached")
def handle_eof(name, value):
    pass

# Or simply wait for the value to change once.
mpv.wait_for_property("duration")

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_mpv_jsonipc-1.2.3.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_mpv_jsonipc-1.2.3-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file python_mpv_jsonipc-1.2.3.tar.gz.

File metadata

  • Download URL: python_mpv_jsonipc-1.2.3.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for python_mpv_jsonipc-1.2.3.tar.gz
Algorithm Hash digest
SHA256 3bc6a4618ccb3335e7a455fe8cf396260c7ec91d5e5f59c682fce844204da2a2
MD5 dd193805359c2ae6ff14ed4f82551435
BLAKE2b-256 86797d7daa7fa13b8ebc087fb5b1175cf89c7b1c2a2a0ebd81b4e88327ad7628

See more details on using hashes here.

File details

Details for the file python_mpv_jsonipc-1.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for python_mpv_jsonipc-1.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 110cd83a57128b75c53c0fe9008fd74a2b0c67436e41b5e5fa2070a36fac3b07
MD5 bb89f122c898a0d3fe2138c8dd82aefb
BLAKE2b-256 2e41d8ca63d8403309b18b78996accba53aa59f21416ac3636fac94eeebf931a

See more details on using hashes here.

Release history Release notifications | RSS feed

1.4.0

2 files

1.3.0

2 files

This release

1.2.3 This release

2 files

1.2.2

2 files

1.2.1

2 files

1.2.0

2 files

1.1.14

2 files

1.1.13

2 files

1.1.12

2 files

1.1.11

2 files

1.1.10

2 files

1.1.9

2 files

1.1.8

2 files

1.1.7

2 files

1.1.6

2 files

1.1.5

2 files

1.1.4

2 files

1.1.3

2 files

1.1.2

2 files

1.1.1

2 files

1.1.0

2 files

1.0.1

2 files

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