Log in

View Full Version : Need help with filter sequence and deinterlacing


madhatter300871
2nd October 2007, 14:40
Hi

I capture PAL TV at 768x576 using huffyuv 2.2.0. I then process using avisynth frameserved into virtualdub (set to fast recompress) and onto either DivX or Xvid (depending on what side of the bed I got out off!).

My filter chain is very simple, final file size is of no importance, I just aim for good quality captures to watch at a later date.

So, question number 1 :-
All PAL TV signals are interlaced, thats fundemental in how it works right ? However, I am finding that it doesnt necessarily follow that there are 50 different feilds per 1 second of video. Sometimes (often) 2 feilds are simply one progressive frame split into a bottom field and a top filed. This can easily be seen by seperating the fields in avisynth and slowly advancing through them in virtualdub. So my question is .... would any of you bother to deinterlace this type of footage ? If so, what do you do ? If not, should I be applying any type of deinterlacing -blending -bobbing- weaving filtering at all ?

Question 2 .......
I keep my filter chain very very simple.:-
ConvertToYV12 - Deinterlace (still experimenting with the different ones, and wether to bother) - Bilinear resize down to 720x576 (sometimes smaller) - some cropping and letterboxing if needed.
What is the preffered sequence for filters for the best looking result / fastest processing time (taking into account the required colourspace for certain filters off course). As a rule of thumb what comes first ? Colour conversion ? Deinterlacing ? Should I colorconvert on the interlaced signal setting interlaced=true ? Or deinterlace, treat is as progressive then color convert ? Also, if the footage is simply a progressive frame split into 2 fileds, do i just treat it as progressive set any filter interlaced= option to false ?

Hope this all makes sense and would appreciate how you guys do it.

I'll be honest, I'm getting some good results but confused as to whether Im putting my filters in the wrong order and whether I should be doing anything special with the "interlaced footage that is really just one frame split into 2 fields" situation.

Many many thanks in advance.

Chris.

yup
2nd October 2007, 21:02
Hi madhatter300871!
Where You want see video on computer or standalone player? If on computer interlaced video need transform to progressive at 50 fps using mvbob or mcbob script and after encode to Divx or XviD. Mvbob and Mcbob work only in YV12 colorspace. Before deinterlacing You can use denoiser in YUY2 colorspace.
Test and try.
yup.

Guest
2nd October 2007, 21:24
There's no need to deinterlace if the *content* is progressive. Your method for assessing the content using separatefields() is a good one. You might need to field match, if the fields that go together have become separated into different frames:

x A B C D // top fields
A B C D x // bottom fields

We call that a one-field phase shift. It is still progressive content but looks interlaced. You could use Telecide() or TFM() to correct it, but you wouldn't want to deinterlace it.

The rest of your post has too many questions in too general a context. When it comes to video there are very few rules of thumb. Present a specific case and give a sample of your source stream and script. We can comment on that for you.

DonQ
2nd October 2007, 21:29
(Sorry about my english, but) I can't exactly understand what you mean with "progressive frame, split into two fields" - does it mean that one field contains upper half of frame and next field lower half or it is just film-like frame with no movement between fields?

I assume the latter - this way you just don't need to worry about deinterlacing results (if progressive frames are relatively rare). Of course if you're capturing film source (only progressive frames), then you probably need different deinterlacer (you need to restore full frames anyway).

But if you some day want encode DVD (MPEG2), then you don't need deinterlace at all.

My usual filter chain for HuffYUV PAL captures (video part, final destination will be 25fps XVid) looks as next:
avisource("capture.avi")

# my capture card outputs video this way - some filter may need this info
assumetff()

# removes some dotting noise
undot()

# uncomment next for very noisy capture
#temporalsoften(2,4,6,12,2)

# deinterlacing part
# thresholds need tweaking depend on noise - use map=2 for debugging
tdeint(map=0, mthreshL=7, mthreshC=8, AP=50, tryWeave=false, denoise=true)

# uncomment next while tweaking deinterlacer settings
#orig=last

# noise removal
# comment first line and uncomment second one to tweak denoiser
peachsmoother(NoiseReduction=40, noiselevel=2.7, baseline=1.69, stability=25)
#peachsmoother(readout=true)

# uncomment next while tweaking denoiser settings
#orig=last

# this usually doesn't need any tweaking
msharpen(threshold=25, strength=40, highq=true)

# uncomment next while tweaking deinterlacer and/or denoiser settings
#orig

What about converting colorspace then I'd do this after deinterlacing and denoising (if possible), before final sharpening. Same about resizing.

All of the above is just my take for specific capture card (avermedia 503, philips saa7135 chip), cable provider and content (some studio-recorded shows on specific TV-channel).
There are numerous ways to achieve good results and like noted, everything depends on source material.

foxyshadis
2nd October 2007, 22:08
Field-shifted progressive is what you get if you take any standard progressive video and perform:

AssumeFieldBased().SeparateFields().DeleteFrame(0).Weave()

Of course deleting a field won't suddenly make it truly interlaced, but it'll look that way. A field-matcher is best for that (and if the pattern never changes, you can just use the above sequence again), a deinterlacer will be confused by the lack of motion every other field.

madhatter300871
3rd October 2007, 14:41
Thanks for the replies.

I have taken on board the following :-

a. A deinterlacer will get confused by the lack of motion in every other frame. Thanks, I'll definately not de-interlace this type of video.

b. In answer to DonQ, my video is indeed a film like frame with no movement between fields.

c. Also, progressive frames are more than rare... they are non existant. I'm only capturing PAL TV transmissions, which are 100 percent interlaced (even if the content is really progressive).

d. Maybe I should just never de-interlace and just create DVD MPEG2 in interlaced mode. Its food for thought I suppose.

e. In answer to Neuron2, I don't think the fields have become seperated into different frames but I'll double check. Starting from the very first field, the next field is always the same, just shifted by 1 line.

f. In answer to Yup, do I really need to increase to 50fps ? Will my final Xvid/DivX be a 50fps video ? Surely I can join every pair of fields together then that will be a 25fps progressive source ? Or just not deinterlace and treat is as progressive ?If not, will Xvid/DivX encoder automatically make it a 25fps video when it is finally processed ?

g. When i do have an interlaced source from the TV (the classic jaggies showing) and I de-interlace, do I have to increase that to 50fps ?

Final question.... If I just treat the video as progressive, will both fields be processed together and assumed to be progressive, or do I have to have in my script... assume field based ?

Sorry for the confusion on the frame rate, I've just always kept everything at 25fps.

Thanks for the answers so far, things are becoming a little clearer. To be honest, Im pretty clued up with Avisynth and video processing, I've been using it for a while, but I have really got myself quite confused lately with inerlaced sources and what the right thing to do is.

DonQ
3rd October 2007, 16:29
About 5-10 frames HuffYUV sample (without audio, but with motion) would be ideal to answer most your questions :)