How to Create a Vectorscope Video Using FFmpeg
This article provides a straightforward guide on how to use the
FFmpeg vectorscope filter to visualize the color and
chrominance properties of a video. You will learn the basic command
syntax, the key parameters available to customize the monitor’s
appearance, and how to display the vectorscope side-by-side with your
original video.
Basic Vectorscope Command
To generate a video that displays only the vectorscope of your input
video, use the vectorscope video filter. The simplest
command to output a vectorscope video is:
ffmpeg -i input.mp4 -vf "vectorscope" output.mp4This command takes input.mp4, applies the default
vectorscope settings, and saves the resulting visualization as
output.mp4.
Customizing the Vectorscope Filter
The vectorscope filter has several parameters that allow
you to customize the style, intensity, and size of the scope. You can
pass these parameters in a key=value format separated by
colons.
- mode (m): Defines the visualization mode.
color(default): Shows pixels in their actual color.color3: Shows a more intense color representation.black: Displays a grayscale representation.
- intensity (i): Adjusts the brightness of the
vectorscope pixels. The range is
0.0to1.0(default is0.008). - bgopacity (g): Sets the opacity of the background
graticule (grid). The range is
0.0to1.0(default is0.75). - size (s): Sets the size of the vectorscope window
(e.g.,
256,512,1024). The default size is256x256.
Example of a Customized Command
To create a larger, high-intensity vectorscope with a solid green grid, use the following command:
ffmpeg -i input.mp4 -vf "vectorscope=m=color3:i=0.05:g=0.9:s=512" output.mp4Viewing the Video and Vectorscope Side-by-Side
To analyze video color in real-time, it is highly useful to display
the original video and the vectorscope monitor side-by-side. You can
achieve this using FFmpeg’s filter_complex along with the
hstack filter.
ffmpeg -i input.mp4 -filter_complex "[0:v]split=2[original][vscope_in];[vscope_in]vectorscope=m=color3:s=512[vscope_out];[original]scale=-1:512[original_scaled];[original_scaled][vscope_out]hstack" output.mp4How this filter graph works:
split=2: Duplicates the input video stream into two identical streams ([original]and[vscope_in]).vectorscope: Converts the[vscope_in]stream into a 512x512 pixel vectorscope monitor named[vscope_out].scale: Resizes the height of the[original]video to 512 pixels to match the height of the vectorscope, outputting it as[original_scaled].hstack: Horizontally stacks the scaled original video and the vectorscope video next to each other.