Commit acf1dd5b authored by Paul B Mahol's avatar Paul B Mahol

avfilter: add threshold filter

Signed-off-by: 's avatarPaul B Mahol <onemda@gmail.com>
parent ebb83e2d
......@@ -19,6 +19,7 @@ version <next>:
- Sample Dump eXchange demuxer
- abitscope multimedia filter
- Scenarist Closed Captions demuxer and muxer
- threshold filter
version 3.2:
- libopenmpt demuxer
......
......@@ -13192,6 +13192,63 @@ PAL output (25i):
16p: 33333334
@end example
@section threshold
Apply threshold effect to video stream.
This filter needs four video streams to perform thresholding.
First stream is stream we are filtering.
Second stream is holding threshold values, third stream is holding min values,
and last, fourth stream is holding max values.
The filter accepts the following option:
@table @option
@item planes
Set which planes will be processed, unprocessed planes will be copied.
By default value 0xf, all planes will be processed.
@end table
For example if first stream pixel's component value is less then threshold value
of pixel component from 2nd threshold stream, third stream value will picked,
otherwise fourth stream pixel component value will be picked.
Using color source filter one can perform various types of thresholding:
@subsection Examples
@itemize
@item
Binary threshold, using gray color as threshold:
@example
ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=black -f lavfi -i color=white -lavfi threshold output.avi
@end example
@item
Inverted binary threshold, using gray color as threshold:
@example
ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -f lavfi -i color=black -lavfi threshold output.avi
@end example
@item
Truncate binary threshold, using gray color as threshold:
@example
ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=gray -lavfi threshold output.avi
@end example
@item
Threshold to zero, using gray color as threshold:
@example
ffmpeg -i 320x240.avi -f lavfi -i color=gray -f lavfi -i color=white -i 320x240.avi -lavfi threshold output.avi
@end example
@item
Inverted threshold to zero, using gray color as threshold:
@example
ffmpeg -i 320x240.avi -f lavfi -i color=gray -i 320x240.avi -f lavfi -i color=white -lavfi threshold output.avi
@end example
@end itemize
@section thumbnail
Select the most representative frame in a given sequence of consecutive frames.
......
......@@ -289,6 +289,7 @@ OBJS-$(CONFIG_SWAPRECT_FILTER) += vf_swaprect.o
OBJS-$(CONFIG_SWAPUV_FILTER) += vf_swapuv.o
OBJS-$(CONFIG_TBLEND_FILTER) += vf_blend.o dualinput.o framesync.o
OBJS-$(CONFIG_TELECINE_FILTER) += vf_telecine.o
OBJS-$(CONFIG_THRESHOLD_FILTER) += vf_threshold.o
OBJS-$(CONFIG_THUMBNAIL_FILTER) += vf_thumbnail.o
OBJS-$(CONFIG_TILE_FILTER) += vf_tile.o
OBJS-$(CONFIG_TINTERLACE_FILTER) += vf_tinterlace.o
......
......@@ -304,6 +304,7 @@ void avfilter_register_all(void)
REGISTER_FILTER(SWAPUV, swapuv, vf);
REGISTER_FILTER(TBLEND, tblend, vf);
REGISTER_FILTER(TELECINE, telecine, vf);
REGISTER_FILTER(THRESHOLD, threshold, vf);
REGISTER_FILTER(THUMBNAIL, thumbnail, vf);
REGISTER_FILTER(TILE, tile, vf);
REGISTER_FILTER(TINTERLACE, tinterlace, vf);
......
......@@ -30,7 +30,7 @@
#include "libavutil/version.h"
#define LIBAVFILTER_VERSION_MAJOR 6
#define LIBAVFILTER_VERSION_MINOR 71
#define LIBAVFILTER_VERSION_MINOR 72
#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