How to Weave Fields into Interlaced Video in FFmpeg
This guide explains how to recombine individual, sequential fields
into a standard interlaced video stream using FFmpeg's
weave video filter. Whether you are reassembling video that
was previously split with the separatefields filter or
combining progressive field-rate frames into an interlaced format, the
following steps cover the required filter parameters, field dominance
settings, and output encoder flags.
Understanding the
weave Filter
The weave filter takes individual field frames arriving
sequentially in time and interleaves their scanlines into a single frame
with double the vertical resolution and half the frame rate.
The filter accepts a single primary option:
first_field: Specifies which field comes first temporally.top(ort): The first input field is placed on the top (odd) scanlines.bottom(orb): The first input field is placed on the bottom (even) scanlines.
Basic Usage
If you have a video stream composed of alternating fields (for example, 50 or 59.94 frames per second at half vertical resolution), use the basic filter syntax to weave them:
ffmpeg -i input_fields.mp4 -vf "weave=first_field=top" output_interlaced.mp4For Bottom Field First (BFF) sources, adjust the parameter:
ffmpeg -i input_fields.mp4 -vf "weave=first_field=bottom" output_interlaced.mp4Complete Workflow: Setting Parity and Encoder Flags
Simply weaving fields is often not enough; you must also tag the video stream metadata and configure the encoder to preserve the interlacing structure.
To create a compliant Top Field First (TFF) H.264 video, combine
setfield, weave, and encoder flags:
ffmpeg -i input_fields.mp4 -vf "setfield=tff,weave=first_field=top" -c:v libx264 -flags +ildct+ilme -top 1 output_interlaced.mp4To create a Bottom Field First (BFF) stream (common in DV formats):
ffmpeg -i input_fields.mp4 -vf "setfield=bff,weave=first_field=bottom" -c:v libx264 -flags +ildct+ilme -top 0 output_interlaced.mp4Key Parameters Explained
setfield=tff/setfield=bff: Forces the internal FFmpeg frame metadata to mark the stream as Top Field First or Bottom Field First.weave=first_field=top: Combines two consecutive fields into one frame, placing the first received field at the top line.-flags +ildct+ilme: Instructs the H.264 encoder to enable interlaced Discrete Cosine Transform (iLDCT) and interlaced Motion Estimation (iLME).-top 1/-top 0: Sets the field order flag in the container/bitstream (1for TFF,0for BFF).
Re-interlacing Full-Height Fields
If your sequential frames are already full-height (for instance, if they were generated by a deinterlacing process rather than separated scanlines), you must extract the alternating lines first before weaving them:
ffmpeg -i 60p_input.mp4 -vf "separatefields,weave=first_field=top" -c:v libx264 -flags +ildct+ilme output_interlaced.mp4Using separatefields followed by weave
allows you to strip redundant scanlines and rebuild the original
interlaced structure cleanly.