How to prepare HDV video for YouTube from Sony Vegas Pro

NOTE: This page describes my old method (from 2006) for rendering standard definition video for upload to YouTube. I now have a greatly improved workflow using the QTGMC deinterlacing script in AviSnth, and the x264 codec in MeGUI. However VirtualDub and Xvid are still great tools and the workflow presented here can still produce good quality standard definition video for upload.

YouTube is by far the most popular video sharing website. This tutorial explains my method for preparing high definition video such as HDV for posting on YouTube. You can see my results on my YouTube channel. I am using Sony Vegas Pro but much of this tutorial would also help you create YouTube videos from other NLEs like Premiere Pro or Canopus Edius.

YouTube always re-encodes your video on their servers to a Flash video file. Their priority is fast download speed rather than quality. My aim here is to give them a video file that has the very best chance of a reasonable quality conversion.

Tools Required

  • Sony Vegas - Sony Vegas Pro 8.0b used at time of writing. Sony Vegas is an excellent NLE (non linear editor) for editing video.
  • Debugmode Frameserver - version 2.3 used at time of writing. Debugmode frameserver is a free application for transferring video from one application to another on demand without the need to render a large intermediate file. We will use this to transfer your video from Vegas to VirtualDub.
  • VirtualDub - version 1.7.8 used at time of writing. VirtualDub is a free application for capturing and processing video. We will use this for deinterlacing and resizing your video, and as a host for Xvid.
  • Xvid - version 1.1.3 used at time of writing. Xvid is a free video codec similar to DivX. Videos encoded with Xvid look similar to DivX videos and can be uploaded to YouTube.
  • LAME ACM MP3 Codec - version 3.97 used at time of writing. Lame is a free high quality MP3 encoder.
  • Smart Deinterlacer Filter - version 2.8 beta 1 used at time of writing. Smart Deinterlacer is a free filter for VirtualDub.

Downloading and Installation

Debugmode Frameserver Installation:

Download here. During installation be sure to tick "Sony Vegas Plugin".

Debugmode Frameserver installation for Sony Vegas

VirtualDub Installation:

The VirtualDub zip download for Windows does not contain an installer, it is simply the VirtualDub executable and other files. Unzip the contents to a folder such as c:\Program Files\VirtualDub-1.7.8\. To make accessing the program easy, right click on VirtualDub.exe and choose "Send to Desktop" and use that, or drag that shortcut into your Start menu.

Xvid Installation:

Make sure you get the Windows Installer of Xvid. I ticked the box to "Decode all supported FourCCs".

Xvid installation

Lame ACM MP3 Codec Installation:

The Lame site itself does not offer a Windows binary of Lame. I downloaded the LAME ACM MP3 Codec 3.97 final from Alternatively you can download it from

Unzip the contents, right click on "LameACM.inf" and choose "Install":

Lame MP3 ACM  MP3 encoder installation

More instructions here if you have trouble.

Smart Deinterlacer Filter Installation:

Download here. Unzip the file and place Smart.vdf and Smart.html in your VirtualDub plugins folder which is probably something like C:\Program Files\VirtualDub-1.7.8\plugins\

Rendering / Encoding

Sony Vegas

First of all, check your project properties in Sony Vegas. Debugmode Frameserver will use these settings when it transfers the video to VirtualDub.

In Vegas choose "File > Project Properties".

YouTube always encodes 30fps video, so even if you are shooting 50i video, you should choose a 60i template. Vegas will make a better job of increasing the framerate than YouTube's servers. But do not forget to set it back to 50i when you have finished! I even prefer to save a copy of the project specifically for the YouTube encode, to prevent problems in case I forget to switch the framerate back.

I am shooting HDV, so my project properties look like this:

Sony Vegas Pro Project Properties

Note there are only 2 differences from the Vegas Pro 8 defaults in the "HDV 1080-60i (1440x1080, 29.970 fps)" template. I have changed "Full-resolution rendering quality" from "good" to "best" and I have set the "Prerendered files folder" to "D:\Vegas-prerendered\" a new folder that I have made on a different drive from Vegas (C:\) and my video assets (.m2t files and .avi files which are on my E:\ drive). Actually the prerendered files folder is irrelevant to what we are doing now and you can leave it in the default location on C:\ drive if you don't have a separate drive.

Now set the properties on the "Audio" tab of Project Properties:

Sony Vegas Audio Properties

This will give YouTube less chance of screwing up your audio than if you choose 48,000 Hz (your HDV camera or your ripped DVD's sample rate).

When you are ready to render your finished masterpiece, choose "File > Render As".

File name: I always call it frameserver.avi and save it in my D:\ drive so I know where it is.

Save as type: Choose "DebugMode FrameServer (*.avi) from the drop-down list:

Sony Vegas render as Frameserver

If you only want to render a portion of your timeline then make a loop region and tick "Render loop region only".

Click "Save".

Debugmode Frameserver

When the Frameserver window pops up choose "RGB24" and tick "Write audio as PCM samples in signpost AVI". These settings have always worked well for me but if you want to read about the alternatives there is discussion on the Debugmode website including this thread and in this thread on the Sony Vegas Video forum.

Debugmode Frameserver

Choose "Next" and you should see this:

Debugmode Frameserver

There will now be a file called frameserver.avi on your drive, but it's only a small file known as a "signpost" file. The Frameserver is a very clever piece of software that feeds the data as it's required by the application receiving it. Instead of frameserving the data you could write the video to an intermediate file using a codec such as Cineform or Huffyuv or PICVideo M-JPEG, but then you will have an extra step, a big file to deal with, and a small loss of quality.


Now start VirtualDub from your shortcut and choose "File > Open". Find frameserver.avi (or whatever you called your signpost file) and open it. The first frame of your video will appear at full resolution in the video input pane.

The video will be stretched vertically. It's because VirtualDub is treating your HDV's rectangular (anamorphic) pixels as square, but don't worry about it.

If you have a large display you will also be able to see a video output pane on the right. At this stage we haven't applied any filters so both input and output will look identical and if there is movement in the video you will be able to see some "combing" effect from the interlacing.

Choose "Video" from the top menu and make sure "Full processing mode" is selected.

Deinterlacing in VirtualDub

If you don't know what interlacing is, read about it on Wikipedia or For YouTube we want progressive video, not interlaced, so if your input video is interlaced (e.g. 1080i50 HDV) then we need to deinterlace it. We could have deinterlaced it in Vegas by setting Field Order to "none (progressive scan)" in the Project Properties, but I prefer the methods we're using here in VirtualDub.

You will need to install the Smart Deinterlacer Filter as described above.

In VirtualDub choose Video > Filters... > Add... > smart deinterlace (2.8 beta 1) > OK

Feel free to experiment with the settings. Results of deinterlacing are very difficult to judge but personally I've had very nice results using all the default settings but selecting "Edge-directed interpolate":

Smart Deinterlacer

Resizing in VirtualDub:

  • In VirtualDub choose Video > Filters... > Add... > Resize > OK and choose the following settings:
  • Aspect Ratio "disabled"
  • New Size Absolute (pixels) 640 x 360
  • Filter mode: Lanczos3
  • Framing options: Letterbox/crop to size: 640 x 480

Resize Filter

If we don't letterbox the video, YouTube will do it for us with potential quality loss to the whole video, so I prefer to do it here.

You can click the "Show preview" box to see how you're video is going to look at this size.

Your 2 filters have now been added and you can click "OK".

VirtualDub Fliters

Video Compression with Xvid in VirtualDub:

Choose Video > Compression... > Xvid MPEG-4 Codec

VirtualDub video compression

Then click "Configure"

Next to "Quality preset" click "More..." and answer "Yes" to the prompt:

preset prompt

Choose "4 - Wide Search" for "VHQ mode" and set the "Maximum I-frame interval" to 250 if you are compressing 50i video. It should be about 10x the frame rate so leave it at 300 if you are compressing 60i video.

Xvid Motion settings

Click "OK" to return to the main Xvid Configuration window. Click "Target quantizer" to toggle to "Target bitrate (kbps)". I choose a bitrate of 2000 kbps which is probably overkill but we're trying to give YouTube the best chance of a nice conversion.

Xvid Configuration

If you wonder why not just render to DivX directly from Vegas without the Frameserver and VirtualDub steps, one main reason is because Vegas will not allow a high enough MP3 bitrate in a directly-rendered DivX file.

Now press "OK" until you get back to the main VirtualDub window.

Audio Compression:

Choose "Audio" from the top menu and make sure "Full processing mode" is selected.

Choose "Audio > Compression..." then select "Lame MP3" from the left pane.

From the right pane choose "44100 Hz, 128 kbps CBR, Stereo".

Lame Audio Compression

YouTube will probably turn this into a mono 64kbps MP3 audio stream so we're giving them plenty of overhead to do a reasonable conversion.

Save your VirtualDub configuration for next time by choosing "File > Save Processing Settings" and call it something descriptive like "YouTube-deinterlace-resize-640x480-Xvid-2000kbps-mp3-128kbps.vcf", then in the future you can just load it instead of setting everything again.

Now choose "File > Save as AVI..." and choose a folder and filename (NOT the same name as your signpost AVI) and process your video. The Frameserver will do its job in the background, passing video from Vegas to VirtualDub as it's required.

If your window is big enough, or if you rearrange the panes from the "View" menu, you can watch the video live in the output pane as it's processed. Here's how it looks across my dual 17" LCD monitors:

VirtualDub screenshot

If you have a number of videos to process at once you can tick the box "Don't run this job now; add it to job control so I can run it in batch mode" and then you can run them overnight or whatever by choosing "File > Job control..." later.

When your encode is finished, choose "Stop Serving" on the Frameserver window and "Close" the Vegas rendering progress window, then check your encoded file in your media player (Windows Media Player, VLC, DivX Player etc.).

You are now ready to upload the video to YouTube. The finished video is also a good format for uploading to other sites such as Myspace and Facebook.

Important: Don't forget to set your Vegas project properties back to 50i if you are working with 50i footage!

Sea Shepherd Conservation Society
Nick Hope