FFmpeg Yadif Mode Parameter Explained

This article explains the function of the mode parameter within FFmpeg's yadif (Yet Another Deinterlacing Filter) filter. You will learn how this parameter controls the frame rate and processing behavior of the deinterlacing process, helping you choose the right setting for your video conversion needs.

The yadif filter is one of the most popular tools in FFmpeg for converting interlaced video (where images consist of alternating odd and even lines) into progressive video (where every frame is a complete image). The mode parameter is crucial because it dictates how the filter splits or combines these interlaced fields into progressive frames.

The mode parameter accepts four integer values (0, 1, 2, and 3), each representing a different deinterlacing strategy:

  • 0 (or send_frame): This is the default setting. It outputs one progressive frame for every input frame by merging the two interlaced fields of a single frame. The original frame rate of the video is preserved (for example, 30i becomes 30p).
  • 1 (or send_field): This mode outputs one progressive frame for every input field. Because an interlaced video frame contains two fields, this mode doubles the frame rate of the output video (for example, 60i becomes 60p). This is highly recommended for content with fast motion, like sports, as it preserves the original temporal resolution and results in smoother playback.
  • 2 (or send_frame_nospatial): This works similarly to mode 0 (one output frame per input frame), but it skips the spatial interlacing check. This makes the processing faster at the expense of potential visual artifacts in static areas of the video.
  • 3 (or send_field_nospatial): This works similarly to mode 1 (one output frame per input field, doubling the frame rate), but it also skips the spatial interlacing check. It is faster than mode 1 but may produce lower-quality results.

When choosing a mode, use mode=1 if you want the smoothest motion and do not mind a larger output file size due to the doubled frame rate. Use mode=0 if you need to keep the original frame rate and minimize file size while maintaining good overall image quality.