Better screenshot default location (was: Relative paths in screenshot-template don't work (in OS X))
Specifying a "relative" path in the screenshot-template option does not seem to work, also only the --foo=bar syntax works at all:
--screenshot-template=~/Desktop/mpv_screenshot%n
--> Error opening '~/Desktop/mpv_screenshot0001.png' for writing!
--screenshot-template="~/Desktop/mpv_screenshot%n"
--> Error opening '~/Desktop/mpv_screenshot0001.png' for writing!
--screenshot-template "~/Desktop/mpv_screenshot%n"
--> Error parsing commandline option screenshot-template: Required parameter for option missing
--screenshot-template ~/Desktop/mpv_screenshot%n
--> Error parsing commandline option screenshot-template: Required parameter for option missing
It doesn't make a difference between shell and config-file. Only setting an absolute path works. Also, mpv should default to screenshot-template="~/Desktop/mpv_screenshot%n" on OS X, so that users will find their screenshots.
I think I agree for the default screenshot path on OSX instead of cwd. @wm4, @divVerent does it make sense to have a default screenshot path on Linux / Windows?
I'd also sugest to have the OSD display some feedback after the screenshot was taken, like "Saved screenshot to ~/Desktop/mpv_screenshot1337.png". Right now, you only get feedback in the comand-line (which not everyone uses).
Wouldn't that make taking several screenshots really close to one another really painful though?
You can always disable the OSD entirely with o. Alternatively, you could make mpv play some "click" sound :D
ChrisK, you're a victim of the option syntax. This seems to happen relatively often, and I'm planning to change this. --options currently never accept a space between option name and value. But you can write "-option value". And also, the shell never expands the "~" in "--opt=~/..." for some reason. mpv doesn't expand "~" on its own, it's strictly shell stuff. That's why it doesn't work for you.
I wouldn't mind storing screenshots somewhere else, though. I feel like we shouldn't make too many things operating system dependent, though. Linux and Windows both have their own ways to retrieve the desktop path. Alternatively, how about storing screenshots in the home directory (~), or in the directory the played file is located?
Showing a message on OSD is also something that we can discuss.
Other opinions?
Alternatively, you could make mpv play some "click" sound :D
Rejected.
Edit: changed the issue title.
We also could change the screenshot filenames from "shot0001.jpg" to something else. They could contain filenames, dates, playback position - whatever makes sense.
I would like the screenshot to stay in the directory the played file is located
I would like the screenshot to stay in the directory the played file is located
I think this is a smart idea and makes sense on all of the platforms.
What if the file is not on the local filesystem?
Place it where mpv was launched from?
Alternatively, how about storing screenshots in the home directory (~)
I personally hate it when applications clutter my home dir. I would suggest that mpv tries to save screenshots to ~/Desktop/, since this exists on OS X and also on some (most?) Linux flavors and falls back to ~/ if there isn't a ~/Desktop/.
or in the directory the played file is located?
This would already not work with read-only media like DVDs.
What if the file is not on the local filesystem?
Yep, that would be my case. I often play stuff from a remote server that is mounted via AFP. So mpv would upload the screenshots to my server.
Even if locally, the screenshots may end up deeply buried in some neatly organized file structure that the user has to navigate to first again or in a totally messy Downloads folder. Most users probably want to find their screenshots quickly to upload and post them somewhere.
We also could change the screenshot filenames from "shot0001.jpg" to something else. They could contain filenames, dates, playback position - whatever makes sense.
I would try to keep it short, like "mpv_screenshot_%n". Video filenames can be quite long.
Putting the screenshots on the desktop will clutter it if you take many screenshots, which is why I don't like applications saving stuff to the desktop.
Then you are free to configure that. This is only about the default setting and that should be what the user expects the most. Since OS X also puts its screenshot on the desktop by default, I'd suggest to go with that.
I just wonder whether we can find defaults that work on most platforms (at least Linux and OSX), without adding too much ifdefery or other bad things.
--screenshot-template ~/Desktop/mpv_screenshot%n
This option syntax should work now in current git master.
Yep, now it just needs to work in the config too.
That's a different issue. It would require us to do shell expansion, which 1. requires code (which could be incorrect, is bloat, etc.), and 2. causes weird issues like: what if you really want to pass a filename containing "~"?
Not sure what to do, maybe just add a format specified or a property that returns the home directory? But then the syntax would still be different...
I'd say just expand shell stuff yourself when putting it into your config dir ;)
Running from the home directory
mpv Movies/video.mkv --screenshot-template="%{path} %n"
Saves the screenshot as Movies_video.mkv 0002.jpg in the home directory
*** screenshot 'Movies_video.mkv 0002.jpg' ***
Running from the home directory
mpv "/Users/bilalh/Movies/video.mkv" --screenshot-template="%{path} %n"
Saves the screenshot as _Users_bilalh_Movies_video.mkv 0002.jpg in the home directory
*** screenshot '_Users_bilalh_Movies_video.mkv 0002.jpg' ***
how do get it to save the screenshot in the same directory as the video?
Not possible at the moment. Expanded properties are sanitized, and path separators (and some other things) are replaced with "_". This was done exactly because properties could contain "/" and to prevent the player from trying to put screenshots into random directories. But it gets in the way here.
We could do our own ~ handling. It is only ever handled at the beginning of the path, so no absolute paths (starting with /) can ever be hit by it. Relative paths can always be prefixed by ./ to evade this.
However, if we want this, we should do it consistently for all filename options. I actually like the idea to have ~ work in config files too. And it gives us a nice way to set platform dependent screenshot dirs.
Btw: isn't ~/Desktop even correct on Windows? Not sure if any locales translate it.
Am 09.02.2013 um 01:36 schrieb wm4 [email protected]:
That's a different issue. It would require us to do shell expansion, which 1. requires code (which could be incorrect, is bloat, etc.), and 2. causes weird issues like: what if you really want to pass a filename containing "~"?
Not sure what to do, maybe just add a format specified or a property that returns the home directory? But then the syntax would still be different...
I'd say just expand shell stuff yourself when putting it into your config dir ;)
— Reply to this email directly or view it on GitHub..
Btw: isn't ~/Desktop even correct on Windows? Not sure if any locales translate it.
Both OSX and Windows have API calls to retrieve the actual desktop directory. Linux has relatively complicated rules to determine the desktop directory: http://freedesktop.org/wiki/Software/xdg-user-dirs
Ignoring this and implementing it the easy way might be fine, but on the other hand could lead to confusion if the user actually has a configuration which we didn't predict.