Preparing & compressing digital video files by Dane Ramshaw & Matt Ottewill

This article provides some practical advice on preparing video files for web and multimedia projects. Note: To understand compression, codecs and why they are required, you may wish to read our article on Digital Video File Formats before reading this one.

Why optimise video files?

Because there are many different home audio visual replay systems (TV, computer, iPod etc) each with its own strengths and weakness, we have to be careful when preparing audio and video files to ensure the target system can handle them. For example, it's no good posting a 4Gb DVD quality movie on a web site, it will take too long to download. On the other hand, why put a 340 x 280 pixel video clip on a DVD disc when DVD players and TVs can handle full frame wide screen and hi-def pictures?

This process of preparation (or mastering) a file for delivery is often called optimising and usually involves 3 processes ...

  1. Choosing a Video codec and some related settings to compress the data rate of the pictures
  2. Choosing an Audio codec and some related settings to compress the data rate of the soundtrack
  3. Setting various other optimising parameters such as frame size and frame rate

Delivery systems that need optimised content

Web sites

If you are going to deliver a project as a web site you will need to consider ...

  • End-user network connection speed
  • File size
  • End-user playback software (codecs)

CD / DVD ROM

If you are going to deliver a project on an optical disc you will need to consider ...

  • Disc storage capacity
  • End-user maximum playback transfer rate from the disc (CD or DVD ROM speed)

All CD-ROMs have a maximum data size (capacity) of at least 650Mb. Audio CDs achieve a greater data size of 740Mb because unlike CDROM data discs they do not use up space with error correction data. For further reading view our Red book audio CD article. A 4x CD-ROM drive has a maximum transfer bandwidth of 600 Kilobytes per second. Providing you ensure your data rate is below this threshold, playback should be glitch free. Incidentally, don't assume that higher rated drive speeds will necessarily produce better data rates. The system often imposes a performance overhead so base your calculations on 4x speed drives.

 

Optimising applications

There are a variety of programs and processes available for optimising. Most fall into one of the following categories ...

Application type Examples Notes
Conversion utilities Miro Video Converter.com/ / Handbrake / MPEG Streamclip Often freeware and shareware
Video editing programmes Final Cut Pro / Adobe Premiere  
Browser extension/plug-in firefogg.org Extension for FireFox
Specialist commercial codec optimising Sorenson / Flash video encoder No longer widely used
Specialist (multi codec) optimising Cleaner No longer widely used
Desktop DVD authoring programs Encore / DVD Studio Pro  
System utilities QuickTime Pro / Windows Media Player  

 

Different settings in video & audio codecs

Audio and video codecs permit different controls in compression by adjusting various settings. Here are a few examples ...

Codec Available settings
MPEG-2 Wide range of compression settings to balance quality and file size
H.264 (MPEG-4) Range of compression setting from the very high quality/big file size to the very low quality/small file size
WebM Wide range of settings.
Ogg Theora Wide range of settings.
Sorenson 3 The compressor in QuickTime Pro allows quality, data rate, and keyframe duration to be determined. (There is a developer version which permits more control).
MPEG-3 audio Range of date rate compression settings and sample rate, bit depth, stereo or mono to be decided upon. Read more here.
DV codec Fixed settings for PAL and NTSC (4:3 and 16:9) which cannot be altered

 

Typical compression controls

The following are the settings you can alter when optimising your video/audio files ...

Settings Notes
Video codec
Codec choice MPEG-4, Sorenson, H.264 etc
Bit rate Fixed or variable
Spacial quality  
Frame size  
Frame rate 24, 25, 30fps etc
Aspect ratio 4:3, 16:9 etc
Key frame frequency Codecs work by examining a frame, deciding upon the best way to compress it, and then applying the compression to it all the following frames until the next key frame is reached. The frequency with which key frames occur is important in determining the effectiveness of compression. Too often and the file size will swell, to widely apart and picture quality will suffer. As a guideline ...

- High data-rate video use 1 keyframe per second for (eg frame rate = 15fps then keyframe frequency = every 15 frames)
- Low data-rate video use 5 keyframe's a second
- Many codecs use a keyframe every 5 to 10 seconds (eg frame rate = 15 then Keyframe frequency = every 150 frames
Audio codec
Choice of codec MP3, IMA 4:1 , Qualcomm, QDesign etc
Bit rate Fixed or variable
Bit depth variable or fixed (16-bit, 24-bit etc)
Sample rate 32KHz, 44.1KHz (CD), 48KHz etc
Channels Stereo or mono

 

Wizards

Because the process of choosing settings for optimising can be complex, many optimising applications offer presets or "Wizards" which you can use to compress/optimise your files ready for publishing to the web or disc.

Further reading

Preparing video for DVD

Preparing video for web sites & multimedia projects