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

avfilter: add paletteuse filter

parent 9b964690
......@@ -6909,6 +6909,7 @@ pad="2*iw:2*ih:ow-iw:oh-ih"
@end example
@end itemize
@anchor{palettegen}
@section palettegen
Generate one palette for a whole video stream.
......@@ -6954,6 +6955,55 @@ ffmpeg -i input.mkv -vf palettegen palette.png
@end example
@end itemize
@section paletteuse
Use a palette to downsample an input video stream.
The filter takes two inputs: one video stream and a palette. The palette must
be a 256 pixels image.
It accepts the following options:
@table @option
@item dither
Select dithering mode. Available algorithms are:
@table @samp
@item bayer
Ordered 8x8 bayer dithering (deterministic)
@item heckbert
Dithering as defined by Paul Heckbert in 1982 (simple error diffusion).
Note: this dithering is sometimes considered "wrong" and is included as a
reference.
@item floyd_steinberg
Floyd and Steingberg dithering (error diffusion)
@item sierra2
Frankie Sierra dithering v2 (error diffusion)
@item sierra2_4a
Frankie Sierra dithering v2 "Lite" (error diffusion)
@end table
Default is @var{sierra2_4a}.
@item bayer_scale
When @var{bayer} dithering is selected, this option defines the scale of the
pattern (how much the crosshatch pattern is visible). A low value means more
visible pattern for less banding, and higher value means less visible pattern
at the cost of more banding.
The option must be an integer value in the range [0,5]. Default is @var{2}.
@end table
@subsection Examples
@itemize
@item
Use a palette (generated for example with @ref{palettegen}) to encode a GIF
using @command{ffmpeg}:
@example
ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
@end example
@end itemize
@section perspective
Correct perspective of video not recorded perpendicular to the screen.
......
......@@ -161,6 +161,7 @@ OBJS-$(CONFIG_OVERLAY_FILTER) += vf_overlay.o dualinput.o framesy
OBJS-$(CONFIG_OWDENOISE_FILTER) += vf_owdenoise.o
OBJS-$(CONFIG_PAD_FILTER) += vf_pad.o
OBJS-$(CONFIG_PALETTEGEN_FILTER) += vf_palettegen.o
OBJS-$(CONFIG_PALETTEUSE_FILTER) += vf_paletteuse.o dualinput.o framesync.o
OBJS-$(CONFIG_PERMS_FILTER) += f_perms.o
OBJS-$(CONFIG_PERSPECTIVE_FILTER) += vf_perspective.o
OBJS-$(CONFIG_PHASE_FILTER) += vf_phase.o
......
......@@ -176,6 +176,7 @@ void avfilter_register_all(void)
REGISTER_FILTER(OWDENOISE, owdenoise, vf);
REGISTER_FILTER(PAD, pad, vf);
REGISTER_FILTER(PALETTEGEN, palettegen, vf);
REGISTER_FILTER(PALETTEUSE, paletteuse, vf);
REGISTER_FILTER(PERMS, perms, vf);
REGISTER_FILTER(PERSPECTIVE, perspective, vf);
REGISTER_FILTER(PHASE, phase, vf);
......
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