diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index facff53073..52c42b58c8 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -2661,8 +2661,9 @@ Screenshot 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. + If the directory does not exist, it is created on the first screenshot. If + it is not a directory, an error is generated when trying to write a + screenshot. This option is not set by default, and thus will write screenshots to the directory from which mpv was started. In pseudo-gui mode diff --git a/player/screenshot.c b/player/screenshot.c index 1db1d95996..63db569afb 100644 --- a/player/screenshot.c +++ b/player/screenshot.c @@ -286,6 +286,8 @@ static char *gen_fname(screenshot_ctx *ctx, const char *file_ext) dir = mp_get_user_path(t, ctx->mpctx->global, dir); fname = mp_path_join(NULL, bstr0(dir), bstr0(fname)); talloc_free(t); + + mp_mkdirp(dir); } if (!mp_path_exists(fname))