FFmpeg Deinterlace: Top or Bottom Field First
Deinterlacing video correctly requires knowing the correct field
order (parity)—either Top Field First (TFF) or Bottom Field First (BFF).
This article explains how to specify and override field parity in FFmpeg
using deinterlacing filters like yadif and
bwdif, ensuring smooth playback without interlacing
artifacts or judder.
Specifying Parity with the Yadif Filter
The most common filter for deinterlacing in FFmpeg is
yadif (Yet Another Deinterlacing Filter). You can control
the field order using the parity parameter.
The parity parameter accepts the following values: *
-1 (Auto): Automatically detects the field
parity from the input metadata (default). * 0
(TFF): Forces Top Field First. * 1
(BFF): Forces Bottom Field First.
Command Examples:
To force Top Field First (TFF) deinterlacing:
ffmpeg -i input.mp4 -vf "yadif=mode=0:parity=0" output.mp4To force Bottom Field First (BFF) deinterlacing:
ffmpeg -i input.mp4 -vf "yadif=mode=0:parity=1" output.mp4(Note: mode=0 outputs one frame for each frame,
whereas mode=1 outputs one frame for each field, doubling
the framerate).
Specifying Parity with the Bwdif Filter
If you are using bwdif (Bob Weaver Deinterlacing
Filter), which often provides better visual quality than
yadif, the syntax for specifying field parity remains the
same.
The parity parameter values for bwdif are:
* -1: Auto-detect *
0: Top Field First (TFF) *
1: Bottom Field First (BFF)
Command Example:
To deinterlace using bwdif with forced Top Field
First:
ffmpeg -i input.mp4 -vf "bwdif=mode=0:parity=0" output.mp4Overriding Metadata with Setfield
If the input file has incorrect container metadata, FFmpeg’s
auto-detection will fail. You can explicitly set the field order of the
input stream before it reaches the deinterlacer by using the
setfield filter in your filter chain.
- To set the video as TFF:
setfield=tff - To set the video as BFF:
setfield=bff
Command Example:
To mark the input as TFF and then apply deinterlacing:
ffmpeg -i input.mp4 -vf "setfield=tff,yadif=mode=0:parity=-1" output.mp4