Messageboard

You are not logged in.

#1 Sat 22nd Nov 03 05:10

Narler
Moderator
From: /t my PC..
Registered: Thu 1st Aug 02
Posts: 1,920
Website

What is Interlacing? Should I deinterlace?

iNTERLACiNG

Updated 3rd July 2oo4

There are many web pages about this topic, so I will only cover the basics.

Interlacing was used because it allows tv's to be cheaper and also reduces the bandwidth required by broadcasters by 50%.

Each frame of footage is divided into two fields (odd and even). They are called odd and even because of the type of lines they contain.  The Odd fields, contain scanlines of odd numbers, 1,3,5,7,9,11 etc, and Even fields contain scanlines of even numbers, 2,4,6,8,10,12 etc..You need both fields in order to make one frame.  This means that on one pass, one field is transmitted, then on the next pass, the next field is transmitted.  This means that to get for example 768 x 576 25 frames per second, you are actually receiving 768 x 288 50 fields per second.  (now this isn't exactly true because analog footage is not pixel based, but is scanline based, however for the example in this brief tutorial we will assume that you have captured interlaced analog footage and stored it in digital format (such as avi).).

SHOULD i CAPTURE NON-iNTERLACED

This certainly makes life a little easier, but there are a few downsides.  To capture non-interlaced, most tv-cards require that you capture only one field.  To ensure your tv-card is doing this is to set the frame size to no-more than 50% frame height.  (for example PAL B.G is 768 x 576, so this means any framesize where the height does NOT exceed 288 will be guarantee'd non interlaced, such as 384 x 288, 640 x 288, 768 x 288 etc).

ADVANTAGE · Guaranteed to be capturing non-interlaced
· Requires no real-time deinterlacing or post-processing deinterlacing
· Image looks sharp
DIS-ADVANTAGE · If you capture out of the correct aspect ratio (such as 768 x 288) then you can introduce resizing artefacts which turn straight lines into staircases. Looks terrible.
· You actually lose 50% of the motion detail.  As you lose transitional frames (these are frames which have fields from two different frames).  This can effect how smooth your footage looks.  The footage may look smooth but when comparing motion footage that was captured non-interlaced versus interlaced, the non-interlaced the footage may not look as fluid during motion sequences
· Prevents you from capturing all detail from the footageFor more information on resizing and the additional detail you can gain when comparing 384 x 288 versus 768 x 288 Check out THIS PAGE.


DE-iNTERLACiNG

There are many different approaches to de-interlacing, from simple field swapping, to BOB, Blending upto separating fields.  Each method uses a different approach and depending on your footage and what frame format you use, will determine which filter and settings works the best.

SHOULD i CAPTURE iNTERLACED

This certainly allows you to capture maximum frame detail and motion detail, but does require you to deinterlace.  Some cards and capture software have real-time filters, but I have found that there is no one deinterlacing filter that works well for ALL footage.  For example with my FTA broadcasts, each channel requires fine adjustments to deinterlacing filters for optimal use. I've even noticed differences between tv-shows on the Same channel. (such as a live sports broadcast, and a movie). Each piece of footage was recorded differently and therefore requires different settings (such as phase shift, field swap or the order in which these are done).  It is this reason why I strongly do not recommend real-time deinterlacing. 

From a quality point of view it's better to capture in a lossless format, and then deinterlace in post-processing so you can finetune whichever deinterlacing filter you select.  Also the Frame Format that you select plays a vital part in how you should deinterlace.  For more information on this Please refer to This Page.

ADVANTAGE · You will be retaining maximum frame detail and motion.
DIS-ADVANTAGE · Requires that you de-interlace, so it's not the best to capture direct to lossy codecs or deinterlace in real-timeFor some frame quality comparisons between capturing at different frame sizes Check out This Page.  For example: This covers quality comparisons between 768 x 288 versus 768 x 576 versus 384 x 288.

SHOULD i DE-iNTERLACED

If you intend to keep the footage on your PC and watch it there, then absolutely YES.

If you intend to watch the footage on your TV, then depending on the quality of your TV, the answer could be yes OR no.

If you intend to output back to VHS tape, then possibly no.

If you intend to make DVD's, then the answer could be yes OR no.

I myself deinterlace all footage that I capture from interlaced frame sizes.


DiFFERENT TYPES OF iNTERLACiNG

Each type of footage (source) that you use can yield different types of interlacing, Such as movies, Live Sports Broadcasts to DVD's.  I'll try and  briefly cover each type that I've come across and the best approach.

· Normal Field Separation
interlacing04.jpg
This is where both frames show slight differences. These differences change depending on the motion, but are still visible in static areas. The frame will be full of lines.

Easiest Solution Drop a field. You will lose some detail and possibly motion detail but after resizing it should look ok. AviSynth is good for separating fields and dropping one.

Best SolutionSecond best solution is to field swap (if necessary also Phase Shift) using Smart Deinterlace by Donald Graft and experiment with the motion Thresholds. You may also require a conditional filter, so you can apply a phase shift to only a certain frame range for example.

*Notes* This type of interlacing can also be corrected by using a Telecide filter.  The best Telecide filter I've used is by Donald Graft and is for Avisynth.  Works fantastic on this type of footage Thanks to scharfis_brain for this solution

If the footage is progressive scan, then the field association problems (which Field Swap and/or Phase shift can correct) are usually introduced by the method with which the show (footage) was edited. Not your editing, but the production company.  How they join footage from different cameras etc. 

· Field Variations
interlacing02.jpg
You can see the static areas of the frame show no interlacing artefacts, but the woman who is moving from left to right in the frame, shows massive artefacts.

This usually only ever occurs during motion areas of the frame, where both fields actually contain slightly different information, you will see their arm has like a double image effect (once again full of lines) (this is the hardest form of interlacing to correct without losing motion detail or frame quality , because you may have to do field only differencing, frame only differencing or field and frame differencing, or worse.. BLEND.. ug..

Easiest Solution Do Field only differencing.  This should then only attempt to interpolate (or blend, I prefer interpolate) those areas on the frame where interlacing is visible, leaving the rest of the frame untouched.  This will help retain all static detail, but may effect motion areas. You will have to play around with threshold values to find the best for your footage. Donald Graft has a Smart Deinterlace filter which is great for this.

2 Best Solution 01) Convert fields to frames and smooth.  This creates 50fps avi files, but it will allow you greater control over what threshold values you use because you can now target the transitions between the frames, whereas before you had to work within the boundaries of the same frame.

02) use DGBOB filter for AviSynth by Donald Graft.  This filter will allow you to make double frame rate or normal frame rate output files.

· Field Disorder
interlacing03.jpg
Here the whole frame is static, and you can clearly see interlacing artefacts over the whole sample image.

This is the easiest of all to correct, and is caused by the tv-card processing the wrong field first. The Fields temporal order is incorrect. As each field is captured at slightly different intervals it's important to know which field is *older* so it is displayed first as an object in the frame may have moved between one field and the next (this is temporal order).  For example the broadcaster maybe using Odd Field First, but your tv-card maybe set into using Even Field First.  This means the picture is very distorted, frame is full of lines.  However all you need to do is use a field swap filter, and bingo the image is perfect.

Easiest AND best Solution Run a Field Swap filter. Virtual dub comes with one built in.

· Field Dominance Reversal
interlacing03.jpg

This is very similar to Field Disorder, but instead of the fields being out of temporal order, they are out of Spatial order.  When the tv-card accepts images field by field it is important to know how the fields combine to make frames.  You have to identify which is top and bottom fields.  The top field may not necessarily be the *older* field.

Easiest AND Best Solution Donald Graft has a Field Dominance Reversal filter.

· Phase Shift
interlacing01.jpg

This is very commonly seen on PAL DVD's. Basically it means that the fields are associated incorrectly. So a phase shift by one converts b1t1-b2t2-b3t3 to xxb1-t1b2-t2b3-t3b4.  You lose the first field though.

Easiest AND best Solution Run a Phase Shift filter. Donald Graft's Smart Deinterlacer has Phase Shift abilities. Just disable Motion detection

· Blended Fields
interlacing-05.jpg
At first glance this picture on the left looks like normal interlacing, where both fields show unique motion.  However if you look at the two small images on the right you will see this is not the case.  The Top Right image is the top field for this frame, and the Bottom Right image is the bottom field for this frame.  Now if you have a close look at the top field, you will see something horrible.. There are two women being displayed on that image (like a ghost or shadow).  This is a BLENDED field.  A Blended field is one that has been generated by Telecine and is an utterly horrible process to undo. 

If you live in a PAL country, you may come across more and more footage like this.  The reason is production cameras usually capture at 24fps.  The footage is then Telecined to NTSC (30fps), and then unfortunately has been FieldBlendDecimation back to PAL (25fps).

These blended fields occur because the inverse Telecine method did not remove the generated fields from the 24fps - 30fps conversion. 6 frames have to be generated to reach 30fps.  So if the inverse Telecine method could just go along and remove those 6 frames and restore the footage back to 24fps everything would have been fine as 24fps playsback fine at 25fps. However most inverse telecine methods do not remove those 6 generated frames, so what you get left with is a miss-match piece of terrible footage where either the top or bottom frame is blended (The blend is where the previous field and the next field have been combined to make a new field and on scene changes it can be horrific !)

Easiest Solution Delete the footage and wait for a better copy to be re-broadcast.  You can't just drop a field, because the blends could occur in the top, bottom OR both top and bottom fields throughout the footage.

But if it is footage you wish to keep, then you have two choices.  From my testing; using Donald Graft's Smart Deinterlace filter will remove these blends if they are primarily used for the Top Field, or use Donald Graft's Telecine filter if the blends are primarily used on the Bottom Field. 

Alternatively encode to a smaller framesize to help mask these blends

Best Solution Scharfis Brain has put together a restore24 script for Avisynth which you can get HERE on Doom9. Warning this script requires some serious grunt and is very very slow, but it will convert your field blended 25fps avi back to progressive scan 24fps.

· Incorrect Fields in the Frame
interlacing-06.jpg
At first glance this picture looks like normal interlacing, where both fields show unique motion.  Now to a degree this is true, however even though each field shows unique motion it is because these fields have been associated to the wrong frame.  This actual capture contained progressive scan content.  It had no interlaced footage at all.  The reason this footage looks like interlacing was due to frame drops during capture. This has caused some fields to be lost:

So in effect what you see in the above image is actually this.

TimeLine 0--------------->
Frame Number  1   2   3   4
Top Field          1   2   3   4
Bottom Field     3   4   5   6

So Frame 1 has the top field from frame 1 but the bottom field from frame 3.  We need to correct this, so it looks like this:

TimeLine 0--------------->
Frame Number  1   2   3   4
Top Field          1    2   3   4
Bottom Field    ->  ->  3   4

It means the first two frames may look terrible, so if possible apply this filter on a black frame (like a fade in section of the show), or if necessary just add the required number of black frames to the start.

Now you may not always get this when dropping frames.  I did a few test captures, the first capture, I made it drop 237 frames (by using the pc while capturing, causing CPU usage to randomly peak at 100%), Yet viewing this footage there were no field problems, other than seeing motion areas turn into slide shows.  Yet on my next test capture, I only made it drop 4 frames, and the above picture was taken from that test capture.  In this capture the bottom field was actually from a frame, 2 frames in advance of the current frame.  So using Field Delay I was able to delay the bottom field by 2 frames, which returned the footage back to Progressive.

Easiest Solution Use Smart Deinterlace and select Field and Frame Differencing.  This will deinterlace the footage and remove any differences between the two fields.  This doesn't change the field order, and therefore doesn't require you to do any further examination of the footage, however deinterlacing will not yield the same results as fixing this problem.

Best Solution Analyse the footage to determine if this is a field based issue on progressive scan footage. So try using a Phase Shift first, as this can correct the problem if it spans over a single frame only (ie t1b2 t2b3), but if the range is further as demonstrated in this example, then try field delay, if you set it to top field, and the interlaced lines look worse, try setting it to bottom field, if it now looks better (but still not perfect), then add another instance of Field Delay and set it to bottom field aswell, now how does it look?.. This is what I did for this piece of footage, I used 2 instances of Field Delay, set to Bottom Field.  Which field you need to delay will depend on your footage, capture card and exactly when the field/frame drop occurred. 

If this field problem only occurs on a range of frames, then match this field delay with a Conditional Filter for Virtual dub, and you will easily be able to solve this problem.
NOTES

So before you rush in and use a BOB, or BLEND deinterlace filter, take a second to analyse what type of interlacing you have and then you will be able to identify what method of deinterlacing will be the most productive and produce the best results.

Something else worth thinking about : If during your capturing you drop lots of frames, this will make deinterlacing extremely difficult because, you maybe then combining fields from the wrong frames as you will *never* know which frames or fields you have lost




Finally There are two ways that broadcasters may use to distribute footage. They may infact be broadcasting each field indvidually (such as modern footage), or they maybe broadcasting true interlaced footage (which would be like transferring an old film (reel) footage to video.)

For some more indepth reading on video Please visit this site: http://bytesex.org/v4l/spec/index.html

SUMMARY

If you like capturing direct to lossy codecs, such as Div-X, XviD or MPEG, then I would suggest that you capture in non-interlaced frame sizes.

If you like capturing in lossless codecs such as MJPEG or Huffyuv, then you're obviously after higher quality captures, so capturing in larger framesizes which will be interlaced would be my recommendation.

The type of capture card that you have may also handle interlacing differently.  Also just because you're capturing a DVD for example, this is no guarantee of non-interlaced footage.  Quite a few DVD's are actually encoded interlaced.

For other information on interlacing and deinterlacing another site worth visiting is http://www.100fps.com/

FiLTERS, WHAT WORK & WHERE TO GET THEM

I've decided to add a list of filters that I've used and had success with:

Smart Deinterlacer By Donald Graft.  Requires Virtual Dub. Works very well. Has ability for field swap and phase shift aswell as field only differencing, frame only differencing and frame and field differencing. Very configurable and i've yet to find a piece of footage it couldn't cope with (other than the above mentioned inverse telecined footage which contains blended bottom fields. sad

DG Bob By Donald Graft. Requires AviSynth (version 2.5x). Works extremely well, allows you to create double frame rate files. I use this quite a bit for processing fast motion interlaced footage (such as motorsport).

Telecide (decomb) By Donald Graft. Requires AviSynth (version 2.5x).  Not really a deinterlacing filter (so it's not good on true interlaced footage), but works very well for Telcined progressive footage.

Kernel Deinterlace by Donald Graft. Requires AviSynth (version 2.5x).  Works well. Although I think I'd rather use the Virtual Dub Smart Deinterlacer instead.

Deinterlace Smooth By Gunnar Thalin. For Virtual Dub.  Works very well. Use Avisynth to separate fields to Frames, then this filter will restore the frames and generate double frame rate files.  Filter is quite slow, but does a good job.

Field Delay By Uwe Freese. Works great. Requires Virtual Dub.  If your capture is true Progressive, but you dropped some frames and now you have missmatched fields in the same frame, this will help you realign them to the correct frame.  Can save you having to deinterlace.

For more filters than you can poke a stick at Go Here.


Hope that helps
cya
[url=http://www.aussievideosearch.com/index.html]
sig2.gif
MORE CODEC AND CAPTURING HELP.[/url]

If you have any questions about how to process your captures, just post a message in the capture section of the forum and I will endeavour to help you analyse your footage to determine the best way to process it.

Offline

Board footer

Powered by FluxBB