Skip to content

Commit

Permalink
avfilter: add paletteuse filter
Browse files Browse the repository at this point in the history
  • Loading branch information
ubitux committed Feb 14, 2015
1 parent 9b96469 commit bab4fce
Show file tree
Hide file tree
Showing 4 changed files with 989 additions and 0 deletions.
50 changes: 50 additions & 0 deletions doc/filters.texi
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions libavfilter/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions libavfilter/allfilters.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading

0 comments on commit bab4fce

Please sign in to comment.