Generate SMPTE Color Bars Test Pattern in FFmpeg

This article provides a straightforward guide on how to generate a SMPTE color bars test pattern using FFmpeg. You will learn the exact command-line syntax required to customize the video’s resolution, frame rate, and duration, allowing you to quickly create standard-compliant testing assets.

To generate a SMPTE color bars test pattern, you use FFmpeg’s built-in virtual input device, lavfi (Libavfilter), along with the smptebars or smptehdbars source filters.

The Basic Command

Use the following command template to generate a standard 10-second SMPTE color bar video at a resolution of 1920x1080 and a frame rate of 30 frames per second (fps):

ffmpeg -f lavfi -i smptebars=size=1920x1080:rate=30 -t 10 output.mp4

Command Breakdown

Generating HD SMPTE Color Bars

For high-definition projects, standard SMPTE bars may look slightly out of spec. FFmpeg provides a specific filter for HD-compliant color bars called smptehdbars.

To generate a 1080p HD version at 23.976 fps:

ffmpeg -f lavfi -i smptehdbars=size=1920x1080:rate=24000/1001 -t 5 output_hd.mp4

Ensuring Playback Compatibility

By default, FFmpeg might encode the output using a pixel format that is not widely supported by standard media players (like QuickTime or default Windows players). To ensure maximum compatibility, force the H.264 encoder and the YUV 4:2:0 chroma subsampling format using the following command:

ffmpeg -f lavfi -i smptehdbars=size=1280x720:rate=60 -c:v libx264 -pix_fmt yuv420p -t 10 output_compatible.mp4