How to Use FFmpeg Weave Filter to Merge Fields
This article provides a straightforward guide on how to use the
weave video filter in FFmpeg to merge individual interlaced
fields into full video frames. You will learn the correct command-line
syntax, understand how the field order parameters work, and see
practical examples of how to reconstruct interlaced video streams from
split-field sources.
The weave filter in FFmpeg takes a sequence of fields
(where each input frame represents a single field, containing only the
odd or even lines of a video) and interleaves them to reconstruct
full-height interlaced frames. This process doubles the vertical
resolution of the video while halving the frame rate.
Basic Syntax and Parameters
The basic syntax for applying the weave filter is as
follows:
ffmpeg -i input.mp4 -vf "weave=first_field=top" output.mp4The filter accepts one primary parameter:
first_field(orf): Specifies which field is treated as the first line of the output frame.top(or0): The first input frame is treated as the top field (even-numbered lines, starting at line 0). This is the default setting.bottom(or1): The first input frame is treated as the bottom field (odd-numbered lines, starting at line 1).
Practical Command Examples
If you have a video that has been previously split into separate
fields (for example, by using the separatefields filter)
and you want to merge them back into a single interlaced video, you can
chain the filters or apply weave directly:
ffmpeg -i split_fields.mp4 -vf "weave=first_field=bottom" output_interlaced.mp4In scenarios where you are processing raw interlaced video streams and need to ensure the correct field dominance is maintained during the weave process, you can explicitly define the option like this:
ffmpeg -i input_fields.yuv -vf "weave=f=top" output_interlaced.mp4By default, if you do not specify the first_field
parameter, FFmpeg will assume top field dominance. Use
bottom if your source material was captured with
bottom-field-first (BFF) dominance to avoid rendering artifacts like
judder or comb-like ghosting on moving objects.