Skip to content

Commit 7dd035e

Browse files
committed
vf_format: add some basic HDR10 metadata
Can be extended if needed.
1 parent 96ce2d1 commit 7dd035e

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
11
add `--vf=format=transfer` alias
2+
add `--vf=format=min-luma`
3+
add `--vf=format=max-luma`
4+
add `--vf=format=max-cll`
5+
add `--vf=format=max-fall`

DOCS/man/vf.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,27 @@ Available mpv-only filters are:
323323
Whether or not to include HDR10+ metadata (default: yes). If
324324
disabled, any HDR10+ metadata will be stripped from frames.
325325

326+
``<min-luma>``
327+
Set the minimum luminance value for the mastering display metadata.
328+
This is a float value in nits (cd/m²).
329+
330+
.. note::
331+
332+
0.0 means undefined, which is the default. To set 0.0 as actual value,
333+
use a very small value like 1e-6.
334+
335+
``<max-luma>``
336+
Set the maximum luminance value for the mastering display metadata.
337+
This is a float value in nits (cd/m²).
338+
339+
``<max_cll>``
340+
Set the maximum content light level for the mastering display
341+
metadata. This is a float value in nits (cd/m²).
342+
343+
``<max_fall>``
344+
Set the maximum frame-average light level for the mastering
345+
display metadata. This is a float value in nits (cd/m²).
346+
326347
``<film-grain=yes|no>``
327348
Whether or not to include film grain metadata (default: yes). If
328349
disabled, any film grain metadata will be stripped from frames.

video/filter/vf_format.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ struct vf_format_opts {
6161
int force_scaler;
6262
bool dovi;
6363
bool hdr10plus;
64+
float min_luma;
65+
float max_luma;
66+
float max_cll;
67+
float max_fall;
6468
bool film_grain;
6569
};
6670

@@ -190,6 +194,18 @@ static void vf_format_process(struct mp_filter *f)
190194
img->params.color.hdr.ootf = (struct pl_hdr_bezier){0};
191195
}
192196

197+
if (priv->opts->min_luma)
198+
img->params.color.hdr.min_luma = priv->opts->min_luma;
199+
200+
if (priv->opts->max_luma)
201+
img->params.color.hdr.max_luma = priv->opts->max_luma;
202+
203+
if (priv->opts->max_cll)
204+
img->params.color.hdr.max_cll = priv->opts->max_cll;
205+
206+
if (priv->opts->max_fall)
207+
img->params.color.hdr.max_fall = priv->opts->max_fall;
208+
193209
if (!priv->opts->film_grain)
194210
av_buffer_unref(&img->film_grain);
195211

@@ -254,6 +270,10 @@ static const m_option_t vf_opts_fields[] = {
254270
{"convert", OPT_BOOL(convert)},
255271
{"dolbyvision", OPT_BOOL(dovi)},
256272
{"hdr10plus", OPT_BOOL(hdr10plus)},
273+
{"min-luma", OPT_FLOAT(min_luma), M_RANGE(0, 10000)},
274+
{"max-luma", OPT_FLOAT(max_luma), M_RANGE(0, 10000)},
275+
{"max_cll", OPT_FLOAT(max_cll), M_RANGE(0, 10000)},
276+
{"max_fall", OPT_FLOAT(max_fall), M_RANGE(0, 10000)},
257277
{"film-grain", OPT_BOOL(film_grain)},
258278
{"force-scaler", OPT_CHOICE(force_scaler,
259279
{"auto", MP_SWS_AUTO},

0 commit comments

Comments
 (0)