CompressingH264

From B.Comm media wiki

Contents

Introduction

H.264 is the latest codec that forms a part of MPEG4. We are using it because:

  • It 'scales' from mobile phones through to DVD (so you only have to worry about one codec)
  • It works on video iPods
  • As we use QuickTime it is easy to compress to in all time based software on OS X
  • It is an open standard (which does not mean free, it is proprietary)

This introduction is divided into two parts, one describes video settings, the other audio settings.


This introduction assumes you have already got audiovisual content onto the computer. This might be in iMovie, QuickTime, GarageBand, Final Cut, whatever. At this point you need to export it. If the program does not support customised QuickTime settings export it uncompressed (but realise the file size is potentially enormous, for video we are talking gigabytes) and then open the resulting file in QuickTime Player.

NOTE: all of this assumes you are using QuickTime Player Pro.

So,

  1. open the content in QuickTime Player, and then choose FILE - EXPORT.... (Apple e is a short cut)
  2. Select the destination for the compressed work (this will be on the local computer, you can't usually compress it straight to your blog or internet account)
  3. From all of the drop down menu choices select Movie to QuickTime Movie
  4. click the Options button

In the resulting window you can customise settings for audio and video. If either is greyed out this means the original file does not have a video track, or a sound track. If it is not greyed out but not checked then you're not exporting that part of the file (sound track or video track).


Video Settings

In the resulting window select the Settings button under Video

  1. Select H.264 for compression type
  2. Frame rate should be a whole fraction of the original frame rate, (if 30 then make it 15, if 24 then 18, if 25 I'd try 15)
  3. Key Frames set to automatic
  4. Frame Reordering On
  5. Data rate set to whatever you want to try for, lower data rate equals smaller files, but less quality, a thumbnail is to try for around 2MB a minute (assuming video and audio).
  6. Optimised for Download
  7. You can ignore the quality slider
  8. Encoding is Best Quality (multipass)
  9. Once done, click Ok

Remember once this is compressed if the quality is too low, or too high, you can repeat this until you're happy.

The filer button in the settings window lets you apply real time filters to your video (film noise, black and white, and so on). Unless you want these effects, ignore this.

The size button lets you set the video output size, the maximum visual size for videoblogging is 320 x 240 pixels. If you want larger video than this you can, but don't embed it in your blog post, place a poster movie and targe the QuickTime player so that it plays in the player (or even a new browser window).

(The reason for this is that most content larger than this will completely break your blog visually.)


Audio Settings

In the resulting window click Settings... under Sound

  1. under Format select AAC (Advanced Audio Codec, this compresses to better quality and data rate than MP3)
  2. Under channels chose if you want stereo or mono. The choice is yours, if it is high quality audio work that is stereo and you want that preserved, then it would make sense to keep it stereo.
  3. For Rate select a sample rate. If it is voice and you want good quality, around 22Khz seems to work well, again experiment.

Advanced settings give you advanced options, they are pretty self explanatory and provide more control over what should be emphasised in the compression.

Dos and Don'ts

Never sample up. That means if your original is, say, 160 x 120 video don't compress it up to 320 x 240, the data isn't there it has to be invented and it will look appalling. Of course if you wanted to deliberately make it very pixellated, this would be a good strategy. Same applies to sound, if it is recorded at 22 Khz then exporting at 44 doesn't make the sound better.