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.
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
~/.mpv/config (whichever you're using)
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)
However, I could have made my life a lot easier by just putting
P cycle keep-open up