Video Compression for web casting

Substantial compression always reduces the quality of video.

DO NOT compress footage you want to edit.

Reducing the frame rate will not reduce the file size.

Reducing the resolution will not reduce the file size.

Get some web space - you tube videos look rubbish.

This tutorial will discuss briefly what compression is, a bit about codecs, why and how we need to use compression for web use.  I will concentrate on using the windows media video method and Vegas and show how to get the best from this codec and look at the results of using different levels of compression.  All suggestions as to what is 'best' are based on my own investigations and hints and tips from others.

It is important to remember different codecs are designed for different uses and that best results will be obtained by using the correct codec for the correct purpose.  Your DV camera produces video using the DV codec (unsurprisingly), this is often called a capture codec.  DV is not highly compressed and as a result it can be easily edited by a modest PC.  All your editing should be done on DV files, sometimes people are tempted to save disc space by further compressing their original footage and editing on that - don't do this, get more disc drives.  Editing compressed files will make your editor unresponsive, it may crash and the video quality of the project will be reduced,  substantially compressing a video file will always reduce the video quality.

The high bit rate, (25mbit/s), of DV may mean it is easy to edit and looks great but the size of the files makes it impractical to use it as a delivery codec.  Delivery / distribution codecs use complex maths to make the files much smaller to enable delivery across the internet or for authoring to DVD.  It is important to remember that compression works by throwing data away, the more compression the worse the quality of the result.  Depending on the application acceptable quality can be maintained at bit rates as low as 500kbit/s enabling streaming of videos in real time across broadband internet connections.  Video with lots of movement and action may need a higher bit rate to look acceptable.

Capture codecs - DV, HDV, digibeta, Hdcam.

Delivery / distribution codecs - Mpeg2 (dvd), wmv, QuickTime, divx, xvid, flash.

Fact - compressing a video file reduces quality.  More compression = smaller file = Worse quality.

The wmv codec is a very convenient method of screening your video using the internet.  Just about every computer that is able to connect to the internet will be able to stream your video from your web site without any fuss.  The bit rate you decide to use is dependant on two conflicting aims, the need to keep the quality high and the ease with which people can watch the video.  Higher bit rates give a better result but higher bit rates mean that to watch smoothly without pauses and buffering whilst playing people will need faster reliable connections.  Higher bit rates will also use more of the storage on your server and cost you more in bandwidth charges.

Here are some examples of the different levels of compression commonly used so you can decide what meets your needs best.  The clip is 12 sec long.

 
Bit Rate  (bit  /sec) Size Video Still
DV original, 25Mbit 46 Mb (10 meg clip)
2 Mbit 3.4 Mb
1 Mbit 1.7 Mb
512 Kbit / 0.5 Mbit 889 Kb
256 Kbit / 0.25 Mbit 500 Kb

Internet connections are rated in bits per second, file sizes are expressed in bytes.  8 bits make a byte.  A typical internet connection might be 1 mbit/s, one million bits per second; this is 125,000 bytes/sec or 125Kb/ sec.  1000 kb  = 1 Mb.

Notice how the smaller lower quality files play much more quickly and don't pause to buffer as the larger ones might do depending on the speed of your connection.  As a very rough guide 256 and 512 Kbit streams will play smoothly on 95% of connections 95% of the time, 1 Mbit will play on 80%, 2Mbit 50 to 60%.  The level of compression you chose will depend how you balance the conflicting needs of quality versus playing smoothness.  I tend to use 1Mbit for most things with 2 Mbit sometimes available as a high quality option for those with reliable connections. The lower bit rates are useful for small clips that you want to begin playing quickly, I use 256 Kbit for the video on the intro screen to my web site, www.zaskarfilms.com .

Now you have decided on the bit rate you are going to use it is time to see how to set the render up for best results.  All rendering is done with Vegas but the same settings should be used in other editors when rendering to .wmv.

Open the 'render as' window under 'file' and select .wmv as 'save as type', then select custom, best for rendering quality, click the video tab and select the following options....

 

 

Mode:  Bit rate VBR, this uses bits where they are most needed.

Image Size: Keep original size - lowering the resolution will not reduce the size of the file, only the quality.

Pixel aspect:  1.000 for NTSC, 1.0926 for PAL.

Frame rate:  Set the same as the project, increases render speed.  Lowering the fps will not reduce the file size.

Average bit rate:  Set your chosen bit rate here.

 

 

 

 

There are other codecs that can and are often used for web casting.  After much experimentation I currently suggest wmv is the best.  It is certainly the most portable and simple to embed in pages and it's quality is the equal of any other codec.  The only down side is long render times.

Vegas
More on codecs
More on compression
A tsunami of DV info
   
   
   
   
11/03/07        Mark Watson