Skip to content

Commit

Permalink
avfilter: add palettegen filter
Browse files Browse the repository at this point in the history
  • Loading branch information
ubitux committed Feb 14, 2015
1 parent 3cab173 commit 9b96469
Show file tree
Hide file tree
Showing 4 changed files with 594 additions and 0 deletions.
45 changes: 45 additions & 0 deletions doc/filters.texi
Original file line number Diff line number Diff line change
Expand Up @@ -6909,6 +6909,51 @@ pad="2*iw:2*ih:ow-iw:oh-ih"
@end example
@end itemize

@section palettegen

Generate one palette for a whole video stream.

It accepts the following options:

@table @option
@item max_colors
Set the maximum number of colors to quantize in the palette.
Note: the palette will still contain 256 colors; the unused palette entries
will be black.

@item reserve_transparent
Create a palette of 255 colors maximum and reserve the last one for
transparency. Reserving the transparency color is useful for GIF optimization.
If not set, the maximum of colors in the palette will be 256. You probably want
to disable this option for a standalone image.
Set by default.

@item stats_mode
Set statistics mode.

It accepts the following values:
@table @samp
@item full
Compute full frame histograms.
@item diff
Compute histograms only for the part that differs from previous frame. This
might be relevant to give more importance to the moving part of your input if
the background is static.
@end table

Default value is @var{full}.
@end table

@subsection Examples

@itemize
@item
Generate a representative palette of a given video using @command{ffmpeg}:
@example
ffmpeg -i input.mkv -vf palettegen palette.png
@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 @@ -160,6 +160,7 @@ OBJS-$(CONFIG_OPENCL) += deshake_opencl.o unsharp_opencl.
OBJS-$(CONFIG_OVERLAY_FILTER) += vf_overlay.o dualinput.o framesync.o
OBJS-$(CONFIG_OWDENOISE_FILTER) += vf_owdenoise.o
OBJS-$(CONFIG_PAD_FILTER) += vf_pad.o
OBJS-$(CONFIG_PALETTEGEN_FILTER) += vf_palettegen.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 @@ -175,6 +175,7 @@ void avfilter_register_all(void)
REGISTER_FILTER(OVERLAY, overlay, vf);
REGISTER_FILTER(OWDENOISE, owdenoise, vf);
REGISTER_FILTER(PAD, pad, vf);
REGISTER_FILTER(PALETTEGEN, palettegen, vf);
REGISTER_FILTER(PERMS, perms, vf);
REGISTER_FILTER(PERSPECTIVE, perspective, vf);
REGISTER_FILTER(PHASE, phase, vf);
Expand Down
Loading

0 comments on commit 9b96469

Please sign in to comment.