How to Use the FFmpeg Phase Filter

This guide explains how to use the phase video filter in FFmpeg to analyze, correct, and align misphased interlaced video fields. You will learn the syntax of the filter, the different modes available for field correction, and practical command-line examples to fix common field-dominance and interlacing issues in your video files.

What is the FFmpeg Phase Filter?

The phase filter is used to correct phase shifts in interlaced video. A phase shift occurs when the two fields (odd and even lines) that make up a video frame are misaligned in time or order. This often results in heavy interlacing artifacts (combing) even during static scenes. The phase filter shifts the video fields by one field period to match them correctly, restoring progressive-like quality or preparing the video for clean deinterlacing.

Filter Syntax and Parameters

The basic syntax for the phase filter in FFmpeg is:

-vf "phase=mode"

The mode parameter defines how the filter processes the input video fields. The most common modes include:

Practical Examples

1. Automatic Phase Correction

If you have a video with unknown interlacing phase issues, use the automatic mode. FFmpeg will analyze the fields and align them on the fly.

ffmpeg -i input.mp4 -vf "phase=a" output.mp4

2. Forcing Top-Field First (TFF) Alignment

If you know your source video is shifted and should be aligned as top-field first, force the t mode:

ffmpeg -i input.mp4 -vf "phase=t" output.mp4

3. Combining Phase Correction with Deinterlacing

Often, correcting the phase is the first step before deinterlacing a video. By aligning the fields first, the deinterlacer (like yadif) can produce a much cleaner progressive output with fewer artifacts.

ffmpeg -i input.mp4 -vf "phase=a,yadif=mode=send_frame" output.mp4

When to Use the Phase Filter

You should use the phase filter when: * You see constant combing/interlacing lines on static parts of a video. * A video was poorly digitized from an analog source (like VHS) where field alignment was lost. * Standard deinterlacers like yadif or bwdif produce blurry or ghosted results because the input fields are out of phase.