FFmpeg 2.2.16
Since* 1.2
#

Compute and draw a color distribution histogram for the input video.

The computed histogram is a representation of the color component distribution in an image.

The filter accepts the following options:

mode

Set histogram mode.

It accepts the following values:

levels

Standard histogram that displays the color components distribution in an image. Displays color graph for each color component. Shows distribution of the Y, U, V, A or R, G, B components, depending on input format, in the current frame. Below each graph a color component scale meter is shown.

color

Displays chroma values (U/V color placement) in a two dimensional graph (which is called a vectorscope). The brighter a pixel in the vectorscope, the more pixels of the input frame correspond to that pixel (i.e., more pixels have this chroma value). The V component is displayed on the horizontal (X) axis, with the leftmost side being V = 0 and the rightmost side being V = 255. The U component is displayed on the vertical (Y) axis, with the top representing U = 0 and the bottom representing U = 255.

The position of a white pixel in the graph corresponds to the chroma value of a pixel of the input clip. The graph can therefore be used to read the hue (color flavor) and the saturation (the dominance of the hue in the color). As the hue of a color changes, it moves around the square. At the center of the square the saturation is zero, which means that the corresponding pixel has no color. If the amount of a specific color is increased (while leaving the other colors unchanged) the saturation increases, and the indicator moves towards the edge of the square.

color2

Chroma values in vectorscope, similar as color but actual chroma values are displayed.

waveform

Per row/column color component graph. In row mode, the graph on the left side represents color component value 0 and the right side represents value = 255. In column mode, the top side represents color component value = 0 and bottom side represents value = 255.

Default value is levels.

level_height

Set height of level in levels. Default value is 200. Allowed range is [50, 2048].

scale_height

Set height of color scale in levels. Default value is 12. Allowed range is [0, 40].

step

Set step for waveform mode. Smaller values are useful to find out how many values of the same luminance are distributed across input rows/columns. Default value is 10. Allowed range is [1, 255].

waveform_mode

Set mode for waveform. Can be either row, or column. Default is row.

waveform_mirror

Set mirroring mode for waveform. 0 means unmirrored, 1 means mirrored. In mirrored mode, higher values will be represented on the left side for row mode and at the top for column mode. Default is 0 (unmirrored).

display_mode

Set display mode for waveform and levels. It accepts the following values:

parade

Display separate graph for the color components side by side in row waveform mode or one below the other in column waveform mode for waveform histogram mode. For levels histogram mode, per color component graphs are placed below each other.

Using this display mode in waveform histogram mode makes it easy to spot color casts in the highlights and shadows of an image, by comparing the contours of the top and the bottom graphs of each waveform. Since whites, grays, and blacks are characterized by exactly equal amounts of red, green, and blue, neutral areas of the picture should display three waveforms of roughly equal width/height. If not, the correction is easy to perform by making level adjustments the three waveforms.

overlay

Presents information identical to that in the parade, except that the graphs representing color components are superimposed directly over one another.

This display mode in waveform histogram mode makes it easier to spot relative differences or similarities in overlapping areas of the color components that are supposed to be identical, such as neutral whites, grays, or blacks.

Default is parade.

levels_mode

Set mode for levels. Can be either linear, or logarithmic. Default is linear.

#

Examples

  • Calculate and draw histogram:

    ffplay -i input -vf histogram