How to Weave Fields into Interlaced Video with FFmpeg

This article explains how to use the FFmpeg weave filter to combine individual sequential fields back into a standard interlaced video stream. You will learn the exact command-line syntax required for this process, how to specify field dominance (top field first or bottom field first), and how to set the correct flags to ensure media players recognize the output as interlaced.

Understanding the Weave Filter

The weave filter in FFmpeg takes two consecutive progressive frames (which represent individual fields) and interlaces them into a single frame. This process halves the frame rate of the input video while doubling the vertical resolution of each frame.

This filter is commonly used when you have previously separated an interlaced video into individual fields (using the separatefields filter) to perform edits or filtering, and now need to reconstruct the original interlaced structure.

Basic Syntax

The basic syntax for the weave filter is as follows:

ffmpeg -i input.mp4 -vf "weave" output.mp4

By default, the weave filter assumes the first field is the top field (Top Field First, or TFF).

Specifying Field Dominance

If your source video uses Bottom Field First (BFF) dominance, you must explicitly tell the filter to weave the fields accordingly. The weave filter accepts a single option to define this:

Example for Bottom Field First (BFF):

ffmpeg -i input.mp4 -vf "weave=bottom" output.mp4

Alternatively, you can use the short-form syntax:

ffmpeg -i input.mp4 -vf "weave=b" output.mp4

Encoding Interlaced Output Correctly

Simply weaving the fields together is often not enough; you must also instruct the video encoder to flag the output file as interlaced so that media players know how to deinterlace it during playback.

When encoding to H.264 (using libx264), you should include the interlaced encoding flags (-flags +ilme+ildct) and specify the field order using the fieldorder filter.

Full Command for Top Field First (TFF):

ffmpeg -i input.mp4 -vf "weave=top,fieldorder=tff" -c:v libx264 -flags +ilme+ildct -pix_fmt yuv420p output_tff.mp4

Full Command for Bottom Field First (BFF):

ffmpeg -i input.mp4 -vf "weave=bottom,fieldorder=bff" -c:v libx264 -flags +ilme+ildct -pix_fmt yuv420p output_bff.mp4

Explanation of the Parameters: