Commit 5e3a418b authored by Gerion Entrup's avatar Gerion Entrup Committed by Michael Niedermayer

add signature filter for MPEG7 video signature

This filter does not implement all features of MPEG7. Missing features:
- compression of signature files
- work only on (cropped) parts of the video
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent b7cc4eb3
......@@ -30,6 +30,7 @@ version <next>:
- Support MOV with multiple sample description tables
- XPM decoder
- Removed the legacy X11 screen grabber, use XCB instead
- MPEG-7 Video Signature filter
version 3.2:
......
......@@ -3139,6 +3139,7 @@ showspectrum_filter_deps="avcodec"
showspectrum_filter_select="fft"
showspectrumpic_filter_deps="avcodec"
showspectrumpic_filter_select="fft"
signature_filter_deps="gpl avcodec avformat"
smartblur_filter_deps="gpl swscale"
sofalizer_filter_deps="netcdf avcodec"
sofalizer_filter_select="fft"
......
......@@ -12660,6 +12660,95 @@ saturation maximum: %@{metadata:lavfi.signalstats.SATMAX@}
@end example
@end itemize
@anchor{signature}
@section signature
Calculates the MPEG-7 Video Signature. The filter can handle more than one
input. In this case the matching between the inputs can be calculated additionally.
The filter always passes through the first input. The signature of each stream can
be written into a file.
It accepts the following options:
@table @option
@item detectmode
Enable or disable the matching process.
Available values are:
@table @samp
@item off
Disable the calculation of a matching (default).
@item full
Calculate the matching for the whole video and output whether the whole video
matches or only parts.
@item fast
Calculate only until a matching is found or the video ends. Should be faster in
some cases.
@end table
@item nb_inputs
Set the number of inputs. The option value must be a non negative integer.
Default value is 1.
@item filename
Set the path to which the output is written. If there is more than one input,
the path must be a prototype, i.e. must contain %d or %0nd (where n is a positive
integer), that will be replaced with the input number. If no filename is
specified, no output will be written. This is the default.
@item format
Choose the output format.
Available values are:
@table @samp
@item binary
Use the specified binary representation (default).
@item xml
Use the specified xml representation.
@end table
@item th_d
Set threshold to detect one word as similar. The option value must be an integer
greater than zero. The default value is 9000.
@item th_dc
Set threshold to detect all words as similar. The option value must be an integer
greater than zero. The default value is 60000.
@item th_xh
Set threshold to detect frames as similar. The option value must be an integer
greater than zero. The default value is 116.
@item th_di
Set the minimum length of a sequence in frames to recognize it as matching
sequence. The option value must be a non negative integer value.
The default value is 0.
@item th_it
Set the minimum relation, that matching frames to all frames must have.
The option value must be a double value between 0 and 1. The default value is 0.5.
@end table
@subsection Examples
@itemize
@item
To calculate the signature of an input video and store it in signature.bin:
@example
ffmpeg -i input.mkv -vf signature=filename=signature.bin -map 0:v -f null -
@end example
@item
To detect whether two videos match and store the signatures in XML format in
signature0.xml and signature1.xml:
@example
ffmpeg -i input1.mkv -i input2.mkv -filter_complex "[0:v][1:v] signature=nb_inputs=2:detectmode=full:format=xml:filename=signature%d.xml" -map :v -f null -
@end example
@end itemize
@anchor{smartblur}
@section smartblur
......
......@@ -280,6 +280,7 @@ OBJS-$(CONFIG_SHUFFLEFRAMES_FILTER) += vf_shuffleframes.o
OBJS-$(CONFIG_SHUFFLEPLANES_FILTER) += vf_shuffleplanes.o
OBJS-$(CONFIG_SIDEDATA_FILTER) += f_sidedata.o
OBJS-$(CONFIG_SIGNALSTATS_FILTER) += vf_signalstats.o
OBJS-$(CONFIG_SIGNATURE_FILTER) += vf_signature.o
OBJS-$(CONFIG_SMARTBLUR_FILTER) += vf_smartblur.o
OBJS-$(CONFIG_SOBEL_FILTER) += vf_convolution.o
OBJS-$(CONFIG_SPLIT_FILTER) += split.o
......
......@@ -290,6 +290,7 @@ static void register_all(void)
REGISTER_FILTER(SHUFFLEPLANES, shuffleplanes, vf);
REGISTER_FILTER(SIDEDATA, sidedata, vf);
REGISTER_FILTER(SIGNALSTATS, signalstats, vf);
REGISTER_FILTER(SIGNATURE, signature, vf);
REGISTER_FILTER(SMARTBLUR, smartblur, vf);
REGISTER_FILTER(SOBEL, sobel, vf);
REGISTER_FILTER(SPLIT, split, vf);
......
This diff is collapsed.
This diff is collapsed.
......@@ -30,7 +30,7 @@
#include "libavutil/version.h"
#define LIBAVFILTER_VERSION_MAJOR 6
#define LIBAVFILTER_VERSION_MINOR 77
#define LIBAVFILTER_VERSION_MINOR 78
#define LIBAVFILTER_VERSION_MICRO 100
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
......
This diff is collapsed.
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