Log in

View Full Version : Deinterlacing 1080i->540p frame_ratex2 vertical_size/2


Regie
17th May 2010, 22:56
This is the first time I ask something here. And I'm afraid this could be the most silly thing you've ever seen, but I've tried to discover how to do it and still no success, so here it goes.

I've got a 1080i@25fps HD video of an sport event that looks great, but I know 100% it is upscaled from SD. The fact is that I have also this video in SD, which is SD 576i@25fps.

I could cap the SD video, but a foreign broadcaster is upscaling it to HD, and I got the video as well. What I normally do with my SD videos is deinterlace them to 50fps, but it take a lot of time. Since I've got the HD version, I wanted to separate the fields, this way getting 540p@50fps, the problem obviously is that this way the video shakes because of the top and bottom fields being just separated. Is there a way to stop this flickering behaviour?

I hope I explained it clear enough.

Gser
17th May 2010, 22:58
Crop.
separatefields()
ev = selecteven()
od = selectodd()
interleave(ev,od).trim(1,0)

Gavino
17th May 2010, 23:33
Since I've got the HD version, I wanted to separate the fields, this way getting 540p@50fps, the problem obviously is that this way the video shakes because of the top and bottom fields being just separated. Is there a way to stop this flickering behaviour?
Not without bob-deinterlacing to half-height.
You might find a simple Bob(height=540) is good enough.
Otherwise you will need a higher quality deinterlacer, taking longer, which is what you are trying to avoid.

Gser's solution doesn't work as it simply reverses the field order.
As you probably realise, the real problem is that the fields have a relative offset of 1/2 a pixel between them, so resampling is required to bring them in line (which is what Bob() does).

Regie
17th May 2010, 23:56
Thanks Gavino, certainly I realized that there was 1/2 pixel offset while trying to do it myself. This was my last attempt:

Even=SeparateFields().SelectEven()
Odd=SeparateFields().SelectOdd().LanczosResize(1440,1080).Addborders(0,1,0,1).VerticalReduceBy2().Crop(0,0,0,-1)
Interleave(Even,Odd)

So I doubled the vertical size, then added a pixel to top and bottom, the halved vertical again and removed a pixel from bottom... so effectively what I did was adding 1/2 pixel offset. So I got it right, but when comparing the result with a simple deinterlacer I saw exactly what you are saying. It's much better and handles some other issues as well. So I will just do this:

Yadif(order=-1,mode=1)
Spline36Resize(960,540)

Easy, as it has to be. And my computer is able to process at real time. Thanks for your advise.