How to Use FFmpeg Vectorscope to Analyze Color Distribution
This guide explains how to use the vectorscope video
filter in FFmpeg to analyze the color distribution, saturation, and hue
of your video files. You will learn the essential command-line syntax,
understand the key parameters of the filter, and see practical examples
of how to display a real-time color analysis alongside your video.
What is a Vectorscope?
A vectorscope is a professional monitoring tool that visualizes the chrominance (color) information of a video signal. It maps colors on a circular grid where the angle represents the hue (the color itself, like red, yellow, green, blue) and the distance from the center represents the saturation (the intensity of the color). The center of the circle represents zero saturation (black, white, or gray).
Basic FFmpeg Vectorscope Command
To quickly view the color distribution of a video using FFmpeg’s
companion media player, ffplay, run the following command
in your terminal:
ffplay -i input.mp4 -vf "vectorscope"If you want to render the vectorscope output directly into a new
video file, use ffmpeg:
ffmpeg -i input.mp4 -vf "vectorscope" output.mp4Customizing the Vectorscope Filter
The vectorscope filter accepts several parameters to
customize the visual output. The syntax follows the format
vectorscope=parameter1=value1:parameter2=value2.
Here are the most common parameters:
mode(orm): Defines the visualization mode.gray: Displays the distribution in grayscale (default).color: Displays the distribution using the actual colors.color2: A vibrant color mode.color3: Displays colors mapped to their respective coordinate positions.tint: Colorizes the vector points based on their position.
intensity(ori): Adjusts the brightness of the plotted color points. Value ranges from0.0to1.0. Default is0.008.size(ors): Sets the size of the vectorscope window. Common sizes are256(default) and512.bgopacity(org): Sets the background grid opacity from0.0(transparent) to1.0(opaque). Default is0.3.
Example: High-Intensity Color Vectorscope
To display a larger, more intense colored vectorscope, use this command:
ffplay -i input.mp4 -vf "vectorscope=m=color3:i=0.1:s=512"Viewing Video and Vectorscope Side-by-Side
To analyze your video in real-time, it is helpful to view the original video and the vectorscope side-by-side. You can achieve this by splitting the video stream, applying the vectorscope filter to one side, scaling the video to match, and stacking them horizontally.
Run the following command to see the video and a 512x512
colored vectorscope side-by-side:
ffplay -i input.mp4 -vf "split [main][temp]; [temp] vectorscope=m=color3:s=512 [vector]; [main] scale=512:512 [video]; [video][vector] hstack"Command Breakdown:
split [main][temp]: Duplicates the input video stream into two identical paths namedmainandtemp.[temp] vectorscope=m=color3:s=512 [vector]: Takes the temporary stream and applies a 512x512 colored vectorscope to it, naming the outputvector.[main] scale=512:512 [video]: Scales the original video to a 512x512 resolution so it perfectly matches the height of the vectorscope.[video][vector] hstack: Horizontally stacks the scaled video and the vectorscope output next to each other.