Skip to content
Advertisement

Pause programmatically video player mpv

I would like to know if there is a way to send a message to a running process on linux ?

For example, is it possible to programmatically “pause” a video launched with mpv.

Advertisement

Answer

To control mpv remotely (eg from another terminal session) you can also start it with the option

--input-ipc-server=/tmp/mpvsocket

and control it by issuing commands like this:

echo '{ "command": ["set_property", "pause", true] }' | socat - /tmp/mpvsocket

See man mpv for (many) more details.

edit: see also mpv --list-properties

edit2: The most simple way I’ve found to “toggle” pause/play is

{"command": ["cycle", "pause"]}

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement