Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pause programmatically video player mpv

Tags:

linux

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.

like image 474
bob dylan Avatar asked Jan 26 '16 11:01

bob dylan


People also ask

How do I pause a MPV in terminal?

The key "P", is set by default to pause the video.

How do I customize my MPV player?

Go to the folder where your mpv. EXE is located. Create a new folder in it, and name it "portable_config" and place the file inside that folder. This is where mpv will read your settings from.

Where is the MPV config file?

The system-wide configuration file 'mpv. conf' is in your configuration directory (e.g. /etc/mpv or /usr/local/etc/mpv ). The user-specific one is ~/. config/mpv/mpv.

How do I use MPV io?

Drag the file from your favorite file manager and drop it on MPV's window. You can also drag and drop multiple files, as well as folders that contain media files MPV can recognize. Don't worry if they also contain unsupported files: MPV will skip them.

Is there a command line option for MPV menu control?

possible? if you follow ChrisK2's suggestion and add the `keep-open=yes to your mpv.conf`` file, then you won't need any special command line options. for menu control, i mean: more button for details : flip, rotate, mute, but button and not keyboard.

What is the GitHub issue number for MPV player?

· Issue #2068 · mpv-player/mpv · GitHub Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community. By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails. Already on GitHub?

How does the video viewer work?

It finds all the videos on the page and then uses an Intersection Observer to play them when they are in view, then pause them when they go out of view. You can also tweak the threshold so that the videos start to play, say when just a little of them enters the viewport, or the entire video is visible – and everything inbetween.


1 Answers

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

like image 161
hermancain Avatar answered Sep 18 '22 13:09

hermancain