mirror of
https://github.com/mpv-player/mpv
synced 2024-12-26 09:02:38 +00:00
image_writer: add webp-compression option
This commit is contained in:
parent
0f79444c6d
commit
ee0f4444f9
@ -3460,6 +3460,10 @@ Screenshot
|
||||
``--screenshot-webp-quality=<0-100>``
|
||||
Set the WebP quality level. Higher means better quality. The default is 75.
|
||||
|
||||
``--screenshot-webp-compression=<0-6>``
|
||||
Set the WebP compression level. Higher means better compression, but takes
|
||||
more CPU time. Note that this also affects the screenshot quality when used
|
||||
with lossy WebP files. The default is 4.
|
||||
|
||||
Software Scaler
|
||||
---------------
|
||||
|
@ -431,6 +431,8 @@ Available video output drivers are:
|
||||
Enable writing lossless WebP files (default: no)
|
||||
``--vo-image-webp-quality=<0-100>``
|
||||
WebP quality (default: 75)
|
||||
``--vo-image-webp-compression=<0-6>``
|
||||
WebP compression factor (default: 4)
|
||||
``--vo-image-outdir=<dirname>``
|
||||
Specify the directory to save the image files to (default: ``./``).
|
||||
|
||||
|
@ -50,6 +50,7 @@ const struct image_writer_opts image_writer_opts_defaults = {
|
||||
.jpeg_source_chroma = 1,
|
||||
.webp_lossless = 0,
|
||||
.webp_quality = 75,
|
||||
.webp_compression = 4,
|
||||
.tag_csp = 0,
|
||||
};
|
||||
|
||||
@ -71,6 +72,7 @@ const struct m_option image_writer_opts[] = {
|
||||
OPT_INTRANGE("png-filter", png_filter, 0, 0, 5),
|
||||
OPT_FLAG("webp-lossless", webp_lossless, 0),
|
||||
OPT_INTRANGE("webp-quality", webp_quality, 0, 0, 100),
|
||||
OPT_INTRANGE("webp-compression", webp_compression, 0, 0, 6),
|
||||
OPT_FLAG("high-bit-depth", high_bit_depth, 0),
|
||||
OPT_FLAG("tag-colorspace", tag_csp, 0),
|
||||
{0},
|
||||
@ -135,6 +137,7 @@ static bool write_lavc(struct image_writer_ctx *ctx, mp_image_t *image, FILE *fp
|
||||
av_opt_set_int(avctx, "pred", ctx->opts->png_filter,
|
||||
AV_OPT_SEARCH_CHILDREN);
|
||||
} else if (codec->id == AV_CODEC_ID_WEBP) {
|
||||
avctx->compression_level = ctx->opts->webp_compression;
|
||||
av_opt_set_int(avctx, "lossless", ctx->opts->webp_lossless,
|
||||
AV_OPT_SEARCH_CHILDREN);
|
||||
av_opt_set_int(avctx, "quality", ctx->opts->webp_quality,
|
||||
|
@ -34,6 +34,7 @@ struct image_writer_opts {
|
||||
int jpeg_source_chroma;
|
||||
int webp_lossless;
|
||||
int webp_quality;
|
||||
int webp_compression;
|
||||
int tag_csp;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user