Deinterlace Motion Heavy Video with FFmpeg Kerndeint
This guide explains how to use the kerndeint (Kernel
Deinterlacer) filter in FFmpeg to effectively deinterlace videos
containing high amounts of motion. You will learn the syntax of the
filter, its key parameters, and practical command-line examples designed
to eliminate interlacing artifacts—such as combing—while preserving
motion clarity and edge sharpness.
Understanding the Kerndeint Filter
The kerndeint filter is a motion-adaptive deinterlacer
that uses a kernel-based approach. Unlike basic deinterlacers that
simply blend frames (causing motion blur) or discard fields (halving
vertical resolution), kerndeint detects areas of motion and
applies deinterlacing only where combing artifacts are present. This
makes it highly effective for fast-moving content like sports or action
footage.
Syntax and Parameters
The basic syntax for the filter is:
-vf "kerndeint=thresh:map:order:sharp:twoway"To achieve the best results for highly motion-heavy video, you must configure these key parameters:
thresh(Threshold): Controls the sensitivity of motion detection. The range is 0 to 255 (default is 10). A lower threshold makes the filter more aggressive in deinterlacing, which is ideal for high-motion video to ensure no combing artifacts escape.map(Map display): Set to0(default) for normal output. Setting it to1paints the detected motion pixels white, which is useful for debugging and fine-tuning your threshold.order(Field Order): Specifies the input video’s field order. Set to0for Bottom Field First (BFF) or1for Top Field First (TFF). If unspecified, it auto-detects.sharp(Sharpness): Set to1(on) or0(off). For high-motion video, keeping this at1is crucial to maintain sharp edges during fast movements and avoid a muddy appearance.twoway(Two-way clustering): Set to1(on) or0(off). Enabling this (1) improves spatial filtering by checking both preceding and succeeding fields, which significantly reduces artifacts in fast-moving scenes.
Recommended Command for High-Motion Video
For a standard high-motion video (assuming Top Field First, which is common for HD interlaced footage), use the following FFmpeg command:
ffmpeg -i input.mp4 -vf "kerndeint=thresh=8:map=0:order=1:sharp=1:twoway=1" -c:v libx264 -preset slow -crf 18 -c:a copy output.mp4Why this configuration works for high motion:
thresh=8: Lowering the threshold from the default of 10 to 8 ensures that even subtle, fast-moving interlaced edges are captured and corrected.sharp=1: Prevents the video from looking soft or blurry during high-velocity camera pans.twoway=1: Sharply reduces temporal aliasing (flickering) by analyzing motion bidirectionally.
How to Fine-Tune the Filter
If you still notice combing artifacts or if the video looks too soft, use this two-step diagnostic process:
Visualize the motion map: Run the command with
map=1:ffmpeg -i input.mp4 -vf "kerndeint=thresh=8:map=1" -f matroska - | ffplay -Areas marked in white are being deinterlaced. If fast-moving edges are not white, lower the
threshvalue (e.g., to5). If static areas are white, raise thethreshvalue (e.g., to12) to prevent unnecessary filtering.Adjust Field Order: If the motion looks jittery or plays “one step forward, one step back,” your field order is likely inverted. Swap the
orderparameter (changeorder=1toorder=0or vice versa).