If I watch a video with mpv, it closes after the video ends. How can I configure it such that it doesn't close, for example just freezes the last image of the movie, so that I can seek back and forth without restarting the video.
3 Answers
You'd use mpv --keep-open=yes, which you can find in the mpv manpage.
It allows three values: no (close/advance to next at end of video, the default), yes (advance if there is a next video, otherwise pause), and always (always pause at end of video, even if there is a next video).
You should also be able to put keep-open=yes in your ~/.config/mpv/mpv.conf or ~/.mpv/config (whichever you're using)
- 107,579
- 20
- 231
- 279
-
Neat. Can this be changed while the player is running? (I'm looking for a "stop after current song"-option…) – Caesar Feb 14 '19 at 08:47
-
1@Caesar I would guess yes, but haven't tested or checked the manpage. mpv allows a lot of options to be changed at runtime via "properties" which can be set by, e.g., Lua scripting. You can also manipulate the playlist via scripting. – derobert Feb 14 '19 at 15:06
-
@derobert debian 10 have this config under .config/ directory, Then put it inside `~/.config/mpv/mpv.conf` works on it. – EsmaeelE Jan 12 '21 at 08:02
Thanks to derobert for hinting me towards this:
If you do want to use keep-openbut don't want that behavior all the time, I wrote a little script to turn it on just once:
reset_keep_open = false
keep_open_val = nil
function nopause()
print("Not pausing after current")
if keep_open_val ~= nil then
mp.set_property("keep-open", keep_open_val)
end
reset_keep_open = false
end
function pause_after_current()
if reset_keep_open == false then
keep_open_val = mp.get_property("keep-open")
reset_keep_open = true
mp.set_property("keep-open", "always")
print("Pause after current.")
else
nopause()
end
end
function on_pause_change(name, value)
if reset_keep_open then
nopause()
end
end
mp.observe_property("pause", "bool", on_pause_change)
mp.add_key_binding("P", "pause_after_current", pause_after_current)
(Goes into ~/.config/mpv/scripts/pauseaftercurrent.lua)
However, I could have made my life a lot easier by just putting
P cycle keep-open up
into my input.conf.
- 121
- 6
There is an option which hold the MPV window (not last image) at the end of playback:
mpv --player-operation-mode=pseudo-gui -- MY.VIDEO.FILE
- 21
- 3