Introduction

Interlacing-What is it?

This is interlacing: the jaggies: and this is the same file deinterlaced in Virtual Dub: and deinterlaced with AVISynth using QTGMC in basic mode: Interlaced video is video where a frame is made up of two fields. Each field is displayed with a very slight time delay but giving the impression of a single frame because the short time delay cannot be detected by the human eye/brain. Interlaced video was designed for early TV broadcasts and CRT TVs when the available bandwidth was low; sending a frame split into two fields reduced the bandwidth required. With the advent of more available broadcast bandwidth and modern, progressive computer displays, interlacing is no longer necessary. The vast majority of modern video, including phones, is Progressive, meaning there are no fields. Each frame is separate and different from the one before and the one after. An exception is DVDs, which use Interlaced video, which is decoded by the player to display properly on screens. The world of analogue video, however, is still interlaced. The output from VCRs and tape-based video cameras is all Interlaced. If not removed or processed correctly, this will result in jagged edges on moving objects unless the video is deinterlaced. This processing can be done at the player point; most software video players will have a deinterlacing function and modern TVs also have good inbuilt deinterlacers, but some applications such as YouTube operate in the Progressive domain and it is considered better to upload Progressive video.

Field Order

The order of fields in an interlaced frame can only be one of two: either Top Field First (TFF) or Bottom Field First (BFF). Generally speaking, analogue captures from VCRs and the like, using USB digitisers, are TFF. Digital Video (DV) transfers from Digital 8 or MiniDV camcorders using Firewire are generally BFF. Determining the field order helps various aspects of video restoration. On most occasions though, if you get the field order wrong in a setting, it will be obvious because any motion will be forward-backward eg two steps forward, one step backward, then two steps forward. You can determine the field order of an interlaced file by easily doing a double-frame-rate deinterlace. This can be done, as described below, in Virtual Dub with the Deinterlace filter and setting Yadif and Double Frame Rate Top Field First. Check the motion; if it is forward-backward, you have the wrong field order set; it will be BFF. To complicate matters, there are different types of interlacing, as described below.

Determining interlacing type

There are five common types of video files and they are all treated differently with respect to deinterlacing. So how do you work out which one your video is? Fortunately, this is easy to work out by stepping through the file, firstly frame by frame, to see if there are any interlacing artefacts (jaggies) visible in scenes with movement. The very nature of interlacing, where each field is from a different point in time, means that jagged edges will show whenever there is movement. In some videos, only some frames are interlaced (Pulldown). In other videos, even with movement, there are no jaggies (PSF and Progressive). This frame analysis must be done in a program that does not automatically deinterlace a file. Virtual Dub is good for this purpose. VLC Player is not, because it will deinterlace most files. To further examine a video, we can step through the video and observe each field by field (not frame by frame), and note the motion. This can be achieved with Virtual Dub using the Deinterlace filter and setting the frame rate to double. Set up the VDub Deinterlace filter like this: Click OK and OK to exit the filter dialogue and step through the video. The experts use AVISynth to analyse the structure of a video. Opening a file using the LWLibavVideoSource() filter will reveal the true state of the file’s interlacing. For example, I have seen a file where VDub shows it to be telecined with 4:1 pulldown, whereas AVISynth shows it’s true state of 3:2 pulldown. It’s worth noting however that the “fix” for each scenario is the same. so given that examining a file is easier in VDub, for normal analysis, it will be fine.

To Deinterlace… or Not

The $64,000 question has arguments for and against. I prefer to deinterlace my videos, which are predominately either camcorder recordings or captured analogue video from VCRs. Double-framerate deinterlacing of these types of of video means that the video’s motion is smoother because each field is converted into a frame and the motion is therefore spread out over double the number of frames (shot at 25fps, deinterlaced to 50fps). There is also no chance that a player will mess up the deinterlacing. I always deinterlace when uploading to YouTube or social media.

Interlacing Types and Processing

The following sections detail the various types of interlacing and what to do about them. Proceed down the page until you find the type that corresponds to your video. In this guide, “P” indicates a progressive frame, where no jaggies are present. “I” indicates an Interlaced frame, where jaggies are present. A sequence of numbers will be used to denote different frames. For example, 1234456788 indicates a pattern of 4 unique frames followed by one duplicate, then the cycle is repeated.

Full-Interlacing

Frame Pattern: IIIIIIIII with jaggies on every frame (where there’s movement). When the video is double-rate deinterlaced, each field is obviously different. Full-interlacing is found in almost all types of videotape, including from camcorders and captures from VHS and Beta tapes. Full-interlacing can also be found on DVDs and is sometimes broadcast over the air for TVs. In these cases, every frame is interlaced. When deinterlacing fully-interlaced video, it is best to deinterlace to double frame rate because the video will appear smoother; there will be effectively double the number of frames covering the same amount of motion after the deinterlacing process. This results in noticeable improvement in the smoothness of movement of video from camcorders and VCRs. The best method of deinterlacing this is to use QTGMC. Other options include VDub (as described above) and other programs such as Handbrake, which has a deinterlace function in the Filters tab. Examples of fully-interlaced files: aeroclub AVI jet AVI aircraft MPEG2

Full Interlacing-But Really Progressive!

Frame pattern: IIIIIIII with jaggies, but when double-rate deinterlaced, you get duplicated frames eg 11223344556677 (with very slight differences). This is very similar to Progressive Segmented Frame (PSF) mentioned below. What looks like a fully interlaced file can actually be progressive, would you believe it. To fix, the preference is to use AVISynth>TFM(), but practically, if you simply double-rate deinterlace it, the overall effect will be the same, except that you’ll have duplicates, which isn’t an issue because the frame rate has doubled. Example file of a Progressive file that looks interlaced: Progessive with interlace jaggies

Telecined Video

Telecine is the process of converting film (24fps) to video NTSC (29.97fps) or PAL (25fps) for broadcast over the TV networks. Telecined video should not be deinterlaced because only some frames are truly interlaced. Therefore, do not use QTGMC on telecined video until the video has been de/inverse telecined.

Three P frames followed by two “I” frames (3:2 Pulldown)

Frame pattern: PPPII PPPII PPPII A quirk of broadcasting film to NTSC TVs (over the air or from NTSC DVDs) is the need to change the framerate to 29.97. Because the film was originally shot at 24fps, a method called telecine is used to increase the frames per second (from 24fps ~23.976 to 29.97). This is done by mixing frames to create the extras required. The practical effect of this is that there is a mix of fully-frames and interlaced frames. One common technique is called 3:2 Pulldown and is described in detail here. In a nutshell, you get frames running like this: PPPIIPPPII, meaning 3 progressive frames (with no interlacing) then 2 interlaced frames, and the pattern repeats. This is shown in this image from Wiki: The pulldown effect, as you would see it in VDub, is shown nicely on this Netflix tech page here. To get the smoothest and crispest playback of the digital file after, for example, being captured from a VHS tape of the movie, one needs to “inverse/reverse/de” telecine the file back to it’s original 23.976 (close to 24) fps. The technique to do so is called IVTC, and can be done in Virtual Dub, AVISynth (via coding) and other programs. 24fps vs 23.976fps? 23.976 is easier to convert to and from 29.97, and is deemed to be so close to 24fps that nobody would notice. To de-telecine a 3:2 Pulldown video: VDub, set up the IVTC filter like this: This will remove the pulldown, clearing the interlacing at frames 3 and 4, and restore the video to the original (film) frame rate of 23.976. AVISynth, use the TIVTC filter: aud=ffaudiosource("file.mkv",track=-1) vid=ffvideosource("file.mkv", track=-1, seekmode=1,fpsnum=30000,fpsden=1001) audiodub(vid,aud) TFM() Tdecimate() Example of a 3:2 pulldown video: hunters

Three P frames followed by three “I” frames (3:3 Pulldown)

Frame pattern: PPPIII PPPIII PPPIII Solution see next

Four P frames followed by two “I” frames (4:2 Pulldown)

Frame pattern: PPPPII PPPPII PPPPII This indicates a PAL source converted to NTSC. Solution on this VH topic: https://forum.videohelp.com/threads/417016-Deinterlace-video-help#top

Two P frames followed by three “I” frames (2:3 Pulldown)

Frames pattern PPIII aud=ffaudiosource("VTS_01_1.mpg",track=-1) vid=ffvideosource("VTS_01_1.mpg", track=-1, seekmode=1,fpsnum=30000,fpsden=1001) audiodub(vid,aud) QTGMC(preset="fast") srestore(frate=23.976)

Every 5th frame is a Repeat: 4:1 Pulldown

Frame pattern 12344 56788 This can occur if a 3:2 pulldown video is deinterlaced or if the 3:2 pulldown flag in the file header is not read properly. A field pattern of 1234456788 results (one duplicated frame after each 4, that is, frame 5 is the same as frame 4), resulting in a slightly jerky video. PAL video that has been sped-up to 29.97 will show a repeated frame No 6. Options for removal of the 5th frame and restoration to the film frame rate of 23.976 include: AVIDemux in Copy Copy mode Virtual Dub’s IVTC filter, set up as for the 3:2 pulldown case above. In AVISynth, use the TIVTC filter (defaults to removing 1 repeating frame in 5): TFM() TDecimate() An example of a video displaying 4:1 pulldown is here: hunters-4-1 To revert 29.97fps to 25fps, modify the AVISynth code to: TFM() TDecimate(Cycle=6, CycleR=1)

Progressive Segmented Frame

Symptom: Frames have no jaggies, even with movement. When double-rate deinterlaced, the two fields are “basically” the same. This is another type of video that is broadcast and that you may encounter in recordings from tapes of TV programs or movies. In this case, the source is progressive but is split into fields so it can be handled as though it were interlaced. One field is made up of the even lines of frame. The other field is made up of the odd lines of the frame. This can be observed; when you try to deinterlace a PSF file, you will see very slight differences in each pair of fields, caused by the slight differences between the odd and even lines. There will, however, be no major difference between each field, even when there is movement in the video image. The field pattern is (basically) 1122334455. Wiki has a description of PSF here. A further explanation of PSF is here. Here are some examples of Progressive Segmented Frame videos: paris-psf mediafactory-psf guitar-psf (note jaggies on raw file but progressive movement when double-rate deinterlaced) No action is needed for PSF video. For all intents and purposes, it is True Progressive.

True Progressive

Symptom: Frames have no jaggies, even with movement. When double-rate deinterlaced, the fields (consecutive frames) are exactly the same. Each frame is unique and therefore different to the frames before and after. That is the indication you have a true progressive file. No action is necessary for Progressive video.

Burned-in Jaggies/Aliasing

After you have deinterlaced to double rate, if you still have jaggies on each field, they are probably burned-in by a previous, incorrect, deinterlacing process. This can be rectified to a certain extent by applying the following AVISynth script (thanks to PoisonDeathRay at VideoHelp): AVISource("burned-in_jaggies.avi") ConvertToYV16() Spline16Resize(400,300) santiagmod(3,3) QTGMC(inputtype=2) Spline64Resize(720,576) An alternative script from Jagabo: https://forum.videohelp.com/threads/416243-Fixing-Scaled-Interlaced-Commercial#top Example file-Burned-In Jaggies This file uses the UT Video codec. Check the multi-coloured wings of the aeroplane.

Introduction

Interlacing-What is it?

This is interlacing: the jaggies: and this is the same file deinterlaced in Virtual Dub: and deinterlaced with AVISynth using QTGMC in basic mode: Interlaced video is video where a frame is made up of two fields. Each field is displayed with a very slight time delay but giving the impression of a single frame because the short time delay cannot be detected by the human eye/brain. Interlaced video was designed for early TV broadcasts and CRT TVs when the available bandwidth was low; sending a frame split into two fields reduced the bandwidth required. With the advent of more available broadcast bandwidth and modern, progressive computer displays, interlacing is no longer necessary. The vast majority of modern video, including phones, is Progressive, meaning there are no fields. Each frame is separate and different from the one before and the one after. An exception is DVDs, which use Interlaced video, which is decoded by the player to display properly on screens. The world of analogue video, however, is still interlaced. The output from VCRs and tape-based video cameras is all Interlaced. If not removed or processed correctly, this will result in jagged edges on moving objects unless the video is deinterlaced. This processing can be done at the player point; most software video players will have a deinterlacing function and modern TVs also have good inbuilt deinterlacers, but some applications such as YouTube operate in the Progressive domain and it is considered better to upload Progressive video.

Field Order

The order of fields in an interlaced frame can only be one of two: either Top Field First (TFF) or Bottom Field First (BFF). Generally speaking, analogue captures from VCRs and the like, using USB digitisers, are TFF. Digital Video (DV) transfers from Digital 8 or MiniDV camcorders using Firewire are generally BFF. Determining the field order helps various aspects of video restoration. On most occasions though, if you get the field order wrong in a setting, it will be obvious because any motion will be forward-backward eg two steps forward, one step backward, then two steps forward. You can determine the field order of an interlaced file by easily doing a double-frame-rate deinterlace. This can be done, as described below, in Virtual Dub with the Deinterlace filter and setting Yadif and Double Frame Rate Top Field First. Check the motion; if it is forward-backward, you have the wrong field order set; it will be BFF. To complicate matters, there are different types of interlacing, as described below.

Determining interlacing type

There are five common types of video files and they are all treated differently with respect to deinterlacing. So how do you work out which one your video is? Fortunately, this is easy to work out by stepping through the file, firstly frame by frame, to see if there are any interlacing artefacts (jaggies) visible in scenes with movement. The very nature of interlacing, where each field is from a different point in time, means that jagged edges will show whenever there is movement. In some videos, only some frames are interlaced (Pulldown). In other videos, even with movement, there are no jaggies (PSF and Progressive). This frame analysis must be done in a program that does not automatically deinterlace a file. Virtual Dub is good for this purpose. VLC Player is not, because it will deinterlace most files. To further examine a video, we can step through the video and observe each field by field (not frame by frame), and note the motion. This can be achieved with Virtual Dub using the Deinterlace filter and setting the frame rate to double. Set up the VDub Deinterlace filter like this: Click OK and OK to exit the filter dialogue and step through the video. The experts use AVISynth to analyse the structure of a video. Opening a file using the LWLibavVideoSource() filter will reveal the true state of the file’s interlacing. For example, I have seen a file where VDub shows it to be telecined with 4:1 pulldown, whereas AVISynth shows it’s true state of 3:2 pulldown. It’s worth noting however that the “fix” for each scenario is the same. so given that examining a file is easier in VDub, for normal analysis, it will be fine.

To Deinterlace… or Not

The $64,000 question has arguments for and against. I prefer to deinterlace my videos, which are predominately either camcorder recordings or captured analogue video from VCRs. Double- framerate deinterlacing of these types of of video means that the video’s motion is smoother because each field is converted into a frame and the motion is therefore spread out over double the number of frames (shot at 25fps, deinterlaced to 50fps). There is also no chance that a player will mess up the deinterlacing. I always deinterlace when uploading to YouTube or social media.

Interlacing Types and Processing

The following sections detail the various types of interlacing and what to do about them. Proceed down the page until you find the type that corresponds to your video. In this guide, “P” indicates a progressive frame, where no jaggies are present. “I” indicates an Interlaced frame, where jaggies are present. A sequence of numbers will be used to denote different frames. For example, 1234456788 indicates a pattern of 4 unique frames followed by one duplicate, then the cycle is repeated.

Full-Interlacing

Frame Pattern: IIIIIIIII with jaggies on every frame (where there’s movement). When the video is double-rate deinterlaced, each field is obviously different. Full-interlacing is found in almost all types of videotape, including from camcorders and captures from VHS and Beta tapes. Full-interlacing can also be found on DVDs and is sometimes broadcast over the air for TVs. In these cases, every frame is interlaced. When deinterlacing fully-interlaced video, it is best to deinterlace to double frame rate because the video will appear smoother; there will be effectively double the number of frames covering the same amount of motion after the deinterlacing process. This results in noticeable improvement in the smoothness of movement of video from camcorders and VCRs. The best method of deinterlacing this is to use QTGMC. Other options include VDub (as described above) and other programs such as Handbrake, which has a deinterlace function in the Filters tab. Examples of fully-interlaced files: aeroclub AVI jet AVI aircraft MPEG2

Full Interlacing-But Really Progressive!

Frame pattern: IIIIIIII with jaggies, but when double- rate deinterlaced, you get duplicated frames eg 11223344556677 (with very slight differences). This is very similar to Progressive Segmented Frame (PSF) mentioned below. What looks like a fully interlaced file can actually be progressive, would you believe it. To fix, the preference is to use AVISynth>TFM(), but practically, if you simply double-rate deinterlace it, the overall effect will be the same, except that you’ll have duplicates, which isn’t an issue because the frame rate has doubled. Example file of a Progressive file that looks interlaced: Progessive with interlace jaggies

Telecined Video

Telecine is the process of converting film (24fps) to video NTSC (29.97fps) or PAL (25fps) for broadcast over the TV networks. Telecined video should not be deinterlaced because only some frames are truly interlaced. Therefore, do not use QTGMC on telecined video until the video has been de/inverse telecined.

Three P frames followed by two “I” frames

(3:2 Pulldown)

Frame pattern: PPPII PPPII PPPII A quirk of broadcasting film to NTSC TVs (over the air or from NTSC DVDs) is the need to change the framerate to 29.97. Because the film was originally shot at 24fps, a method called telecine is used to increase the frames per second (from 24fps ~23.976 to 29.97). This is done by mixing frames to create the extras required. The practical effect of this is that there is a mix of fully-frames and interlaced frames. One common technique is called 3:2 Pulldown and is described in detail here. In a nutshell, you get frames running like this: PPPIIPPPII, meaning 3 progressive frames (with no interlacing) then 2 interlaced frames, and the pattern repeats. This is shown in this image from Wiki: The pulldown effect, as you would see it in VDub, is shown nicely on this Netflix tech page here. To get the smoothest and crispest playback of the digital file after, for example, being captured from a VHS tape of the movie, one needs to “inverse/reverse/de” telecine the file back to it’s original 23.976 (close to 24) fps. The technique to do so is called IVTC, and can be done in Virtual Dub, AVISynth (via coding) and other programs. 24fps vs 23.976fps? 23.976 is easier to convert to and from 29.97, and is deemed to be so close to 24fps that nobody would notice. To de-telecine a 3:2 Pulldown video: VDub, set up the IVTC filter like this: This will remove the pulldown, clearing the interlacing at frames 3 and 4, and restore the video to the original (film) frame rate of 23.976. AVISynth, use the TIVTC filter: aud=ffaudiosource("file.mkv",track=-1) vid=ffvideosource("file.mkv", track=-1, seekmode=1,fpsnum=30000,fpsden=1001) audiodub(vid,aud) TFM() Tdecimate() Example of a 3:2 pulldown video: hunters

Three P frames followed by three “I” frames

(3:3 Pulldown)

Frame pattern: PPPIII PPPIII PPPIII Solution see next

Four P frames followed by two “I” frames (4:2

Pulldown)

Frame pattern: PPPPII PPPPII PPPPII This indicates a PAL source converted to NTSC. Solution on this VH topic: https://forum.videohelp.com/threads/417016- Deinterlace-video-help#top

Two P frames followed by three “I” frames

(2:3 Pulldown)

Frames pattern PPIII aud=ffaudiosource("VTS_01_1.mpg",track=-1) vid=ffvideosource("VTS_01_1.mpg", track=-1, seekmode=1,fpsnum=30000,fpsden=1001) audiodub(vid,aud) QTGMC(preset="fast") srestore(frate=23.976)

Every 5th frame is a Repeat: 4:1 Pulldown

Frame pattern 12344 56788 This can occur if a 3:2 pulldown video is deinterlaced or if the 3:2 pulldown flag in the file header is not read properly. A field pattern of 1234456788 results (one duplicated frame after each 4, that is, frame 5 is the same as frame 4), resulting in a slightly jerky video. PAL video that has been sped-up to 29.97 will show a repeated frame No 6. Options for removal of the 5th frame and restoration to the film frame rate of 23.976 include: AVIDemux in Copy Copy mode Virtual Dub’s IVTC filter, set up as for the 3:2 pulldown case above. In AVISynth, use the TIVTC filter (defaults to removing 1 repeating frame in 5): TFM() TDecimate() An example of a video displaying 4:1 pulldown is here: hunters-4-1 To revert 29.97fps to 25fps, modify the AVISynth code to: TFM() TDecimate(Cycle=6, CycleR=1)

Progressive Segmented Frame

Symptom: Frames have no jaggies, even with movement. When double-rate deinterlaced, the two fields are “basically” the same. This is another type of video that is broadcast and that you may encounter in recordings from tapes of TV programs or movies. In this case, the source is progressive but is split into fields so it can be handled as though it were interlaced. One field is made up of the even lines of frame. The other field is made up of the odd lines of the frame. This can be observed; when you try to deinterlace a PSF file,
Interlacing/The Jaggies
Interlacing/ The Jaggies