vf_format: support forwarding/stripping film grain metadata

This commit is contained in:
Lynne 2022-04-01 22:26:23 +02:00 committed by Niklas Haas
parent 3194ed4b58
commit 7230550191
3 changed files with 11 additions and 0 deletions

View File

@ -40,6 +40,7 @@ Interface changes
`--tone-mapping-desaturate-exponent`.
- add `dolbyvision` sub-parameter to `format` video filter
- `--sub-visibility` no longer has any effect on secondary subtitles
- add `film-grain` sub-parameter to `format` video filter
--- mpv 0.34.0 ---
- deprecate selecting by card number with `--drm-connector`, add
`--drm-device` which can be used instead

View File

@ -312,6 +312,10 @@ Available mpv-only filters are:
Whether or not to include Dolby Vision metadata (default: yes). If
disabled, any Dolby Vision metadata will be stripped from frames.
``<film-grain=yes|no>``
Whether or not to include film grain metadata (default: yes). If
disabled, any film grain metadata will be stripped from frames.
``<stereo-in>``
Set the stereo mode the video is assumed to be encoded in. Use
``--vf=format:stereo-in=help`` to list all available modes. Check with

View File

@ -58,6 +58,7 @@ struct vf_format_opts {
int convert;
int force_scaler;
int dovi;
int film_grain;
};
static void set_params(struct vf_format_opts *p, struct mp_image_params *out,
@ -156,6 +157,9 @@ static void vf_format_process(struct mp_filter *f)
if (!priv->opts->dovi)
av_buffer_unref(&img->dovi);
if (!priv->opts->film_grain)
av_buffer_unref(&img->film_grain);
write_out:
mp_pin_in_write(f->ppins[1], frame);
}
@ -215,6 +219,7 @@ static const m_option_t vf_opts_fields[] = {
{"dar", OPT_DOUBLE(dar)},
{"convert", OPT_FLAG(convert)},
{"dolbyvision", OPT_FLAG(dovi)},
{"film-grain", OPT_FLAG(film_grain)},
{"force-scaler", OPT_CHOICE(force_scaler,
{"auto", MP_SWS_AUTO},
{"sws", MP_SWS_SWS},
@ -232,6 +237,7 @@ const struct mp_user_filter_entry vf_format = {
.priv_defaults = &(const OPT_BASE_STRUCT){
.rotate = -1,
.dovi = 1,
.film_grain = 1,
},
.options = vf_opts_fields,
},