Lair Of The Multimedia Guru

June 9, 2006

Deinterlacing filters

Below you will find a comparission of various deinterlacing filters, the interlaced source was created with mplayer using the phase=t and tinterlace=1 filters from the well known foreman video

all pictures where exported with mplayer -vo pnm and ppmtojpg --optimize --quality 90 why not -vo jpeg? well i didnt had -vo jpeg compiled in and -vo jpeg only accepts rgb input, so there wouldnt have been any advantage in using it …

Most deinterlacing filters only output one frame for every 2 fields that combined with the fact that some always choose the even, some always the odd and some always the first no matter if thats even or odd made this comparission less funny then i hoped originally, due to this little issue several filters (pp=ci and kerndeint IIRC) had to be feeded with vertically fliped video and tomsmocomp even needed -vf phase=b to output a frame based on the correct field and yes i of coarse did specify the top vs. bottom field first flag correctly as long as the filter had such an option …

Original non interlaced image
interlaced image mplayer -vf phase=t,tinterlace=1
mplayer -vf pp=lb (linear blend)
mplayer -vf pp=l5 (5tap lowpass filter)
transcode -J smartyuv
mplayer -vf pp=fd
mplayer -vf pp=md (median deinterlacer)
mplayer -vf pp=li (linear interpolate)
mplayer -vf pp=ci (cubic interpolate)
transcode -J dilyuvmmx
mplayer -vf kerndeint (Donald Graft’s adaptive kernel deinterlacer)
transcode -J smartdeinter (VirtualDub’s smart deinterlacer)
transcode -J tomsmocomp (Tom’s Motion Compensation deinterlacing filter)
mplayer -vf yadif=1:1
mplayer -vf yadif=3:1
mplayer -vf yadif=1:1,mcdeint=2:1:10
mplayer -vf yadif=3:1,mcdeint=2:1:10
Filed under: Uncategorized — Michael @ 16:48


  1. Still images just don’t do justice. You have to see a deinterlacer in motion, and see the jagged edges moving around to really appreciate how bad most of them really look.

    Comment by RC — June 11, 2006 @ 9:21

  2. Speaking of mcdeint, there are maybe avcodec_close/free missing in the uninit part.

    Comment by mean — June 18, 2006 @ 18:27

  3. not anymore, just added avcodec_close()

    Comment by Michael — June 19, 2006 @ 10:17

  4. Interesting results for yadif. What litterature have you checked on edge-directed interpolation that led you to this?

    Speaking of the implementation, I notice that there are such statements as:
    1) if((y ^ parity) & 1)
    2) uint8_t *prev2= (tff ^ parity) ? prev : cur ;
    3) uint8_t *next2= (tff ^ parity) ? cur : next;
    inside of the loops. While I believe that nowadays CPU’s branch prediction will optimize it, couldn’t it be made “cleaner”? (“patch welcome” is the reply I expect from you)

    Comment by Sigdrak — June 19, 2006 @ 17:01

  5. Nevermind the optimization stuff, you’ve probably tested it, and register pressure probably is more important.

    Comment by Sigdrak — June 19, 2006 @ 17:03

  6. ive not read any edge-directed interpolation related litrature lately (<1 year or so) longer ago i did read some, now i dont remember where exactly ive read about this first or how similar it was to what yadif does now exactly, but iam fairly sure it was one or more paper(s) about deinterlacing not general interpolation and it was certainly available freely online as i dont read other papers normally, i guess citeseer should find some interresting papers if you are searching for some …
    note, tomsmocomp also seems to contain some directional interpolation code, though ive only noticed that after i wrote yadif …
    and the code for mixing temporal and spatial predictors was entirely my own idea

    about optimizations, yadif and mcdeint are not really optimized and patches are always welcome, for example iam sure they could benefit alot from mmx
    filter() could also be changed to a inline function and called with “constant” tff and parity so that the compiler can optimize the related checks away while the source code would stay clean …

    Comment by Michael — June 19, 2006 @ 23:55

  7. where is mplayer -vf lavcdeint? or is it not worth comparing?

    by any chance have you had a look at dscaler deinterlace filters?

    when will you make libavfilter? or libavmunge (as LAVF is taken by libavformat). then combine all filters from all projects (vlc, xine, mplayer, transcode, etc) and people can stop reinventing the wheel and get to optimizing and creating more amazing filters!

    Comment by compn — June 20, 2006 @ 4:36

  8. -vf lavcdeint is the same as -vf pp=fd

    about dscaler, is there a way i can use it under linux easily? (i mean no qemu or such) if no i wont bother with it, if yes maybe ill test its deinterlacers too …

    iam too lazy/unmotivated to work on libavfilter currently, patches are welcome though :) but its highly nontrivial if you want to allow all the speed related tricks like direct rendering and slices together with arbitrary filter graphs, and no 1 in = 1 out design

    Comment by Michael — June 20, 2006 @ 9:08

  9. i think dscaler is windows only. but there is lots of hype for it.

    Comment by compn — June 20, 2006 @ 14:22

  10. Can anybody tell me how mcdeint works in detial? AFAIK the video has to be processed by yadif=3 first before it is processed by mcdeint. But yadif=3 already produces a deinterlaced video with doubled framerate. So for what reason we need to append mcdeint? What exactly does mcdeint do with the already deinterlaced video and who can it improve the quality at this point?

    Thanks for any information. Infos about mcdeint are rare…

    Comment by MuldeR — June 21, 2006 @ 13:08

  11. mcdeint performs motion estimation and compensation so as to fill in the “missing” lines
    to be able to estimate motion well it needs some image to work with, ive also tried to just use the available odd/even lines of the current field but that did not work as well, even simple framerate doubling deinterlacers improved the result after mcdeint

    for the motion estimation and compensation mcdeint uses the overlapped block based motion estimation/compensation code from the snow codec, so improvments to snow would automatically lead to improved mcdeint
    with mcdeint=0 things are restricted to a simple non overlapped estimation / overlapped compensation of 16×16 blocks at 1/4 pel resolution
    mcdeint=1 adds 8×8 block support and a larger diamond size for the predictive zonal search
    mcdeint=2 adds iterative overlapped block based motion estimation
    and mcdeint=3 adds multiple reference frames

    Comment by Michael — June 21, 2006 @ 19:16

  12. Thanks for reply!

    Okay, you say mcdeint fills in the “missing” lines. But if I use yadif=3 only, I already get full frames with no lines missing. Where does mcdeint fill in? Or does it just overwrite the odds/even lines?

    Futhermore that yadif=3,mcdeint doubles the number of frames. So I have to correct the framerate by hand and in the end I get a doubled framerate. Isn’t there a way to use mcdeint in a way it keeps the origianl Framerate, like TomsMoComp does? Maybe some option? Whit I tried is this: yadif=3,mcdeint,framestep=2. It seems to work fine for MEncoder, but I think it wastes too much CPU power (beacuse we skip half of the frames calculated be mcdeint). However the results look interesting! Only problem so far: It doesn’t work with MPlayer at all, because as soon as I append framestep=2 the video starts to jump forth and back…

    Comment by MuldeR — June 21, 2006 @ 20:18

  13. yes, it overwrites them

    mcdeint uses the previous deinterlaced frame(s) as reference for the motion estimation and compensation, so its not possible to skip their calculation, we wouldnt have a previous deinterlaced frame otherwise …

    mplayer -vf yadif,…,framestep=2 should be working now

    Comment by Michael — June 21, 2006 @ 21:55

  14. okay.

    Just finished a longer encoding with “mencoder -vf yadif=3,mcdeint=1,framestep=2″ and results look good.
    Too sat that it runs so slow on my machine…

    By “…should be working now” you mean it was fixed recently?

    Comment by MuldeR — June 21, 2006 @ 23:23

  15. Just tried the latest MPlayer build (2006-06-25) and it was *not* fixed :-(

    Comment by MuldeR — June 25, 2006 @ 16:52

  16. try mplayer-svn r18781, that is the one i was refering too, which was latest at the time of my comment

    Comment by Michael — June 25, 2006 @ 20:27

  17. The build I use is r18812. So if the problem was fixed in r18781, it should be fixed in my build damn sure. Unfortunately it is not…

    Comment by MuldeR — June 25, 2006 @ 22:36

  18. MuldeR, for interlaced content, the _original_ framerate _is_ the “doubled” number, i.e. 50 or 60 or 60000/1001. It’s just that each frame is missing half its lines. Pairing the fields and interleaving them into one picture at half the framerate is an artifact of the way it’s stored on the computer, and is misleading regarding the nature of the original video.

    Comment by Rich — August 2, 2006 @ 8:00

  19. Is the yadif & mcdeint combo at all usable with mencoder, if one needs to perform also inverse telecine (lets say from NTSC framerate to film framerate [23.976 fps]) in the same filter chain? I’ve tried something like -vf yadif=3:1,mcdeint=2:1:10,framestep=2,filmdint=dint_thres=256,… -fps 30000/1001 -ofps 24000/1001, but the result has always been a video with some frames doubled in fast movie scenes [filmdint here works only as pulldown reversal filter, since it performs no deinterlacing thanks to dint_thres=256]. And I’m really clueless as to what value the -fps should really ought be set in such cases like this one. Haven’t tried pullup, divtc and others yet, but I’m not too overconfident the result would really differ…

    Comment by JR — September 5, 2006 @ 12:26

  20. I’ve tried yadif=3:1,mcdeint=2:1:10,framestep=2 and I still get jittery motion for some reason. (some frames go backwards in time) This is using mplayer with mencoder rc1. I’ve also tried using -vf pullup,softskip,pp=lb and not only is that about 10-15x faster processing then the above, IMHO it works better than the yadif,mcdeint dance anyway. (Although if I could figure out how to stop the jitter with yadif,mcdent,framestep I would give it another chance.

    Does anybody know a filter or combination of filters for mencoder that are equivalent to TomsMoComp?

    Thanks for any suggestions.

    Comment by Justin — December 14, 2006 @ 15:45

  21. > I’ve tried yadif=3:1,mcdeint=2:1:10,framestep=2 and I still get jittery motion for some
    > reason. (some frames go backwards in time) This is using mplayer with mencoder rc1. I’ve also
    > tried using -vf pullup,softskip,pp=lb and not only is that about 10-15x faster processing
    > then the above, IMHO it works better than the yadif,mcdeint dance anyway. (Although if I

    If a inverse telecine filter like -vf pullup removes the “interlacing” artifacts then the respective video is not interlaced but telecined so deinterlacing isnt possible or sensible

    If -vf yadif=3:1 doesnt work with an interlaced video then try -vf yadif=3:0 or -vf yadif=3


    > Does anybody know a filter or combination of filters for mencoder that are equivalent to
    > TomsMoComp?

    no, mencoder does not support TomsMoComp, you could try transcode


    Comment by Michael — December 14, 2006 @ 17:39

  22. Michael,

    Thanks for the quick reply. I’ve been working with capture card dumps in NTSC-M 29.97 fps. It seems to be a 50-50 chance that the footage is either teleclined or interleaved. Has this been the experience with anybody else here? So what I’ve been doing first is testing a small sample of the stream with iVTC -vf,pullup,softskip, etc. and if it’s still jittery, then I try the yadif=3:1,mcdeint=2:1:10,framestep=2,filmdint=dint_thres=256, thing and it works much better. In both cases I output to 24000/1001 fps since I’m trying to save encoding space and 99% of the videos I’ve seen out there all are 23.97fps anyway. Is this the correct approach to make?

    Comment by Justin — December 15, 2006 @ 13:50

  23. it would be cool to be able to get from a 30frames/60fields video a 60frame deinterlaced video using yadif=3:1,mcdeint=2:1:20. But static objects in the video show very distracting vertical jitter (the whole background jumps up and down). Is there an mplayer option to move every second frame 1 pixel down, this should remove the jitter and result in a nice 60fps video (at least I hope).

    Comment by Georges — April 27, 2007 @ 1:14

  24. where can I find tomsmocomp writtern in C code?Thanks

    Comment by zhang — May 17, 2007 @ 3:56

  25. @ Georges
    The problem you’re having is that you have the field order reversed in your processing, which is what is giving your video jitter. I would recommend trying yadif=1:0,mcdeint=2:0:10 and see where that gets you. DV uses bottom field first rather than top field first (0 instead of 1).

    Comment by Justin — May 30, 2007 @ 21:25

  26. Yadif is very good and fast!
    So some time ago I ported yadif as a plugin to Avisynth

    Comment by Fizick — August 29, 2007 @ 19:07

  27. I am happy with

    Smoothdeinterlacer allows a color display in VD to “see” the effect of parameters : this is nice but it takes some time to find good parameter.

    Yadif seems more simple to use, but does it perform well compared to smoothdeinterlace ?

    A nice tutorial related to deinterlace :

    Comment by David — September 25, 2007 @ 14:56

  28. Hi Michael,

    I see that you used the ‘phase’ and ‘tinterlace’ filters for this. I’m actually interested in learning how they work. I know that interlacing progressive content is really a bad idea, but I’m just interested in this procedure… it’s not that I interlace my encodes here or something, I just play around with filters and trailers

    I have a question. When one uses phase=t,tinterlace=1 on a progressive 25 fps content, do I have to also set the output frame rate to double during the encoding process? I mean when you use these filters, do i have to add -ofps 50 to the mencoder parameters to obtain in the end 50 fps interlaced content? From what i understand, interlacing halves the frame rate, so if i interlace a 25 fps content, it will become 12.5 fps interlaced content…. but how do i make it 25 fps interlaced? Do i have to use a 50 fps progressive content for this, then interlace it which will bring back its frame rate to 25 fps ?

    I hope you reply to this as I don’t seem to get it :)

    Comment by segfault — January 5, 2008 @ 10:06

  29. I convert my video from DVD PAL 25fps to some PC-compatible format. For doing this I use yadif=1:0,mcdeint=2:0:20 plus -fps 50 -ofps 50 and the result is perfect (movement is smooth). But when I try to get 25 fps movie I get jittery motion… I failed to figure why exactly. Each frame looks good (movie does not jump back and forward) but visually it looks like it does jumps or shakes/flickers. :( I don’t see this effect on 50 fps movie… If 50 fps movie is smooth I think it is possible to get smooth 25 fps movie. Isn’t it? It does not matter whether I convert the movie to 25 fps during deinterlacing or in separate process – I get the same result. What can I try to make my movie more smooth? Thanks.

    P.S. I realize that 25 fps movie cannot be technically such smooth as 50 fps one. But the 25 fps movie I get is just jittery and it is more jittery than any other 25 fps movie. Actually it looks like 15-20 fps movie. I checked – only every second frame (of 50 fps movie) is dropped (so it is not frames dropping issue).

    Comment by s-andy — March 31, 2008 @ 12:13

  30. > I convert my video from DVD PAL 25fps to some PC-compatible format. […] I get jittery motion…

    Maybe its not interlaced but telecined somehow.

    Comment by Michael — March 31, 2008 @ 13:24

  31. Is there an mcdeint filter for avisynth? Without it, the yadif avisynth port is pretty useless.

    Comment by MC — April 3, 2008 @ 22:26

  32. […] VirtualDub (Windows ~ free open source) MPEG Streamclip (Windows, Mac ~ free) mencoder (Linux ~ free open source) FFmpeg (Linux ~ free open source) VLC (Windows, Mac, Linux ~ free open […]

    Pingback by Miro - Internet TV Blog » Blog Archive » Make Your Video Less Ugly: Deinterlace — August 20, 2008 @ 17:30

  33. […] Deinterlacing filter examples by Michael Niedermayer (FFmpeg maintainer) Post a comment | Trackback URI […]

    Pingback by The difference between interlacing and interlacing < WALLS OF TL;DR — September 9, 2008 @ 15:05

  34. […] geht das ganz ordentlich, wenn man etwas aufwendigere Filterkombinationen einsetzt: Gru, […]

    Pingback by Tool fr Nachbearbeitung von TV-Aufzeichnungen | hilpers — January 17, 2009 @ 18:48

  35. […] geht das ganz ordentlich, wenn man etwas aufwendigere Filterkombinationen einsetzt: Gru, […]

    Pingback by Tool fr Nachbearbeitung von TV-Aufzeichnungen | hilpers — January 17, 2009 @ 18:48

  36. […] indirizzato sulla giusta strada poich dopo aver provato qualche filtro tratto da questa pagina: ho adottato [-vf pp=li] ed ora il risultato buono. Ciao Antonio […]

    Pingback by Registrazione Film da Digitale Terrestre (difetto) | hilpers — January 21, 2009 @ 15:46

  37. […] > Przetestowalem i nic to nie daje. Poszperalem jednak troche i po komentarzach na stronie postanowilem wykorzystac framestep=2 no i niby wszystko ok. Dodam ze jak kodowalem wczesniejsza […]

    Pingback by Mencoder i problem z synchronizacja dzwieku | hilpers — January 23, 2009 @ 4:25

  38. Thanks! This was extremely useful…. damn mplayer with the man page being too long to read

    Comment by windoze — February 27, 2009 @ 2:39

  39. Hi their,
    I want to remove De-interlace problem in single still, how can I proceed, please guide me.

    thanks and Regards

    Comment by Amit g kulkarni — August 7, 2009 @ 7:59

  40. Has another determined the effects of de-interlacing on file size: especially Field Extension Deinterlacing and Motion Compensation? I have seen situations where file size increases by more than half.

    Comment by bruce clark — November 7, 2009 @ 1:25

  41. will be possible to use yadif=1/3 with ffmpeg during x264 encoding ?

    Comment by Goga — July 7, 2010 @ 8:00

  42. […] e’ venuto fuori un file da 869 Mega – che va benone; c’è anche da imparare a de-interlacciare. […]

    Pingback by SIMOTRONE WEB PAGE » Blog Archive » Da dvd a avi — July 29, 2010 @ 7:01

  43. Mplayer + mencoder isn’t cure at all… mencoder used by me only for pullup, for other stuff i prefer use avs ;)

    Comment by スカー — November 14, 2010 @ 20:11

  44. It is better to shoot progressive rather than interlaced. Then you do not have to worry about deinterlacing. I have been shooting 24p for many years and it is not because I want to get the film look. I shoot 24p because I want to get the immediate savings in file size. When I am outputting to the web and DVD, this smaller file size helps. At 24 frames per second, motion blur can be an issue but there are other considerations. For example, hummingbirds are subjects where motion blur must be considered. On YouTube channel SDmovieDotCom you can see a hummingbird I shot in 24p and I managed to slow down the subject by using a fast shutter speed.

    Comment by Business video — January 5, 2011 @ 2:12

  45. 31.Is there an mcdeint filter for avisynth? Without it, the yadif avisynth port is pretty useless.

    Comment by gelinlik — April 25, 2011 @ 23:23

  46. Smoothdeinterlacer allows a color display in VD to “see” the effect of parameters : this is nice but it takes some time to find good parameter.

    Comment by dergi — April 25, 2011 @ 23:25

  47. […] Lair Of The Multimedia Guru, Deinterlacing filters comparisation of de-interlacers […]

    Pingback by Video-Re-Encoding Step by Step | Jean's Page — May 1, 2011 @ 17:10

  48. the yadif avisynth port is pretty useless.

    Comment by billige fodboldstovler nike — May 22, 2013 @ 9:49

  49. Yadif is very popular right now, due in part to this blog post.

    However, I think this comparison shows yadif in a very favorable light, and does not show its weak points, and thus yadif comes out looking better than it necessarily is.

    I did a comparison from a later frame in the _same video_ where it pans across to the building.

    Notice the ugly artifacts in the trees for yadif. PP=FD and the original are shown for comparison. Notice too how yadif bleaches out all the detail in the bricks and “invents” horizontal lines in various places like the tree on the right.

    Comment by F J Walter — July 30, 2014 @ 4:37

  50. @ F J Walter: Were these artifacts present with ‘yadif=3:1,mcdeint=2:1:10′, or with just ‘yadif’ on its own?

    Comment by Ian Barlow — January 21, 2015 @ 17:21

  51. Good comparison highlighting effectiveness of YADIF (been a fan since it was first released).

    But why is my ffmpeg x264 encode so slooow? -vf “yadif=3:0,mcdeint=2:0,framestep=2,scale=-1:720″
    on a tff Sony Handycam 1440x1080i MTS clip gave me just 0.3 ~ 0.4 fps !!!
    On an i7 IvyBridge Quad, 16GB RAM, SSD boot, Intel RAID-0 pair of Black Caviars.
    I got lots of “snow” msgs of “pass 1″ “pass 2″, etc msgs before each encode output, and low CPU usage.
    Using simple -vf “yadif=0:0,scale=-1:720″ -sws_flags lanczos gets me 38 fps with no discernible difference in visual quality (unless you explicitly look out for them). And 99+% usage on all 8 virtual CPUs.

    Did I do anything wrong? Is mcdeint the culprit here (single tasking?) ? It can’t be 100x slower!
    Thank you for any guidance and response, I know this is an old thread.

    Comment by XEQtor — May 22, 2015 @ 9:27

  52. The problem with Chanel, though, is that for better or for worse, they have a lot of aesthetic history to consider when a new collection is designed, and Lagerfeld usually chooses to acknowledge that history.

    Comment by Fake Chanel — July 10, 2015 @ 5:42

  53. Heya i am for the first time here. I found
    this board and I find It truly useful & it helped me out much.

    I hope to give something back and aid others like you helped me.

    Comment by viewdetails http://www — August 9, 2015 @ 15:34

  54. Hi there to every , since I am truly keen of reading this website’s post to be updated daily.
    It consists of pleasant information.

    Comment by omni swipe — August 24, 2015 @ 21:01

  55. Hello I am so grateful I found your webpage, I really found you by error, while
    I was browsing on Google for something else, Anyhow I am here now and would
    just like to say many thanks for a tremendous post and a all round exciting blog (I
    also love the theme/design), I don’t have time to go through it all at the moment but I have bookmarked it and also
    added your RSS feeds, so when I have time I will be back to
    read a great deal more, Please do keep up the excellent job.

    Comment by Waterfront Homes Indiana — September 25, 2015 @ 9:06

  56. Its not my first time to pay a visit this site,
    i am visiting this site dailly and take pleasant information from here
    all the time.

    Comment by catering toronto — November 11, 2015 @ 8:42

  57. This site really has all the information I wanted
    about this subject and didn’t know who to ask.

    Comment by tmixes — November 16, 2015 @ 22:58

RSS feed for comments on this post. TrackBack URI

Leave a comment

Powered by WordPress