4

Where does mpv save or log the state when using --save-position-on-quit or Shift+q?

This is used to save the exit state in order for the video to start playing from where it was left off when exiting mpv.

Usermaxn
  • 247
  • 2
  • 10

1 Answers1

6

On my own copy of mpv:

andrew@ilium~$ mpv --version | head -n 1
mpv 0.35.0-255-g16f0cd546d Copyright © 2000-2023 mpv/MPlayer/mplayer2 projects

the 'saved' exit state is written in a simple text file in $HOME/.config/mpv/watch_later. An example, again taken from my own system, is:

andrew@ilium~/.config/mpv/watch_later$ ls
3F33858724ABD9E42AB6EDA66A77E92D
andrew@ilium~/.config/mpv/watch_later$ cat 3F33858724ABD9E42AB6EDA66A77E92D 
start=15.807474
andrew@ilium~/.config/mpv/watch_later$ 

I note that the man pages give some clear detail on this:

~/.config/mpv/watch_later/

Contains temporary config files needed for resuming playback of files with the watch later feature. See for example the Q key binding, or the quit-watch-later input command.

Each file is a small config file which is loaded if the corresponding media file is loaded. It contains the playback position and some (not necessarily all) settings that were changed during playback. The filenames are hashed from the full paths of the media files. It's in general not possible to extract the media filename from this hash. However, you can set the --write-filename-in-watch-later-config option, file.

The option --write-filename-in-watch-later-config mentioned there is worth using; on my system this command:

mpv --save-position-on-quit --write-filename-in-watch-later-config test.avi 

gives the following result:

andrew@ilium~/.config/mpv/watch_later$ cat 3F33858724ABD9E42AB6EDA66A77E92D 
# test.avi
start=26.067734
andrew@ilium~/.config/mpv/watch_later$ 

It would be a great idea to add these options to the mpv.conf file, as I have done on my system...

andrew.46
  • 39,359