View Full Version : Which MPEG2 codec with deinterlacing?


mr.duck
20th April 2009, 22:15
For playing back recorded TV shows a good mpeg2 decoder is needed. It needs to have high quality deinterlacing that also outputs at 25 FPS to keep ReClock happy, and to be able to use FFDShow upscaling (50 FPS is just too much work dispite having dualcore 2.1GHz CPU). Last thing it needs is to detect aspect ratio changes properly.

The only decoders I've found that fit the requirements are cyberlink and arcsoft. Both are good but I think arcsoft is a little better. I'm interested to know what other people out there are using...

Leak
20th April 2009, 23:21
The only decoders I've found that fit the requirements are cyberlink and arcsoft. Both are good but I think arcsoft is a little better. I'm interested to know what other people out there are using...
What's wrong with using ffdshow for MPEG2 decoding and it's YaDIF deinterlacer? Works great for all my DVDs...

np: Kontext - Blinkende Stjerne (Round Black Ghosts 2)

mr.duck
21st April 2009, 11:54
Only thing wrong with it is I thought it was impossible to use deinterlacing and upscaling in FFDshow at the same time. Some sort of limitation with FFDshow.

I'm just trying to find out how to get best possible video playback quality.

Leak
21st April 2009, 13:26
Only thing wrong with it is I thought it was impossible to use deinterlacing and upscaling in FFDshow at the same time. Some sort of limitation with FFDshow.
Whatever made you think that? :confused:

Just make sure to deinterlace before resizing - you can drag the entries in the filters list to change the order in which they are applied.

np: DOOM - Batty Boyz (Born Like This)

mr.duck
21st April 2009, 19:22
Ok I think I got mixed up when I was using DScaler deinterlacing filters before. It would produce this flickering picture.

YaDIF is nice... it works well but at only 25fps it is too juddery. It needs some motion blur. For example at the cinema, the movie is only 24fps but you never think "this film's frame rate isn't high enough".

Try linear blending in FFDShow. That is the only one that produces a smooth, fluid video at 25fps. But it doesn't produce a great picture, it is too smeary. Not clean and crisp enough.

Are there any other deinterlacing filters that can be used with FFDShow? I tried DScaler4 ones but they don't work at the same time as resizing.

leeperry
21st April 2009, 19:31
for what it's worth, I use Gabest's MPEG2 decoder in "auto" mode/YV12, it does the job! I never managed to get YADIF to output good stuff w/o double frame rate(which my Avisynth scripts can't process fast enough for realtime use).

tom'smocomp is good too, well last time I tried it on DVD at least....but not combing free.

TinTime
21st April 2009, 21:02
Have you got your heart set on resizing in ffdshow?

My own preference for genuine 50i video would definitely be double rate output (with something like Yadif) and no resizing (more specifically, let the graphics card resize), rather than same as input rate output (with any deinterlacer) and resizing.

You just lose motion going from 50i to 25p, hence the judders. Any advantage there may be using ffdshow to resize rather than the graphics card will, in my opinion, be more than lost by discarding movement with a same rate deinterlacer.

If the source isn't proper 50i then it's a different story.

mr.duck
22nd April 2009, 14:20
Yes Gabest's MPEG2 decoder has got to be one of my favorite free mpeg2 decoders. I used it with bob deinterlace and found the quality to be really excelent. If it could handle aspect ratio changes properly, I would still be using it now. It's a shame it's stoped being developed.

tomsmocomp is watchable but not great. Somthing not quite right about it. Plus some very strange effects if you put the search effort up.

YaDIF with double framerate is really excelent just like Gabest's MPEG2 decoder with BOB. And even better, I can still resize without overloading the CPU! :D I couldn't do that with Gabest decoder, so FFDshow must be coded very well. I'm just using the generic build, beta6 rev2527. CPU is Athlon X2 2.1GHz and get around 80% CPU usage accross both cores. Excelent stuff.

leeperry
22nd April 2009, 14:25
AR works fine here w/ Gabest's MPEG2 decoder...I think

I don't use it in BOB mode, though.

mark0077
22nd April 2009, 14:29
yadif is the best software de-interlacer I have ever seen. I still think it could be slightly improved to try and match up to some of the hardware de-interlacers. Should be possible cpu power wise nowadays with our 4 cores etc. I wonder who the author is to see if he has ideas for further improving it ;)

roozhou
22nd April 2009, 15:32
yadif is the best software de-interlacer I have ever seen. I still think it could be slightly improved to try and match up to some of the hardware de-interlacers. Should be possible cpu power wise nowadays with our 4 cores etc. I wonder who the author is to see if he has ideas for further improving it ;)

The author is Michael Niedermayer, who is also one of the major maintainers of ffmpeg & mplayer at present.

mark0077
22nd April 2009, 15:52
Thanks, I will try and track him down on a forum maybe to see if he can take yadif further, quality wise.

mr.duck
22nd April 2009, 17:32
AR works fine here w/ Gabest's MPEG2 decoder...I think

Aspect ratio is correct until the aspect changes mid video. The gabest decoder doesn't seem to recognise when that happens. You can get a lot of aspect ratio changes with TV recordings.


yadif is the best software de-interlacer I have ever seen. I still think it could be slightly improved to try and match up to some of the hardware de-interlacers. Should be possible cpu power wise nowadays with our 4 cores etc. I wonder who the author is to see if he has ideas for further improving it ;)

From what I have seen, there are 2 categories of deinterlacers. YaDIF is good at deinterlacing true interlaced video such as video shot in 25i by TV film crews. The other type is like the cyberlink and arcsoft decoders. They try to restore the original video such as hollywood movies shot at 24p and then converted to interlaced format for TV transmission. So for YaDIF to be improved, it can be taken down 2 different paths.

mark0077
22nd April 2009, 18:11
Or down both paths and smartly handle everything ;) I contact the creator to ask if he has any intentions of improving it further.

Blue_MiSfit
22nd April 2009, 23:10
Guys.. don't get ahead of yourseleves. You're getting your terminology confused.

YADIF is a deinterlacer. Meaning, it can take pure interlaced input and output either single rate or double rate progressive. In the case of PAL, this means outputting 25p (losing half the temporal resolution / motion) or 50p (keeping all temporal resolution).

The other "category" you're thinking of is inverse telecine. This is not deinterlacing :) It's simply matching fields and deleting duplicates to restore the original 23.976p out of 29.97i (usually). Most new DVDs use a technique called soft pulldown, where the stream is actually encoded at 23.976p, and there are flags in the bitstream to perform the 3:2 pulldown when necessary. On the PC, this is never necessary, so if your player is set up correctly there should be no IVTC required.

The important thing to realize is that YADIF is a deinterlacer. It has nothing to do with inverse telecine, though it can be used as part of an advanced inverse telecine workflow for oddball sources where smart-bobbing is necessary.

Don't bother Michael with requests to make YADIF capable of IVTC. That's not what it's intended to do, and there are plenty of alternatives out there that do a perfectly fine job :)

~MiSfit

mark0077
22nd April 2009, 23:26
I thought there was something strange about mr.duck's post on 2 different paths! ;)

Yeah libavcodec in ffdshow does a nice job of doing inverse telicine although I never have a need for it.

Regarding de-interlacing quality, I can see slightly better quality de-interlacing though from nvidia and ati hardware de-interlacing. It would be nice to see yadif improved to this standard where cpu power is high enough.

Regarding detecting of interlaced vs progressive sources (not relying on flags), haruhiko yamagata says he may get time to look into doing this in software if he has enough time. I am sick and tired of having to manually enable / disable de-interlacing for my PAL DVD's, 95 of which are badly marked.

leeperry
22nd April 2009, 23:50
YADIF is a deinterlacer. Meaning, it can take pure interlaced input and output either single rate or double rate progressive. In the case of PAL, this means outputting 25p (losing half the temporal resolution / motion) or 50p (keeping all temporal resolution).
so you can't get the whole motion in 25p? it's interlaced, so buffering one field over the other should turn 25i into 25p? ah well, I never really understood that stuff :o

turning 25i in 50p is actually 50p in the end? or some "trimension" 50i w/ interpolated frames? coz that's what it looks like..

mark0077
23rd April 2009, 00:19
so you can't get the whole motion in 25p? it's interlaced, so buffering one field over the other should turn 25i into 25p? ah well, I never really understood that stuff :o

turning 25i in 50p is actually 50p in the end? or some "trimension" 50i w/ interpolated frames? coz that's what it looks like..

If my understanding is correct, 25i contain's 25 interlaced frames, each of which contains two fields (essentially half frames, picture a frame cut into strips, each field is a collection of half of these strips, the next field being the second half of these strips but from a small section of time later).

This corresponds to 50 fields, or 50 half frames per second....

Because each field wasn't take at the same time (by the camera....).. to combine these 50 half frames into 50 normal frames, the missing strips (missing half) of information needs to be filled in for each. What most of the best hardware de-interlacers do is something like trimension that you talk about, an attempt to guess what would have being originally in those stripped out areas based on the fields before / after it.

My hope is that yadif can be improved to better guess what would have originally being in these stripped out areas using better techniques, as it seems its still not as good as the hardware de-interlacers that seem to detect motion using "motion vector de-interlacing" and are able to more accurately fill in those missing areas with useful content leading to beautiful 50 progressive frames from the 50 half / stripped frames.

Someone correct me if I am wrong but this is my understanding. 25p is not the perfect outcome from a 25i -> progressive transformation, 50p is, otherwise we would be just throwing away data, not using it in the best way possible. (unless the top and bottom field are from the exact same time? (take at the same time by the camera and later transformed into interlaced form for some reason), in this case 25p would be the correct output and could be achieved by simply "weaving" the two fields into one frame assuming they were originally recorded at the precise same time).

TinTime
23rd April 2009, 01:10
Someone correct me if I am wrong but this is my understanding. 25p is not the perfect outcome from a 25i -> progressive transformation, 50p is, otherwise we would be just throwing away data, not using it in the best way possible.

Firstly it's generally referred to (although I've seen debate over this before) as 50i, not 25i, so I'm going to stick with 50i :)

Your understanding of 25 interlaced frames per second is correct though. This means that the image is sampled fifty times per second. If you convert to 25p this effectively means throwing away half of any motion to try and retain sharpness, leading to stuttery motion. Alternatively it means blending two moments in time together, leading to smoother, but blurrier, playback. Imagine converting 50p to 25p and what that would do to any motion in the image. Static portions would still look ok though. It's the same with 50i to 25p.

So for good results (and IMO far more important than any other post-processing) the 50i source should be bobbed to 50p, if it's genuinely interlaced.

(unless the top and bottom field are from the exact same time? (take at the same time by the camera and later transformed into interlaced form for some reason), in this case 25p would be the correct output and could be achieved by simply "weaving" the two fields into one frame assuming they were originally recorded at the precise same time).

There are a couple of cases here. The first is stuff shot on film. The stream may be flagged as 50i but each pair of fields comes from the same frame of film (sped up from 24 to 25fps). In this case the fields should just be weaved together resulting in 25p output as you said.

The second case is for genuinely interlaced material. If the image is static then although the two fields come from different times it doesn't matter because there's no motion. Then the fields can be weaved together.

Ideally want you want from a deinterlacer when converting 50i to 50p (or to 25p for that matter) is for it to weave together static portions of the image, and only interpolate motion.

I am sick and tired of having to manually enable / disable de-interlacing for my PAL DVD's, 95 of which are badly marked.

Couldn't agree with you more.

leeperry
23rd April 2009, 01:54
well what I understood if that when you have the top field of the original frame, the bottom field of the same frame will be in n+1...basically you have fields constantly mismatched and need to put them back together by buffering n-1

but well, I avoid interlaced stuff like the plague, coz I don't like interpolated frames and my avisynth scripts can't process 50fps anyway :o

mark0077
23rd April 2009, 09:30
The second case is for genuinely interlaced material. If the image is static then although the two fields come from different times it doesn't matter because there's no motion. Then the fields can be weaved together.

This is the part that confuses me, and is also the same description given for ATI and NVidia hardware deinterlacers.

My criticism with this is, is it worth worrying / even thinking about, the fact that certain portions can contain motion or not. If we know its from a source that contains field from different times, why not apply the same motion detection to every part of the image and just not think about certain parts that contain little or no motion.

IMO the algorithm shouldn't be specifically looking for "no motion" or "motion", but just try and merge those fields together with the simple assumption that they come from different times so motion could be involved.....

In the case of DVD's, I read somewhere that they are interlaced on the disk, but come from a progressive source normally so weaving the fields together is mostly best. I also read that there is a flag that says whether or not the image comes from a progressive source or not, and it is this flag thats set incorrectly on most disks, leading de-interlacers to go crazy and make 50p out of something that just needs simple weaving back to 25p. Even the excellent ATI AND NVidia deinterlacers don't detect this very well and can be seen to output 50p which looks very good, but DOES contain tiny artifacts that do not need to be there if simple weave is done.

I look forward to the day when we can detect one versus the other in software. Hopefully soon so its no longer a manual step on the PC. :D

mr.duck
23rd April 2009, 10:29
The other "category" you're thinking of is inverse telecine. This is not deinterlacing :) It's simply matching fields and deleting duplicates to restore the original 23.976p out of 29.97i (usually).

I don't think I am getting mixed up between deinterlacing and IVTC. I was trying to compare the quality of the video output of YaDIF compared to cyberlink/arcsoft. It was a subjective test - just me watching some videos and comparing them.

I will try and give another example. Just let me know if I really am getting mixed up...

The Simpsons will be pure progressive source material. There's no way it was drawn interlaced. I can record it off the air from a DVB-T transmission. So it's delivered to me as 50i (50 half frames per sec) MPEG2 file. Now if I play it with YaDIF deinterlacing, I get 50p output. As if YaDIF works best with true interlaced source material (such as 50p converted into 50i? I don't know how it's done; maybe just video that is filmed right as 50i in the first place). The arcsoft deinterlacing outputs 25p. As if it is undoing the inital convertion into an interlaced format (NOT the same as YaDIF at 25p which simply is not as nice as YaDIF at 50p). The arcsoft at 25p output is very nice - similar to 24p movie film material.

That's why I was trying to put deinterlacers in 2 categories.
1) Deinterlacing true interlaced video to get double frame rate output. YaDIF does this well.
2) Deinterlacing video to restore it more to it's original format before it was converted to interlaced video. Arcsoft does this well.

mark0077
23rd April 2009, 10:40
I don't think I am getting mixed up between deinterlacing and IVTC. I was trying to compare the quality of the video output of YaDIF compared to cyberlink/arcsoft. It was a subjective test - just me watching some videos and comparing them.

I will try and give another example. Just let me know if I really am getting mixed up...

The Simpsons will be pure progressive source material. There's no way it was drawn interlaced. I can record it off the air from a DVB-T transmission. So it's delivered to me as 50i (50 half frames per sec) MPEG2 file. Now if I play it with YaDIF deinterlacing, I get 50p output. As if YaDIF works best with true interlaced source material (such as 50p converted into 50i? I don't know how it's done; maybe just video that is filmed right as 50i in the first place). The arcsoft deinterlacing outputs 25p. As if it is undoing the inital convertion into an interlaced format (NOT the same as YaDIF at 25p which simply is not as nice as YaDIF at 50p). The arcsoft at 25p output is very nice - similar to 24p movie film material.

That's why I was trying to put deinterlacers in 2 categories.
1) Deinterlacing true interlaced video to get double frame rate output. YaDIF does this well.
2) Deinterlacing video to restore it more to it's original format before it was converted to interlaced video. Arcsoft does this well.

Ah very interesting. When using Arcsoft are you using hardware or software de-interlacing do you know. If its hardware, your gfx card might be detecting badly marked flags and correcting for that, and outputting 25p correctly.... I can't be sure though.

Well this is what I think happens with all of my DVD's, they fit into your category 2 yet still output 50fps when the bad flags are not correctly corrected for.

I have one question for anyone who knows. What input flags does yadif take. I mean can it be told the source is interlaced but originates from a progressive source (ie the flags that seem to be contained within mpeg2), so can it then weave or do motion compensation in case 1?

I think if given the right flags, yadif can handle these scenarios nicely, but often its not given the right information. In my sources as I say, this is because the sources are so badly marked and there is no good software system in place to detect these badly marked materials. The decoders rely too heavily on these flags.

mr.duck
23rd April 2009, 10:53
Ah very interesting. When using Arcsoft are you using hardware or software de-interlacing do you know. If its hardware, your gfx card might be detecting badly marked flags and correcting for that, and outputting 25p correctly.... I can't be sure though.

Arcsoft supports DXVA for all video formats, but as far as I know, I've been operating purely in software mode including using FFDShow to scale up video to my monitor's screen resolution. The same for both arcsoft vs FFDShow/YaDIF.

TinTime
23rd April 2009, 15:33
The Simpsons will be pure progressive source material. There's no way it was drawn interlaced. I can record it off the air from a DVB-T transmission. So it's delivered to me as 50i (50 half frames per sec) MPEG2 file. Now if I play it with YaDIF deinterlacing, I get 50p output. As if YaDIF works best with true interlaced source material (such as 50p converted into 50i? I don't know how it's done; maybe just video that is filmed right as 50i in the first place). The arcsoft deinterlacing outputs 25p. As if it is undoing the inital convertion into an interlaced format (NOT the same as YaDIF at 25p which simply is not as nice as YaDIF at 50p). The arcsoft at 25p output is very nice - similar to 24p movie film material.

That's why I was trying to put deinterlacers in 2 categories.
1) Deinterlacing true interlaced video to get double frame rate output. YaDIF does this well.
2) Deinterlacing video to restore it more to it's original format before it was converted to interlaced video. Arcsoft does this well.

But The Simpsons is an American show so it will have been shoehorned into 50i in one of many possible ways that may, or may not, require deinterlacing at your end.

I haven't got any experience with The Simpsons, or DVB-T for that matter, but I'm currently encoding all my R2 Sopranos DVDs to avc so I'll tell you what I've found.

It was shot on film at 24fps so most seasons have simply been sped up to 25fps. The top field of each frame matches the bottom field so no further action is required, apart from the very occasional combed frame that seems to exist.

Seasons 1 and 5 (or 4 - can't remember which) have not been sped up though. They have been converted from 24p to 50i by some method I've not established yet, but that involves inserting blended fields. I'm not sure yet what to do with these so I'm leaving them till last :). I need to check them out properly. Possibly a mixture of deinterlacing and decimation along the lines of restore24 or Mrestore.

Finally the last episode of season 2 is slightly different from all the other episodes in that season. It has also been sped up (24 to 25) but the top field of each frame matches the bottom field from the previous frame. This needs a field matcher like Telecide to generate 25p output. It doesn't need deinterlacing though, despite the fact that it looks interlaced when played back without any post-processing. If I deinterlaced I would end up with a worse picture.

This is the distinction that Blue_MiSfit was making between deinterlacers and field matchers. Progressive material should be field matched, not deinterlaced. Genuinely interlaced material should be deinterlaced, not field matched. Hybrid stuff I'm not even going to mention...

The problem then is working out what the source actually is and in the world of PAL, and especially the world of PAL versions of American TV shows, it's not always easy. This is really why I'm transcoding my DVDs. It's not to save space (I use high bitrates), it's to store them all as progressive so I can just play them back as is.

Your category 2 can be really hard to do well for 24p to 50i conversions without speedup. I don't know how Arcsoft and Yadif work, or what your Simpsons stream is like though. It's possible that Arcsoft is field matching whereas Yadif isn't, or Arcsoft is blending where Yadif isn't, which may lead to smoother playback.

TinTime
23rd April 2009, 16:46
My criticism with this is, is it worth worrying / even thinking about, the fact that certain portions can contain motion or not. If we know its from a source that contains field from different times, why not apply the same motion detection to every part of the image and just not think about certain parts that contain little or no motion.

IMO the algorithm shouldn't be specifically looking for "no motion" or "motion", but just try and merge those fields together with the simple assumption that they come from different times so motion could be involved.....

You're saying ignore motion, but then apply motion detection, and then don't look for "no motion" or "motion" but assume that motion could be involved. I'm confused :D

Imagine a static camera filming a room with you walking left to right across the frame. There's a table or something in the room too. Now you want to convert this from 50i to 50p.

This can be done with a dumb bob like Avisynth's Bob. This works without any motion detection which I guess is what you mean. The top and bottom fields are separated. The top field is then resized to the frame size (i.e. the height is doubled), interpolating the bottom field. Then the bottom field is resized, interpolating the top field. The result is two frames, where you are 1/50th of a second further across the room in the second frame.

That's fine for you because you are moving. However the table in the room hasn't moved. So a smarter way to deal with the table when generating a frame from the top field is to just take the pixels from the bottom field. This is the genuine image which trumps interpolation. Interpolation only needs to be used for you because you are moving, and so are combed in the original frame.

The same applies to 50i to 25p conversion. You could just throw away the bottom field and interpolate everything from the top. The better way though is to weave the fields together and only interpolate where combing (i.e. motion) occurs. An even better way is to check for motion over a longer period of time so that you don't accidentally deinterlace apparently combed but static objects.

I suspect this is what you mean when you said "just try and merge those fields together with the simple assumption that they come from different times so motion could be involved" so I apologise if I'm just telling you what you already know. I just thought I'd try and clarify it.

In the case of DVD's, I read somewhere that they are interlaced on the disk, but come from a progressive source normally so weaving the fields together is mostly best. I also read that there is a flag that says whether or not the image comes from a progressive source or not, and it is this flag thats set incorrectly on most disks, leading de-interlacers to go crazy and make 50p out of something that just needs simple weaving back to 25p. Even the excellent ATI AND NVidia deinterlacers don't detect this very well and can be seen to output 50p which looks very good, but DOES contain tiny artifacts that do not need to be there if simple weave is done.

I look forward to the day when we can detect one versus the other in software. Hopefully soon so its no longer a manual step on the PC. :D

Most PAL DVDs are flagged as interlaced even though most PAL films can be treated as progressive. Deinterlacing these is a bad idea because thing like Venetian blinds often get detected as combed. Only manual intervention can help here, by turning off deinterlacing, or editing the mpeg-2 stream to flag it as progressive. Detecting in software can never be 100% effective IMO, although it will get better as motion is detected more accurately. The ideal solution though would be for people to release correctly flagged DVDs. Apparently that's too much to ask for :(

mark0077
23rd April 2009, 17:00
You're saying ignore motion, but then apply motion detection, and then don't look for "no motion" or "motion" but assume that motion could be involved. I'm confused :D



Imagine a static camera filming a room with you walking left to right across the frame. There's a table or something in the room too. Now you want to convert this from 50i to 50p.

This can be done with a dumb bob like Avisynth's Bob. This works without any motion detection which I guess is what you mean. The top and bottom fields are separated. The top field is then resized to the frame size (i.e. the height is doubled), interpolating the bottom field. Then the bottom field is resized, interpolating the top field. The result is two frames, where you are 1/50th of a second further across the room in the second frame.

That's fine for you because you are moving. However the table in the room hasn't moved. So a smarter way to deal with the table when generating a frame from the top field is to just take the pixels from the bottom field. This is the genuine image which trumps interpolation. Interpolation only needs to be used for you because you are moving, and so are combed in the original frame.

The same applies to 50i to 25p conversion. You could just throw away the bottom field and interpolate everything from the top. The better way though is to weave the fields together and only interpolate where combing (i.e. motion) occurs. An even better way is to check for motion over a longer period of time so that you don't accidentally deinterlace apparently combed but static objects.

I suspect this is what you mean when you said "just try and merge those fields together with the simple assumption that they come from different times so motion could be involved" so I apologise if I'm just telling you what you already know. I just thought I'd try and clarify it.

Most PAL DVDs are flagged as interlaced even though most PAL films can be treated as progressive. Deinterlacing these is a bad idea because thing like Venetian blinds often get detected as combed. Only manual intervention can help here, by turning off deinterlacing, or editing the mpeg-2 stream to flag it as progressive. Detecting in software can never be 100% effective IMO, although it will get better as motion is detected more accurately. The ideal solution though would be for people to release correctly flagged DVDs. Apparently that's too much to ask for :(

What I mean is, why disable / enable de-interlacing during a certain clip because there is motion / no motion, instead just figure out what should be done to the entire clip and do that. Its like, theres a car thats dirty. I am saying I don't know why these de-interlacers go and try and find dirty vs non dirty parts when they could just go and wash the entire thing. I hope my analogy makes sense, why not just de-interlace assuming there could be motion, instead of going out looking for it, or for the lack of it for that matter.... This just makes sense to me and would seem CLEARLY like the most logical / best way to do it. Even if there is "no motion", there could be motion so slight that you hardly notice it. I prefer to still apply the motion detection algorithms here to detect this tiny 1px motion perhaps, instead of just saynig... oh no motion here lets just do x method..

Yeah regarding DVD's I actually tried to find software lastnight to try and remaster my dvd's... According to another guy in the ffdshow thread, DVD's are "interlaced" and contain the flag to say this... but there is also another flag that says what source that interlaced content comes from, progressive or interlaced. I think it is this second flag that is set wrong / not set at all, on a HUGE / nearly all DVD's (at least almost all of mine) which leads to millions of ugly images on TV's... Disgusting to see some friends using cheap / mid range hardware players in their living rooms and I can see in certain common intro scenes / copyright text's that their player is de-interlacing something that doesn't need de-interlacing... or to be more specific, its doing some de-interlacing other than simple weave... that ends up splodging up the image (even if only slightly). Weave could have gotten them their PERFECT 25p image from that interlaced souce..... just annoys me :P

Anyways, glad to hear people discussing this, definitely something that needs looking into software wise. By definition all of the decoders could just follow the specs, but because there are SO MANY badly marked DVD's, I think an advanced work around needs to be put in place to rival those more expensive hardware players that can detect incorrect flags etc.

BUT

One thing I don't understand, which shows how little I know about all of this, is that when de-interlacing is completely turned off for these DVD's that are badly marked they look fine. This surprises me because wouldn't a de-interlacer be needed to do the "weave" to get back to 25p. I don't know what weaves the fields back together when de-interlacing is off....

TinTime
23rd April 2009, 17:21
I think your analogy isn't quite correct. It's more like you've got a dirty car that also has decals on it. You can either leave the car dirty (unacceptable) or vigorously wash the whole car, removing the decals (better but not great). Ideally you want to wash the car but leave the decals in place.

EDIT - It's just occurred to me that this analogy is much closer to denoising the car than deinterlacing it. Never mind :)

Looking for slight motion is just a question of adjusting the sensitivity of the combing detection. For static areas though there's just no substitute for weaving the fields together.

I also watched a DVD at a friend's the other day and hated the occasional flashes of combing that appeared. It's one of those issues where knowledge is a dangerous thing. If you don't know to look for it, it doesn't bother you. Oh well.

TinTime
23rd April 2009, 17:28
One thing I don't understand, which shows how little I know about all of this, is that when de-interlacing is completely turned off for these DVD's that are badly marked they look fine. This surprises me because wouldn't a de-interlacer be needed to do the "weave" to get back to 25p. I don't know what weaves the fields back together when de-interlacing is off....

The frame is decoded as a whole so it's already weaved. What a deinterlacer does is process the fields within the frame. Do no processing and provided the top and bottom fields belong together, as they usually do with PAL movies, then it's as good as it will get.

Actually, I'm not sure if the fields are decoded separately or not but the result is that decoders seem to return frames, not fields.

Aktan
23rd April 2009, 19:54
What's wrong with using ffdshow for MPEG2 decoding and it's YaDIF deinterlacer? Works great for all my DVDs...

np: Kontext - Blinkende Stjerne (Round Black Ghosts 2)

Sorry a bit late, but YaDIF can't compete with later generation GPU hardware deinterlacers. I have several Anime DVDs where the GPU Deinterlacers are far smoother and superior than what I get from YaDIF. Even the author of YaDIF has noted this is true (sorry can't find source atm). Edit: Well I must have mixed it up, here is where I saw that information: http://forum.doom9.org/showthread.php?t=129834

Btw, if you set the output of ffdshow to NV12 and send the interlace flag, you can also use the GPU hardware deinterlacing if you connect to a DXVA compatible video renderer. I do this to hardware deinterlace my captures for console playing =)

mark0077
23rd April 2009, 20:19
Well I think modern cpu's can handle alot more from yadif if it was to become more advanced. I mean yadif double framerate, rgb conversion in software, software resizing etc only using 4% cpu (core i7). Definitely room for improvement. I prefer to keep everything in software. Hate the quirks / problems / limits when using hardware decoding / de-interlacing.

Aktan
24th April 2009, 14:28
Well I think modern cpu's can handle alot more from yadif if it was to become more advanced. I mean yadif double framerate, rgb conversion in software, software resizing etc only using 4% cpu (core i7). Definitely room for improvement. I prefer to keep everything in software. Hate the quirks / problems / limits when using hardware decoding / de-interlacing.

I agree it be nice if YaDIF could be updated to be better but dang, you have an i7! Not all of us are that lucky! :p

mark0077
24th April 2009, 14:30
I agree it be nice if YaDIF could be updated to be better but dang, you have an i7! Not all of us are that lucky! :p

Even the i7 920 isn't ridiculously expensive. 2.66ghz -> 3.6ghz is possible with no voltage increase and worked fine with stock cooler. Unbelievable little chips. I started a thread regarding improving yadif and have talked to the guy that ported yadif to avisynth to see if he can port mcdeint to avisynth also, which "apparantly" together with yadif can give excellent de-interlacing compared to yadif alone but which "used to be" impossible in realtime ;).

mr.duck
24th April 2009, 16:42
This is all very interesting. I'm glad to have sparked off this much discussion on the topic.

But so far, what can we say is the best deinterlacers? Hardware... I'm suprised perople are recomending this method. I have a 8600 nvidia card with the latest drivers and I can't see any options for deinterlacing. The best deinterlacer has got to be software; despite the system requirements, it can be perfect because it's the brute force aproach. Even if you don't have a core i7, there is also CUDA (http://www.nvidia.co.uk/object/cuda_what_is_uk.html). Is it going to be possible to have a computer set up that can genuinely compete with premium quality DVD players?

I'm sure one day we will have an inteligent deinterlacer that can just do it's job without any user intervention. I hope on that day we have one that is open source as well.

Aktan
24th April 2009, 17:38
I have a 8600 nvidia card with the latest drivers and I can't see any options for deinterlacing.

You can check the capability of your video card using DXVA Checker available here: http://bluesky23.hp.infoseek.co.jp/dxvac/DXVAChecker_1.10.2.0.zip Your card sounds new enough to have some Video Acceleration.

mr.duck
25th April 2009, 23:11
My graphics card is new enough to have DXVA working fine and I've tested it. In nvidia control pannel the only real option related to video is "use inverse telecine".


Today I was watching the formula 1. Tried watching it with Arcsoft and it was making a right mess of the deinterlacing. Seems the arcsoft/cyberlink decoders are only excelent at deinterlacing films and other progressive source videos. I've been searching a lot on the net and I finally think I've found the most ideal deinterler! DScaler5 MPEG2 decoder http://sourceforge.net/project/downloading.php?groupname=deinterlace&filename=DScaler5008.exe&use_mirror=kent

It's great because it does bob or weave (or set it to auto). I've tested it with bob and its superb. Noticably better than YaDIF double framerate output. I'm going to do more testing but I just had to share this. Very highly recomended.

Aktan
26th April 2009, 14:56
Today I was watching the formula 1. Tried watching it with Arcsoft and it was making a right mess of the deinterlacing. Seems the arcsoft/cyberlink decoders are only excelent at deinterlacing films and other progressive source videos.

That's weird, are you sure DXVA is working fine? I have some really hard to deinterlace clips and my ATI card deinterelace them quite well.

nlnl
28th April 2009, 17:11
So is there any directshow filters combination that can do 480i60 (MPEG2) --> 480p24 (YV12 colorspace for MadVR :)) for film sourced stream?
And the same for PAL: 576i50 (MPEG2) --> 576p25 ?

Some hardware video processors, TVs and even BluRay players (Panasonic,Oppo) can do that conversion!

Leak
28th April 2009, 17:42
So is there any directshow filters combination that can do 480i60 (MPEG2) --> 480p24 (YV12 colorspace for MadVR :)) for film sourced stream?

ffdshow and AviSynth - bob the video and do a ChangeFPS or ConvertFPS to the desired output rate. Or use some motion compensation to get the bobbed video to 120Hz and return every 5th frame.

And the same for PAL: 576i50 (MPEG2) --> 576p25 ?
Simply deinterlace the video with ffdshow without rate doubling.

np: Lackluster - Jokatkadfs (Proof Of Concept)

nlnl
28th April 2009, 17:57
ffdshow and AviSynth - bob the video and do a ChangeFPS or ConvertFPS to the desired output rate. Or use some motion compensation to get the bobbed video to 120Hz and return every 5th frame.

np: Lackluster - Jokatkadfs (Proof Of Concept)

Does your scheme remove 3:2 pulldown (480i60 film sourced)?

roozhou
28th April 2009, 18:15
ffdshow and AviSynth - bob the video and do a ChangeFPS or ConvertFPS to the desired output rate. Or use some motion compensation to get the bobbed video to 120Hz and return every 5th frame.


Simply deinterlace the video with ffdshow without rate doubling.

np: Lackluster - Jokatkadfs (Proof Of Concept)

None of avisynth's high quality deinterlacer can do this in real time AFAIK.

Leak
28th April 2009, 21:30
Does your scheme remove 3:2 pulldown (480i60 film sourced)?
Gah... if you want to do inverse telecine why don't you say it outright?

ffdshow, AviSynth + TIVTC or Decimate plugin(s)

np: Yello - Get On (Motion Picture)