summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/man/options.rst11
-rw-r--r--options/options.c1
-rw-r--r--options/options.h1
-rw-r--r--player/screenshot.c8
4 files changed, 21 insertions, 0 deletions
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst
index 5e2a0bc8e0..b46f5992e6 100644
--- a/DOCS/man/options.rst
+++ b/DOCS/man/options.rst
@@ -2656,6 +2656,17 @@ Screenshot
``%%``
Replaced with the ``%`` character itself.
+``--screenshot-directory=<path>``
+ Store screenshots in this directory. This path is joined with the filename
+ generated by ``--screenshot-template``. If the template filename is already
+ absolute, the directory is ignored.
+
+ If the directory does not exist or is not a directory, an error is
+ generated.
+
+ This option is not set by default, and thus will write screenshots to the
+ directory from which mpv was started.
+
``--screenshot-jpeg-quality=<0-100>``
Set the JPEG quality level. Higher means better quality. The default is 90.
diff --git a/options/options.c b/options/options.c
index f59f1356c0..5965ae1692 100644
--- a/options/options.c
+++ b/options/options.c
@@ -543,6 +543,7 @@ const m_option_t mp_opts[] = {
OPT_SUBSTRUCT("screenshot", screenshot_image_opts, image_writer_conf, 0),
OPT_STRING("screenshot-template", screenshot_template, 0),
+ OPT_STRING("screenshot-directory", screenshot_direcrory, 0),
OPT_SUBSTRUCT("input", input_opts, input_config, 0),
diff --git a/options/options.h b/options/options.h
index ced518453f..c3b4831fa6 100644
--- a/options/options.h
+++ b/options/options.h
@@ -206,6 +206,7 @@ typedef struct MPOpts {
struct image_writer_opts *screenshot_image_opts;
char *screenshot_template;
+ char *screenshot_direcrory;
double force_fps;
int index_mode;
diff --git a/player/screenshot.c b/player/screenshot.c
index a47de292d5..1db1d95996 100644
--- a/player/screenshot.c
+++ b/player/screenshot.c
@@ -280,6 +280,14 @@ static char *gen_fname(screenshot_ctx *ctx, const char *file_ext)
return NULL;
}
+ char *dir = ctx->mpctx->opts->screenshot_direcrory;
+ if (dir && dir[0]) {
+ void *t = fname;
+ dir = mp_get_user_path(t, ctx->mpctx->global, dir);
+ fname = mp_path_join(NULL, bstr0(dir), bstr0(fname));
+ talloc_free(t);
+ }
+
if (!mp_path_exists(fname))
return fname;