We’ve had a lot of comments & questions on our blog post on how we encode video in preparation for uploading to Vimeo, which is the video sharing service we use. In this post, we’ll go more in-depth on what settings we chose & why, as well as a better way of getting the right codecs & settings up and running on your machine. This will probably work for other video sharing services as well, although we haven’t tested them.
Vimeo recommends encoding using H.264, which we do also, but we use the x264 encoder instead of Apple’s default encoder. We’ve found that videos that are encoded in H.264 using Quicktime sometimes have gamma problems or experience heavy banding. And who likes banding? As a side note, there are other ways of dealing with banding further up your pipeline – Nick Vegas over at Greyscalegorilla has a great post on this.
First of all: the hardware & software we are using. We use Macs and Compressor 4 as our encoding software – available on the Mac App Store – but our preset file will work fine for Compressor 3.5 (part of Final Cut Studio 7). If $50 for Compressor 4 is too much for you, you can still use Quicktime 7 Pro or any other encoding software of your choice that supports Quicktime and manually plug in the settings yourself. If you’re doing a lot of encoding, though, we’d strongly suggest picking up Compressor. If you have Compressor 3.5, then I’d strongly recommend setting up Qmaster to use all your machine’s processor cores. If you have Compressor 4, this is already set up for you.
If you’re using a PC, you should be able to install x264 on a PC and use Quicktime 7 Pro to encode on that platform. We do know, however, that Adobe Media Encoder doesn’t seem to work with x264 as of CS5.5. Hopefully this will change in the future!
Getting Ready & The Easy Way
Secondly, you need x264 on your system! Download x264 (scroll down a bit, it’s not the first one on the list), open the DMG, and copy the x264Encoder.component file to Macintosh HD/Library/Quicktime/ Be careful, though, not to copy this file to your user Library, which is located elsewhere at Macintosh HD/Users/YOURUSERNAME/Library/ otherwise it won’t work!
Now, if you are using Compressor, download this file, unzip, open it with Compressor, and drag&drop the presets into your Custom settings. Four presets, one of each standard frame rate – 29.97 & 23.976 (24p) per standard HD resolution – 720p & 1080p. Also included is a preset which should automatically set your output resolution and frame rate based on your source. Now you have them saved for the future and you can go ahead and use them!
Tweaking & Getting Dirty
So what if you want to encode 1080p? Use a different frame rate? Use different encoding software? Tweak it in other ways? Well, let’s get into it!
You’ll have two major dialogues you’ll have to set for your encode: 1) the Quicktime settings window, and 2) x264 preferences.
These screenshots are from Quicktime 7 Pro, but the options you encounter in other encoding software should be similar. Compressor has even more options, for a good overview of that check out the help files.
Set your Export drop-down menu to Movie to Quicktime Movie, since x264 is happiest in a Quicktime container. Hit Options.
Now, you’ll want click Size under Video to set your resolution. Compressor native will automatically set the resolution based off of your source. Make sure to set your resolution to a size that fits your footage’s aspect ratio – or, if you want to intentionally crop or letterbox your image, select one of the Preserve Aspect Ratio settings. Letterbox will fit your video within the size you set and put black bars around your video. Crop will cut off edges of your video to make it fit the resolution you set, and Fit Within Dimensions will automatically resize your output Dimensions to most closely match the Dimensions you input.
You’ll want to check Deinterlace Source Video if you have an interlaced source. Web/computer video is always progressive, and so you’ll want to output as that.
Usually the aspect ratio on all new cameras is 16×9, of which standard resolutions are 1280×720 (HD 720) and 1920×1080 (HD 1080). We find that, for most internet video, 720p is an excellent tradeoff between resolution and most people’s internet connection speed, as you’ll need to up the bitrate substantially for 1080p – more on that later.
Under Sound, click Settings. Use AAC and Stereo. Currently the highest Rate Vimeo supports is 44.1kHz, but other sites might supper 48kHz. Vimeo does, however, support a maximum bitrate of 320, so I’d recommend that. Set Quality to Best, as encoding audio doesn’t take much time at all – might as well do the best job you can do on this!
Now, back under Video, click Settings. This is where you get into the nitty-gritty of the video encoder. Set the Compression Type to x264 – if you have it installed in the correct location it will show up. Set your Frame Rate to match your source – if you want 23.976, which is HD 24p, you’ll have to set it to Custom and enter it manually. You can set your Key Frames to the same as your frame rate – a keyframe every second usually works well. Set Encoding to Best quality (Multi-pass).
Your Data Rate will depend on your resolution and the complexity of the subject. Increasing the bit rate will get you a better quality picture at the expense of file size, so this is something you’ll have to balance out for your particular need. For video or film, 2000kbits/sec works well for SD, 5000kbits/sec is recommended by Vimeo for 720p, and 10000kbits/sec for 1080p. We usually go 8000kbits/sec for 720p – I have a fast upload speed to upload bigger videos, and it’s a nice feeling knowing that you are giving Vimeo extra bits to work with 🙂
And here is where the real magic happens! Click Options at the bottom, and this will open the x264 compression settings.
There’s a lot of settings here, but don’t worry, there are presets included in x264 to get you up and running. Click Load Preset at the bottom left.
This will give you some tuning presets. x264 Tune will tune the encoder for different subjects – Film, Animation, Fast Decode, etc. x264 preset will set various settings that will either slow down or speed up the encode at the expense of encoding quality. We have fast machines so we select Slow, but you can try different speeds and find out what works best for you.
Usually you can skip the Values and Tagging panels – there may be some things in there you might want to adjust. Go to the Behaviour tab, and here you’ll select the same frame rate that you selected in Quicktime Options. Notice the information it provides you on how to achieve best quality. We always select “use 3rd pass” – it doesn’t seem to slow down the encode much compared to the Apple H.264 encoder, and results in a better encode.
And that’s it! Click OK to exit out of the dialogue boxes, hit Save, and it’ll render out your clip. Have fun, and feel free to ask questions!