Commit 0ab9362f authored by Clément Bœsch's avatar Clément Bœsch

lavfi: add vignette filter.

parent 310f9dd6
...@@ -59,6 +59,7 @@ version <next>: ...@@ -59,6 +59,7 @@ version <next>:
- VC-1 interlaced B-frame support - VC-1 interlaced B-frame support
- support for WavPack muxing (raw and in Matroska) - support for WavPack muxing (raw and in Matroska)
- XVideo output device - XVideo output device
- vignette filter
version 1.2: version 1.2:
......
...@@ -6950,6 +6950,109 @@ For example, to vertically flip a video with @command{ffmpeg}: ...@@ -6950,6 +6950,109 @@ For example, to vertically flip a video with @command{ffmpeg}:
ffmpeg -i in.avi -vf "vflip" out.avi ffmpeg -i in.avi -vf "vflip" out.avi
@end example @end example
@section vignette
Make or reverse a natural vignetting effect.
The filter accepts the following options:
@table @option
@item angle, a
Set lens angle expression as a number of radians.
The value is clipped in the @code{[0,PI/2]} range.
Default value: @code{"PI/5"}
@item x0
@item y0
Set center coordinates expressions. Respectively @code{"w/2"} and @code{"h/2"}
by default.
@item mode
Set forward/backward mode.
Available modes are:
@table @samp
@item forward
The larger the distance from the central point, the darker the image becomes.
@item backward
The larger the distance from the central point, the brighter the image becomes.
This can be used to reverse a vignette effect, though there is no automatic
detection to extract the lens @option{angle} and other settings (yet). It can
also be used to create a burning effect.
@end table
Default value is @samp{forward}.
@item eval
Set evaluation mode for the expressions (@option{angle}, @option{x0}, @option{y0}).
It accepts the following values:
@table @samp
@item init
Evaluate expressions only once during the filter initialization.
@item frame
Evaluate expressions for each incoming frame. This is way slower than the
@samp{init} mode since it requires all the scalers to be re-computed, but it
allows advanced dynamic expressions.
@end table
Default value is @samp{init}.
@item dither
Set dithering to reduce the circular banding effects. Default is @code{1}
(enabled).
@end table
@subsection Expressions
The @option{alpha}, @option{x0} and @option{y0} expressions can contain the
following parameters.
@table @option
@item w
@item h
input width and height
@item n
the number of input frame, starting from 0
@item pts
the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
@var{TB} units, NAN if undefined
@item r
frame rate of the input video, NAN if the input frame rate is unknown
@item t
the PTS (Presentation TimeStamp) of the filtered video frame,
expressed in seconds, NAN if undefined
@item tb
time base of the input video
@end table
@subsection Examples
@itemize
@item
Apply simple strong vignetting effect:
@example
vignette=PI/4
@end example
@item
Make a flickering vignetting:
@example
vignette='PI/4+random(1)*PI/50':eval=frame
@end example
@end itemize
@anchor{yadif} @anchor{yadif}
@section yadif @section yadif
......
...@@ -191,6 +191,7 @@ OBJS-$(CONFIG_UNSHARP_FILTER) += vf_unsharp.o ...@@ -191,6 +191,7 @@ OBJS-$(CONFIG_UNSHARP_FILTER) += vf_unsharp.o
OBJS-$(CONFIG_VFLIP_FILTER) += vf_vflip.o OBJS-$(CONFIG_VFLIP_FILTER) += vf_vflip.o
OBJS-$(CONFIG_VIDSTABDETECT_FILTER) += vidstabutils.o vf_vidstabdetect.o OBJS-$(CONFIG_VIDSTABDETECT_FILTER) += vidstabutils.o vf_vidstabdetect.o
OBJS-$(CONFIG_VIDSTABTRANSFORM_FILTER) += vidstabutils.o vf_vidstabtransform.o OBJS-$(CONFIG_VIDSTABTRANSFORM_FILTER) += vidstabutils.o vf_vidstabtransform.o
OBJS-$(CONFIG_VIGNETTE_FILTER) += vf_vignette.o
OBJS-$(CONFIG_YADIF_FILTER) += vf_yadif.o OBJS-$(CONFIG_YADIF_FILTER) += vf_yadif.o
OBJS-$(CONFIG_ZMQ_FILTER) += f_zmq.o OBJS-$(CONFIG_ZMQ_FILTER) += f_zmq.o
......
...@@ -188,6 +188,7 @@ void avfilter_register_all(void) ...@@ -188,6 +188,7 @@ void avfilter_register_all(void)
REGISTER_FILTER(VFLIP, vflip, vf); REGISTER_FILTER(VFLIP, vflip, vf);
REGISTER_FILTER(VIDSTABDETECT, vidstabdetect, vf); REGISTER_FILTER(VIDSTABDETECT, vidstabdetect, vf);
REGISTER_FILTER(VIDSTABTRANSFORM, vidstabtransform, vf); REGISTER_FILTER(VIDSTABTRANSFORM, vidstabtransform, vf);
REGISTER_FILTER(VIGNETTE, vignette, vf);
REGISTER_FILTER(YADIF, yadif, vf); REGISTER_FILTER(YADIF, yadif, vf);
REGISTER_FILTER(ZMQ, zmq, vf); REGISTER_FILTER(ZMQ, zmq, vf);
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include "libavutil/avutil.h" #include "libavutil/avutil.h"
#define LIBAVFILTER_VERSION_MAJOR 3 #define LIBAVFILTER_VERSION_MAJOR 3
#define LIBAVFILTER_VERSION_MINOR 72 #define LIBAVFILTER_VERSION_MINOR 73
#define LIBAVFILTER_VERSION_MICRO 100 #define LIBAVFILTER_VERSION_MICRO 100
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ #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