How to Use FFmpeg separatefields Filter
This article explains how to use the separatefields
filter in FFmpeg to split interlaced video frames into individual
fields. You will learn the purpose of this filter, its basic command
syntax, and how it alters video properties like frame rate and
resolution during processing.
What is the separatefields Filter?
In interlaced video, each frame consists of two fields captured at different points in time: the top field (odd lines) and the bottom field (even lines).
The separatefields filter splits each interlaced frame
into two separate, consecutive frames (one for each field). This
process: * Doubles the frame rate: Since one frame
becomes two fields, a 30 fps video becomes a 60 fps stream. *
Halves the height: Because each field contains only
half the vertical lines of the original frame, a 1920x1080 frame is
split into two 1920x540 frames.
This filter is highly useful for processing, filtering, or analyzing individual fields of interlaced footage before potentially recombining them.
Basic Syntax
To apply the separatefields filter, use the
-vf (video filter) flag followed by
separatefields.
ffmpeg -i input.mp4 -vf separatefields output.mp4In this command: * -i input.mp4 specifies your input
interlaced video. * -vf separatefields applies the filter.
* output.mp4 is the resulting video, which will have double
the frame rate and half the height of the input.
Advanced Usage: Combining with Weave
A common workflow involves separating fields to apply a specific
filter to them individually, and then stitching them back together using
the weave filter.
For example, to separate fields, apply a denoise filter
(hqdn3d), and then recombine them back into an interlaced
frame, use the following filterchain:
ffmpeg -i input.mp4 -vf "separatefields, hqdn3d, weave" output.mp4This ensures that the denoising filter processes the fields independently, preventing interlacing artifacts from degrading the filter’s effectiveness.