How to Remove Interlacing Combing in FFmpeg
When you convert interlaced video with FFmpeg, adding -vf yadif or -vf bwdif removes the horizontal combing (a comb-tooth pattern) that appears on the edges of moving objects. This process is called deinterlacing.
In my test environment, I created an interlaced video from a video whose correct answer I already had, and compared the result after removing the combing with the original. With the combing left in place, the PSNR was 26.6 dB. With yadif it recovered to 39.9 dB, and with bwdif to 40.6 dB. Excluding the time spent writing the output, both processed a 10-second video in about 0.3 seconds, and the speed was nearly the same.
The test environment was Ubuntu 24.04.5, FFmpeg 6.1.1 (Ubuntu package 6.1.1-3ubuntu5), on a 4-core virtual machine. The video was a 10-second synthetic clip made by overlaying a white box moving horizontally and some text on FFmpeg's test pattern (testsrc). I did not test real footage from video cameras or TV recordings, video recorded with bottom-field-first order, telecined video converted from film (which is undone with fieldmatch), GPU-based filters such as yadif_cuda, or nnedi, which requires a separate weights file.
- 1. Why combing appears, and the test video
- 2. Check whether the video is interlaced before removing combing
- 3. Removing combing with yadif and bwdif
- 4. Closeness to the original video and speed for each filter
- 5. For videos without interlace information, deint=interlaced has no effect
- 6. Setting the field order the wrong way round makes time jump back and forth
Why combing appears, and the test video
In interlaced video, the odd rows (1, 3, 5, …) and even rows (2, 4, 6, …) of each frame, each called a field, show the picture at different moments. Static areas are fine, but a moving object is shifted between the two fields. When you view the frame as a single picture, the edges of the object disagree from one row to the next, producing horizontal combing.
For the test, I used a video that deliberately reproduces this condition. First I made a normal 60fps video (the reference video), then combined pairs of frames into one, as in the interleave_top diagram in the tinterlace documentation. The odd rows (1, 3, 5, …) of the first frame form the top field, and the even rows (2, 4, 6, …) of the second frame form the bottom field. The result is 30fps interlaced video with the top field first.
ffmpeg -i truth.mp4 -vf "tinterlace=mode=interleave_top,setfield=tff" \
-c:v libx264 -crf 10 -flags +ildct+ilme -x264-params tff=1 interlaced.mp4
-flags +ildct+ilme is the option, listed in FFmpeg's codec options, that tells the encoder to encode for interlaced content. ffprobe showed the resulting video as follows. field_order=tt means interlaced with the top field first.
codec_name=h264|width=720|height=480|field_order=tt|r_frame_rate=30/1|nb_frames=300
Because I had the reference video, I could measure how close the combing-removed result was to the original, using FFmpeg's psnr and ssim filters. PSNR is a value in dB that becomes larger as the difference between two videos (the mean squared error) gets smaller. I also measured SSIM. As the table below shows, removing the combing raised both PSNR and SSIM, so in both cases a larger value means closer to the original video.
Check whether the video is interlaced before removing combing
If you apply a combing-removal filter to a video that is not interlaced, the image quality drops slightly (I show the numbers in a later section). So first, check whether the video is interlaced.
The first method is to look at field_order with ffprobe.
ffprobe -v error -show_entries stream=codec_name,width,height,r_frame_rate,nb_frames,field_order -of compact=p=0 interlaced.mp4
In my test environment, the reference video showed progressive, and the interlaced video showed tt. If it shows progressive, the video is not recorded as interlaced.
The second method uses the idet filter to judge from the content of the video. It looks at the actual field mismatch, not the recorded information.
ffmpeg -i interlaced.mp4 -vf idet -an -f null -
In the summary printed at the end, look at the Multi frame detection line. I put the results for the interlaced video and the reference video (normal 60fps video) side by side, with the file name at the start of each line.
interlaced.mp4: Multi frame detection: TFF: 300 BFF: 0 Progressive: 0 Undetermined: 0
truth.mp4: Multi frame detection: TFF: 0 BFF: 0 Progressive: 600 Undetermined: 0
For the interlaced video, all 300 frames were judged TFF (top field first), and for the reference video, all 600 frames were judged Progressive. However, idet can also be wrong. When I made a normal 60fps video using only FFmpeg's test pattern testsrc2 and checked it, of the 600 frames 305 were judged TFF and 236 BFF, with only 59 judged Progressive. Since the idet result is an estimate, read it on the assumption that it can be wrong.
Removing combing with yadif and bwdif
The commands to remove combing are as follows.
ffmpeg -i interlaced.mp4 -vf yadif -c:v libx264 -crf 18 out_yadif.mp4
ffmpeg -i interlaced.mp4 -vf bwdif -c:v libx264 -crf 18 out_bwdif60.mp4
I checked the written videos with ffprobe and idet, and put the results side by side with the file name at the start of each line.
out_yadif.mp4 : field_order=progressive|r_frame_rate=30/1|nb_frames=300
Multi frame detection: TFF: 0 BFF: 0 Progressive: 300 Undetermined: 0
out_bwdif60.mp4 : field_order=progressive|r_frame_rate=60/1|nb_frames=600
Multi frame detection: TFF: 5 BFF: 0 Progressive: 595 Undetermined: 0
Both were written as progressive (not interlaced) video. For bwdif, idet judged 5 of the 600 frames as TFF, but the other 595 were Progressive.
The same command gives 30fps with yadif but 60fps with bwdif. This is because their default settings differ. The yadif documentation gives the default mode as send_frame (one output frame per input frame), and the bwdif documentation gives it as send_field (one output frame per field). An interlaced 30fps video has 60 fields per second, so send_field produces 60fps.
I enlarged and compared the area around the moving text and box in the frame at the 1-second mark of playback.

In the unprocessed frame, combing appears on the left and right edges of the horizontally moving text and box. After yadif or bwdif, the combing is gone in both.
Closeness to the original video and speed for each filter
Besides yadif and bwdif, there are also w3fdif and estdif. I used all four with their default settings and compared them with the reference video. For outputs at 30fps, I compared against every other frame of the reference video (the frame that is the source of the top field). For outputs at 60fps, I compared against all frames of the reference video. The processing time is the time spent on decoding and filtering (rtime, shown by -benchmark), and it does not include the time spent writing the output.
| Setting | Output | PSNR (average) | SSIM (overall) | Processing time |
|---|---|---|---|---|
| None (combing present) | 30fps | 26.59dB | 0.9758 | 0.135 s |
yadif |
30fps | 39.85dB | 0.9969 | 0.326 s |
yadif=1 |
60fps | 39.77dB | 0.9970 | 0.468 s |
bwdif=0 |
30fps | 40.63dB | 0.9964 | 0.232 s |
bwdif |
60fps | 40.60dB | 0.9966 | 0.307 s |
w3fdif |
60fps | 35.89dB | 0.9838 | 0.295 s |
estdif |
60fps | 33.90dB | 0.9848 | 3.855 s |
For this video, yadif and bwdif were almost equally close to the original: bwdif was slightly higher on PSNR, and yadif was slightly higher on SSIM. estdif took more than 8 times as long as the other filters (about 8 times yadif=1, and about 12 times yadif). The estdif documentation says it fills in the missing rows by looking only within a single field. The bwdif documentation says it is based on yadif and combines the approach of w3fdif with cubic interpolation.
For this video, -vf yadif (keeping 30fps) or -vf bwdif (producing 60fps) was enough. If you want to keep the motion at 60 frames per second, choose the setting that produces 60fps. If you do not want to change the frame rate, choose the setting that stays at 30fps.
For videos without interlace information, deint=interlaced has no effect
yadif and bwdif have an option deint=interlaced. It applies processing only to frames recorded as interlaced. The default is all, which applies it to every frame.
I applied it to a normal video (the reference video) and compared with the original.
truth.mp4 / yadif vs truth.mp4: average:41.800467
truth.mp4 / yadif=deint=interlaced vs truth.mp4: average:inf
With the default yadif, the score dropped to 41.80 dB even though the video has no combing. With deint=interlaced, the score was inf (identical), so nothing changed.
However, some videos are interlaced in content but recorded as progressive. I re-encoded the interlaced video without the interlace flags to test this (noflag.mp4). ffprobe showed field_order=progressive, and idet judged all 300 frames as TFF.
noflag.mp4 / null vs truth.mp4: average:26.597945
noflag.mp4 / yadif vs truth.mp4: average:39.771095
noflag.mp4 / yadif=deint=interlaced vs truth.mp4: average:26.597945
With deint=interlaced, the score stayed at 26.60 dB, the same as doing nothing (null), and the combing was not removed. deint=interlaced decides whether to process based only on the recorded information, so it does not work when the recording differs from the actual content. For a video that idet judges as interlaced, process it without deint=interlaced.
Setting the field order the wrong way round makes time jump back and forth
The parity option for yadif and bwdif specifies which field comes first. According to the yadif documentation, the default auto uses the information recorded in the video, and if there is none, assumes top field first.
I deliberately specified the opposite, parity=bff, for a top-field-first video, and wrote it out at 60fps.
interlaced.mp4 / yadif=1:parity=tff vs truth.mp4: average:39.773025
interlaced.mp4 / yadif=1:parity=bff vs truth.mp4: average:23.587997
interlaced.mp4 / bwdif=1:parity=bff vs truth.mp4: average:23.575614
With the wrong setting, the score dropped to 23.59 dB (the correct setting gave 39.77 dB). When I compared the same output with a sequence in which the frames of the reference video were swapped in pairs (2nd, 1st, 4th, 3rd, …), the score was 39.62 dB.
interlaced.mp4 / yadif=1:parity=bff vs truth.mp4(shuffleframes=1 0): average:39.624484
In other words, each individual picture is restored cleanly, but the frames are in the wrong order in pairs. A moving object then advances and goes back frame by frame. Specify parity only when you know the recorded information is wrong, and otherwise leave it at the default auto.



