How to Set Field Order to TFF or BFF in FFmpeg

This guide explains how to set or convert interlaced video field dominance to Top-Field-First (TFF) or Bottom-Field-First (BFF) using FFmpeg. Whether you need to correct mislabeled container metadata or physically shift scan lines to convert interlaced material for broadcast and archival specifications, FFmpeg provides dedicated video filters and encoder flags to manage both scenarios efficiently.

1. Correcting Metadata Flags Without Modifying Video Lines

If a video was recorded as TFF or BFF but is incorrectly flagged in its metadata, you should update the field label without moving any picture lines. Use the setfield filter:

To mark as Top-Field-First (TFF):

ffmpeg -i input.mp4 -vf "setfield=tff" -c:v libx264 -c:a copy output.mp4

To mark as Bottom-Field-First (BFF):

ffmpeg -i input.mp4 -vf "setfield=bff" -c:v libx264 -c:a copy output.mp4

The setfield filter only alters the internal frame property indicating field order, ensuring downstream decoders read the frames correctly.


2. Converting the Video Content (Shifting Fields)

If the video is already flagged correctly (for example, native DV footage that is BFF), but your target deliverable requires the opposite order (such as standard broadcast TFF), you must use the fieldorder filter. This physically shifts the picture data vertically by one line to swap dominance.

Convert from BFF to TFF:

ffmpeg -i input.mov -vf "fieldorder=tff" -c:v prores_ks -profile:v 3 -c:a copy output.mov

Convert from TFF to BFF:

ffmpeg -i input.mov -vf "fieldorder=bff" -c:v prores_ks -profile:v 3 -c:a copy output.mov

3. Setting Encoder Interlacing Flags

When encoding to codecs such as MPEG-2 or H.264, the encoder needs to be explicitly instructed to maintain interlaced coding and flag the field order in the bitstream.

Use the -top parameter alongside the interlaced DCT and Motion Estimation flags (-flags +ildct+ilme):

  • -top 1 = Top-Field-First (TFF)
  • -top 0 = Bottom-Field-First (BFF)

Full H.264 Interlaced TFF Encoding Example:

ffmpeg -i input.mov -vf "setfield=tff" -c:v libx264 -flags +ildct+ilme -top 1 -pix_fmt yuv420p -c:a copy output.mp4

Full MPEG-2 Interlaced BFF Encoding Example:

ffmpeg -i input.mov -vf "setfield=bff" -c:v mpeg2video -flags +ildct+ilme -top 0 -b:v 15M -c:a copy output.mpg

4. Verifying the Field Order

To verify whether your output has been correctly tagged, use ffprobe to inspect the field order metadata on the video stream:

ffprobe -v error -select_streams v:0 -show_entries stream=field_order -of default=noprint_wrappers=1 input.mp4

This command will return tt (Top-Field-First), bb (Bottom-Field-First), or progressive.