Deinterlace Help
Contents |
[edit] Deinterlacing Video - Basic HOWTO
Many of the videos in the archive are provided in an interlaced form.
This basically means that each frame of the video actually contains two separate pictures.
When interlaced video is viewed, rapidly moving features can look very blurred with odd ghosting and dithering effects.
This is not a problem with the video. It simply means that your video player is not deinterlacing the video for you.
Example Interlaced Video Frame
The videos are provided in the same form as they were received within the FOIA release. The only process applied is conversion from the original compression format to H.264. As many of the original videos were in effectively raw formats, this has reduced the size of the archive from an unwieldy 942Gb to less than 100Gb, whilst being as transparent as possible.
Retaining the original interlace state of each video allows you the choice of how to handle the video data. Any additional processing before release would deny you this opportunity. If we had deinterlaced the video, you would not have the option of choosing how to, or whether to, deinterlace it yourself. This may imply a little more effort on your part to get each video into the form you require, but the more important factor is that the data is provided to you as transparently as possible.
A guide to interlaced video can be found here: http://www.100fps.com/
Please read the guide for a good introduction to interlaced/deinterlaced video.
This HOWTO is intended to help you treat video files for the best possible viewing quality, depending upon your purpose.
It's not intended to provide full in-depth explanation, but simply enable you to get the job done well.
The different types of purpose covered are:
[edit] Required Video Processing Tools
Although the principles involved apply to all video editing packages, details in this HOWTO are presented using VirtualDUB, as it is free, easy to use and does exactly what it says on the tin.
VirtualDUB and Required Filters
To keep things simple, VirtualDUB and required additional filters have been set up and packaged in the following zip file:
(insert archive)
Simply unzip it to your desired location. No installation is required.
If you are an existing VirtualDUB user, you will need the following filters. They should be unzipped into the Plugins32 folder to ensure they are loaded when VirtualDUB starts:
Deinterlace Area Based - http://www.infognition.com/cgi/getfilter?id=71
Deinterlace Smooth - http://www.infognition.com/cgi/getfilter?id=73
Canvas Size - http://www.infognition.com/cgi/getfilter?id=160
Full filter list - http://www.infognition.com/VirtualDubFilters/detailed.html
VirtualDUB - http://virtualdub.sourceforge.net/
H.264 Codec Installation
The original FOIA release video files have been compressed using the video codec H.264 (HD).
To view and create H.264 encoded files within VirtualDUB, you will need to download and install the following codec:
(insert archive)
The provided H.264 codec is not current, as the latest version is awkward to configure for use with VirtualDUB.
If you wish to use the latest version, it can be downloaded from:
http://sourceforge.net/projects/x264vfw/
Please be aware that you will have to change various codec settings to get it to work properly, which are beyond the scope of this quick HOWTO.
This may seem like a lot of messing around, especially if you can already double-click on the video files and view them, however the purpose is to allow you to, not only view, but to create H.264 format video files. Very few people already have the necessary files installed to encode video in this format.
[edit] Watching the video on your PC
All you'll really want to do, if the interlace effects are unwanted, is to deinterlace the video file.
If you have read the guide linked at the the top of this HOWTO, you will know that there are many ways to deinterlace.
We will simply show you how to apply a very good, freely available method, fit for the purpose - Area Based Deinterlacing.
Area Based deinterlacing retains the full height of each video frame, interpolates areas with interlace artefacts, and outputs video with the same framerate as the input video file.
Applying the Area Based Deinterlacing Filter
- Start VirtualDUB
- Load the video you want to deinterlace, or drag and drop it into VirtualDUB.
- Select Filters... from the Video menu.
- Click on Add, select deinterlace - area based and then click on OK.
- Make sure that Blend instead of interpolate is NOT ticked, and click on OK.
- Click on OK to accept these changes.
- The video is deinterlaced !
Sample Area Based Deinterlace Frame
If you now play the video, or scrub through it with the mouse-wheel, you should see the original video on the left, and the deinterlaced video on the right.
Remember to Save the Processed Video !
[edit] Uploading Video to YouTube
The procedure for preparing video for sites such as YouTube is the same as for viewing the video on your PC, but with the following additional considerations:
a) The most useful video format to upload to YouTube is H.264. They still recode your file, but a good H.264 quality file will remain so when viewed on YouTube. You can use an uncompressed RAW format for absolute maximum quality, but bear in mind your file size will be very large.
b) If you think people will want to download your video, it is best to ensure that your video is in one of the standard HD resolutions (1280*720 or 960*720). It is recommended that all uploads to YT are pre-processed to one of those resolutions. If the video is NOT in one of these formats, the video cannot be downloaded in H.264 format, but instead only a, frankly poor quality, mp4, flv or 3gp low resolution file, regardless of how good your original upload was.
Follow the steps above for viewing the video on your PC, then...
Rescale Video to 720p
- Select Filters... from the Video menu.
- Click on Add, select Resize and then click on OK.
- Enter 720 into the top-right text box (Absolute pixels - y). The other values will adjust automatically.
Enlarge the Canvas
- Select Filters... from the Video menu.
- Click on Add, select Canvas Size and then click on OK.
- Set New Width to 1280, and New Height to 720.
- Click on OK to accept the changes.
Remember to Save the Processed Video !
Tip - If you want users to be able to download your video in HD H.264 format, but don't want to rescale the video (so that you provide them with one-to-one pixel data, simply omit the resize step and retain the canvas enlargement step. Your video will have a large black border.
[edit] Analysing the video frame-by-frame
When analysing video at frame-level, maximum image quality is required, but in addition it can be important to ensure that each image you look at contains only one moment in time.
Two steps are suggested, and most users will need to apply both:
- Raw deinterlacing - Bob Double
- Progressive Deinterlacing - Bob-Weave (Smooth Deinterlacing)
These methods separate each input video frame into two separate images, resulting in the output video having double the framerate.
For example, a video with an input framerate of 29.97 fps is transformed into a video with a framerate of 59.94 fps.
The first step (bob double) results in half height video. The second step uses the half height video data to construct a full height progressive frame. In purist terms, the half height data is most 'correct, but usage of video data in that form is quite specialised and beyond the scope of theis brief HOWTO.
Due to complexities with retaining audio synch when doubling framerate, and that few video players display 59.94 fps video without skipping frames, it is highly recommended that audio is removed from files which are processed for the purpose of frame-by-frame analysis, and this guide will specify removal of audio as a required step.
This can be achieved by simply selecting No Audio from the Audio' menu within VirtualDUB.
Raw deinterlacing - Bob Double
- Start VirtualDUB
- Load the video, or drag and drop it into VirtualDUB
- Select Filters... from the Video menu.
- Click on Add, select bob doubler and then click on OK.
- You will be shown a configuration dialogue. Select none - alternate fields and click on OK.
Your output video will currently be half height but you will have twice as many frames.
Sample Bob Double Frame - Top Field
Sample Bob Double Frame - Bottom Field
It will also bob up and down on alternate frames. This is the correct behaviour. Full height frames will be restored by applying the subsequent steps.
Check the Field Order
If moving objects jump forwards and backwards when you scrub through the video (you will know what this means when you see it), you need to swap the field order.
As each video frame contains two images, each from a separate point in time, the order of these images is important.
There is no foolproof way of knowing which way round they are stored, so it is necessary to look for the problem manually, and if it's present simply swap the order of the images
To swap the field order...
- Select Filters... from the Video menu.
- Double-click on the bob doubler filter.
- Change the Field Order option to Top field first (or the other way around)
- Click on OK' to accept the change.
Progressive Deinterlacing - Bob-Weave (Smooth Deinterlacing)
First, apply the 'bob doubler filter and check the field order as shown above, then...
- Select Filters... from the Video menu.
- Click on Add, select deinterlace - smooth and then click on OK'.
- Click on OK to accept these changes.
Example Smooth Deinterlace Frame - Top Field
Example Smooth Deinterlace Frame - Bottom Field
Check the Field Order AGAIN
If the video bobs up and down a little, or you see mice teeth interlace artefacts when you scrub through the video, you need to swap the field order in the deinterlace - smooth filter options...
- Select Filters... from the Video menu.
- Double-click on deinterlace - smooth and then tick Alternate Field Order.
[edit] Saving the Processed Video
We are not quite finished yet, as the settings to write out an updated video file must be configured...
Configure Output Video Format
Details to output video in H.264 format are provided here, but you can of course choose to use any format you wish.
- Click on Compression... from the Video menu.
- Select x264vfw - H.264/MPEG-4 AVC codec and click on Configure'.
- Change the Ratefactor slider to choose the quality of the output file. The lower the Ratefactor, the higher the quality and the larger the output filesize. 10 to 20 is fine for most purposes, but to retain the best possible quality, set it to 1.
Configure Output Audio Format
VirtualDUB has many audio options, however, to retain the highest quality you should not modify the audio in the file at all.
For viewing or uploading - Ensure that Direct Stream Copy is selected in the Audio menu.
For frame-by-frame analysis - Ensure that No Audio is selected in the Audio menu.
Save the Deinterlaced Video
You are now ready to save the deinterlaced video file.
- Select Save as AVI... from the File menu.
- You cannot save over the top of your original file, and it is recommended that you simply add _DI to the existing filename to indicate Deinterlaced.
- Click on OK.
[edit] Job Done.
(Guide creation in progress. Full text will be in-place by the time the torrent goes live.)
Back to Release 14 - NIST Cumulus Video Database