Pause programmatically video player mpv

后端 未结 3 1402
慢半拍i
慢半拍i 2020-12-29 09:23

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 w

3条回答
  •  感动是毒
    2020-12-29 10:12

    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"]}

提交回复
热议问题