Preview FFmpeg Filterchains Using FFplay

Testing complex video filterchains in FFmpeg can be a slow, trial-and-error process if you render a new file for every adjustment. By using ffplay, FFmpeg’s companion media player, you can preview your video filters in real-time. This guide explains how to construct and run filter previews instantly, saving you significant rendering time before you commit to a final encode.

The Basic Syntax

ffplay uses the exact same filtering engine as ffmpeg. To apply a simple video filter chain, use the -vf (video filter) flag followed by your filter string enclosed in quotes.

ffplay -vf "filter1=parameter1,filter2=parameter2" input.mp4

Examples of Previewing Filters

Here are common scenarios showing how to preview filters using ffplay.

1. Previewing Color Adjustments and Scaling

If you want to resize a video and adjust its brightness and contrast, chain the scale and eq filters together:

ffplay -vf "scale=1280:720,eq=brightness=0.05:contrast=1.2" input.mp4

2. Previewing Cropping and Deinterlacing

To check if your crop coordinates are correct while simultaneously applying a deinterlacing filter (yadif):

ffplay -vf "yadif,crop=in_w-100:in_h-100:50:50" input.mp4

3. Previewing Complex Filters (Picture-in-Picture / Overlays)

For filters that require multiple inputs, ffplay handles -filter_complex differently than ffmpeg because it typically accepts only one primary input file. To preview an overlay, use the movie source filter inside the filtergraph:

ffplay -f lavfi -i "movie=background.mp4[bg]; movie=overlay.png[logo]; [bg][logo]overlay=W-w-10:10"

Useful FFplay Controls During Preview

While previewing your filterchain, you can interact with the ffplay window to analyze the video:

Transitioning from FFplay to FFmpeg

Once you are satisfied with the look of your filters in the preview window, copy the exact filter string inside the quotes and paste it into your ffmpeg command for the final encode.

Preview command:

ffplay -vf "scale=640:360,drawgrid=w=100:h=100:t=2:c=red@0.5" input.mp4

Encoding command:

ffmpeg -i input.mp4 -vf "scale=640:360,drawgrid=w=100:h=100:t=2:c=red@0.5" -c:a copy output.mp4