Commit 4ca8879d authored by Paul B Mahol's avatar Paul B Mahol

avfilter: add metadata filters

Signed-off-by: 's avatarPaul B Mahol <onemda@gmail.com>
parent 674cc26f
......@@ -66,6 +66,7 @@ version <next>:
- nnedi deinterlacer
- streamselect video and astreamselect audio filter
- swaprect filter
- metadata video and ametadata audio filter
version 2.8:
......
......@@ -8445,6 +8445,100 @@ format=rgb24,mergeplanes=0x000102:yuv444p
@end example
@end itemize
@section metadata, ametadata
Manipulate frame metadata.
This filter accepts the following options:
@table @option
@item mode
Set mode of operation of the filter.
Can be one of the following:
@table @samp
@item select
If both @code{value} and @code{key} is set, select frames
which have such metadata. If only @code{key} is set, select
every frame that has such key in metadata.
@item add
Add new metadata @code{key} and @code{value}. If key is already available
do nothing.
@item modify
Modify value of already present key.
@item delete
If @code{value} is set, delete only keys that have such value.
Otherwise, delete key.
@item print
Print key and its value if metadata was found. If @code{key} is not set print all
metadata values available in frame.
@end table
@item key
Set key used with all modes. Must be set for all modes except @code{print}.
@item value
Set metadata value which will be used. This option is mandatory for
@code{modify} and @code{add} mode.
@item length
Set length of how many characters of two metadata values need to match to be
considered same. Default is all available characters.
@item function
Which function to use when comparing metadata value and @code{value}.
Can be one of following:
@table @samp
@item string
Values are interpreted as strings, returns true if @code{value} is same as metadata value up
to N chars as set in @code{length} option.
@item less
Values are interpreted as floats, returns true if @code{value} is less than metadata value.
@item equal
Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
@item greater
Values are interpreted as floats, returns true if @code{value} is greater than metadata value.
@item expr
Values are interpreted as floats, returns true if expression from option @code{expr}
evaluates to true.
@end table
@item expr
Set expression which is used when @code{function} is set to @code{expr}.
The expression is evaluated through the eval API and can contain the following
constants:
@table @option
@item VALUE1
Float representation of @code{value} from metadata key.
@item VALUE2
Float representation of @code{value} as supplied by user in @code{value} option.
@end table
@end table
@subsection Examples
@itemize
@item
Print all metadata values for frames with key @code{lavfi.singnalstats.YDIF} with values
between 0 and 1.
@example
@end example
signalstats,metadata=print:key=lavfi.signalstats.YDIF:function=expr:expr='between(VALUE1,0,1)'
@end itemize
@section mpdecimate
Drop frames that do not differ greatly from the previous frame in
......
......@@ -39,6 +39,7 @@ OBJS-$(CONFIG_AINTERLEAVE_FILTER) += f_interleave.o
OBJS-$(CONFIG_ALIMITER_FILTER) += af_alimiter.o
OBJS-$(CONFIG_ALLPASS_FILTER) += af_biquads.o
OBJS-$(CONFIG_AMERGE_FILTER) += af_amerge.o
OBJS-$(CONFIG_AMETADATA_FILTER) += f_metadata.o
OBJS-$(CONFIG_AMIX_FILTER) += af_amix.o
OBJS-$(CONFIG_ANULL_FILTER) += af_anull.o
OBJS-$(CONFIG_APAD_FILTER) += af_apad.o
......@@ -186,6 +187,7 @@ OBJS-$(CONFIG_LUTYUV_FILTER) += vf_lut.o
OBJS-$(CONFIG_MASKEDMERGE_FILTER) += vf_maskedmerge.o framesync.o
OBJS-$(CONFIG_MCDEINT_FILTER) += vf_mcdeint.o
OBJS-$(CONFIG_MERGEPLANES_FILTER) += vf_mergeplanes.o framesync.o
OBJS-$(CONFIG_METADATA_FILTER) += f_metadata.o
OBJS-$(CONFIG_MPDECIMATE_FILTER) += vf_mpdecimate.o
OBJS-$(CONFIG_NEGATE_FILTER) += vf_lut.o
OBJS-$(CONFIG_NNEDI_FILTER) += vf_nnedi.o
......
......@@ -59,6 +59,7 @@ void avfilter_register_all(void)
REGISTER_FILTER(ALIMITER, alimiter, af);
REGISTER_FILTER(ALLPASS, allpass, af);
REGISTER_FILTER(AMERGE, amerge, af);
REGISTER_FILTER(AMETADATA, ametadata, af);
REGISTER_FILTER(AMIX, amix, af);
REGISTER_FILTER(ANEQUALIZER, anequalizer, af);
REGISTER_FILTER(ANULL, anull, af);
......@@ -207,6 +208,7 @@ void avfilter_register_all(void)
REGISTER_FILTER(MASKEDMERGE, maskedmerge, vf);
REGISTER_FILTER(MCDEINT, mcdeint, vf);
REGISTER_FILTER(MERGEPLANES, mergeplanes, vf);
REGISTER_FILTER(METADATA, metadata, vf);
REGISTER_FILTER(MPDECIMATE, mpdecimate, vf);
REGISTER_FILTER(NEGATE, negate, vf);
REGISTER_FILTER(NNEDI, nnedi, vf);
......
This diff is collapsed.
......@@ -30,7 +30,7 @@
#include "libavutil/version.h"
#define LIBAVFILTER_VERSION_MAJOR 6
#define LIBAVFILTER_VERSION_MINOR 30
#define LIBAVFILTER_VERSION_MINOR 31
#define LIBAVFILTER_VERSION_MICRO 100
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment