How to Use FFmpeg Phase Filter for Analog Video
Analog video captures from sources like VHS, Betamax, or LaserDisc
frequently suffer from field phase shifts where interlaced fields become
misaligned across frame boundaries. This article explains how field
phase shifts occur, how the FFmpeg phase video filter
operates, and the exact commands required to automatically or manually
correct field alignment to eliminate unwanted combing artifacts.
Understanding Phase Shifts in Analog Video
Analog video is inherently interlaced, consisting of alternating top and bottom fields captured sequentially in time. When analog video is digitized, capture cards assemble these pairs of fields into digital frames. If the capture device drops a single field, begins recording on the wrong field, or encounters bad timecode sync, the temporal pairing breaks.
In a phase-shifted capture, the top field of the current frame is paired with the bottom field of the subsequent frame. On progressive source material transferred to analog tape (such as films), this causes severe horizontal comb lines (interlacing artifacts) across the entire image during motion, even when the underlying footage should be progressive.
The FFmpeg phase
Filter
The FFmpeg phase filter realigns delayed or
phase-shifted fields without having to deinterlace or discard spatial
resolution. It inspects adjacent fields and shifts the pairing forward
or backward to reconstruct the original frames.
The filter accepts a primary mode parameter that dictates how field correction is resolved:
a(Auto): Automatically analyzes the fields to detect whether a phase shift is present frame-by-frame, selecting the pairing that produces the least combing.t(Top-field first): Forces correction by pairing the current bottom field with the top field of the next frame.b(Bottom-field first): Forces correction by pairing the current top field with the bottom field of the next frame.p(Progressive): Treats the input as progressive and does not alter field ordering.
Correcting Phase Shifts with FFmpeg Commands
1. Automatic Phase Correction
For variable captures or tapes where the phase shift occurs intermittently due to tracking errors or edits, automatic detection is the most effective choice.
ffmpeg -i input.mkv -vf "phase=a" -c:v libx264 -crf 18 -preset slow -c:a copy output.mkvIn this command, phase=a continuously monitors the image
lines. When it detects motion combed with an out-of-phase field, it
dynamically shifts the field pairing to restore clean frames.
2. Fixed Manual Correction
If an entire capture has a constant phase shift from start to finish, manually forcing the field shift prevents detection errors during slow-moving or low-contrast scenes.
If the top field is delayed:
ffmpeg -i input.mkv -vf "phase=t" -c:v libx264 -crf 18 -preset slow -c:a copy output.mkvIf the bottom field is delayed:
ffmpeg -i input.mkv -vf "phase=b" -c:v libx264 -crf 18 -preset slow -c:a copy output.mkvOrder of Operations in Filter Chains
For analog restorations, the phase filter must be
applied before any spatial scaling, deinterlacing, or color grading.
Rescaling an interlaced frame before correcting the phase shift
permanently blends the out-of-phase scan lines, making clean field
separation impossible.
If working with telecined film material on analog tape, use the
phase filter prior to inverse telecine
(fieldmatch and decimate):
ffmpeg -i input.mkv -vf "phase=a,fieldmatch,decimate" -c:v libx264 -crf 18 -c:a copy output.mkvThis sequence first repairs any broken field phase, provides cleanly
matched full frames to fieldmatch, and drops redundant
duplicate frames with decimate to produce a pristine,
full-resolution progressive file.