Change Video Field Order in FFmpeg
Interlaced video relies on field dominance—either Top Field First
(TFF) or Bottom Field First (BFF)—to ensure smooth temporal playback. If
a video's field order is reversed, moving elements will exhibit an
unnatural jitter or stuttering effect. This guide explains how to use
FFmpeg's fieldorder video filter to convert the field order
of your footage by physically shifting the scan lines, correcting
playback issues without needing to fully deinterlace the video.
How the fieldorder Filter Works
The fieldorder filter transforms the field structure of
interlaced video by shifting the image up or down by one scan line and
updating the internal field flag. This operation effectively inverts the
temporal priority between the two fields (converting TFF to BFF, or BFF
to TFF).
Converting to Top Field First (TFF)
If your source video is Bottom Field First (or is displaying jitter
caused by being treated as TFF when it should not be), you can convert
it to Top Field First using the tff parameter:
ffmpeg -i input.mov -vf "fieldorder=tff" -c:v prores -c:a copy output.movFor H.264 video, specify your video encoder and interlacing flags explicitly:
ffmpeg -i input.mp4 -vf "fieldorder=tff" -c:v libx264 -flags +ilme+ildct -top 1 -c:a copy output.mp4Converting to Bottom Field First (BFF)
To convert Top Field First footage to Bottom Field First (commonly required for standard-definition DV formats):
ffmpeg -i input.mov -vf "fieldorder=bff" -c:v prores -c:a copy output.movFor an H.264 destination requiring BFF:
ffmpeg -i input.mp4 -vf "fieldorder=bff" -c:v libx264 -flags +ilme+ildct -top 0 -c:a copy output.mp4fieldorder vs. setfield
It is critical to distinguish between fieldorder and
setfield:
fieldorder: Modifies the actual image data by moving scan lines vertically, converting the visual contents from one order to another. Use this when the video's fields were genuinely captured or rendered incorrectly relative to your target specification.setfield: Only alters the metadata tag indicating field order without altering video lines. If the image data is already in the correct order but the container header is falsely reporting the wrong field dominance, use-vf "setfield=tff"or-vf "setfield=bff"instead.
Verifying Field Order with idet
To verify whether your change was successful and to inspect the
interlace characteristics of the output, run the idet
(interlace detect) filter:
ffmpeg -i output.mp4 -vf "idet" -frames:v 300 -f null -The output summary in the terminal will display counts for
TFF and BFF frames, confirming whether your
video is predominantly parsed in the desired field dominance.