diff options
-rw-r--r-- | DOCS/man/options.rst | 7 | ||||
-rw-r--r-- | video/image_writer.c | 6 | ||||
-rw-r--r-- | video/image_writer.h | 1 |
3 files changed, 14 insertions, 0 deletions
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index 1018cf5f95..4c83b170e2 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -2641,6 +2641,13 @@ Screenshot :jpg: JPEG (default) :jpeg: JPEG (same as jpg, but with .jpeg file ending) +``--screenshot-tag-colorspace=<yes|no>`` + Tag screenshots with the appropriate colorspace. + + Note that not all formats are supported. + + Default: ``yes``. + ``--screenshot-template=<template>`` Specify the filename template used to save screenshots. The template specifies the filename without file extension, and can contain format diff --git a/video/image_writer.c b/video/image_writer.c index ff321cfd1f..ab00b5bb01 100644 --- a/video/image_writer.c +++ b/video/image_writer.c @@ -50,6 +50,7 @@ const struct image_writer_opts image_writer_opts_defaults = { .jpeg_dpi = 72, .jpeg_progressive = 0, .jpeg_baseline = 1, + .tag_csp = 1, }; #define OPT_BASE_STRUCT struct image_writer_opts @@ -65,6 +66,7 @@ const struct m_sub_options image_writer_conf = { OPT_INTRANGE("png-compression", png_compression, 0, 0, 9), OPT_INTRANGE("png-filter", png_filter, 0, 0, 5), OPT_STRING("format", format, 0), + OPT_FLAG("tag-colorspace", tag_csp, 0), {0}, }, .size = sizeof(struct image_writer_opts), @@ -131,6 +133,10 @@ static int write_lavc(struct image_writer_ctx *ctx, mp_image_t *image, FILE *fp) pic->format = avctx->pix_fmt; pic->width = avctx->width; pic->height = avctx->height; + if (ctx->opts->tag_csp) { + pic->color_primaries = mp_csp_prim_to_avcol_pri(image->params.primaries); + pic->color_trc = mp_csp_trc_to_avcol_trc(image->params.gamma); + } int ret = avcodec_encode_video2(avctx, &pkt, pic, &got_output); if (ret < 0) goto error_exit; diff --git a/video/image_writer.h b/video/image_writer.h index 2fce63065e..272af73b05 100644 --- a/video/image_writer.h +++ b/video/image_writer.h @@ -28,6 +28,7 @@ struct image_writer_opts { int jpeg_dpi; int jpeg_progressive; int jpeg_baseline; + int tag_csp; }; extern const struct image_writer_opts image_writer_opts_defaults; |