What You Need to Know About Video Encoding

These days we have the opportunity to make HD videos on our computer. It’s astonishing that we can even do that at all, let alone do so at such high quality. But video encoding has a lot of variables, and it’s sometimes difficult to know what to choose for high-quality, high-resolution videos that play easily on computers.

In this article we ask what are the ideal settings for making small, fast videos on the Macs

When you are encoding videos on your Mac you are sometimes presented with choices such as codecs, bitrates, frame rates, resolutions and so on. Most of these are self explanatory, but some are crucial to the quality and file size of your output.

What is the point of making a great video if it’s so huge it won’t play because it fills up the memory of the machine it’s playing on or if it’s so highly compressed that it looks like it was animated out of LEGOs?

Codec – This is the bit of software in your video program which encodes the video. Codecs have improved beyond recognition since the first Quicktime implementation, and one of the best codecs for small size, fast playing and high quality is H264.

Yes, there are higher quality codecs out there, but the most widely available in commercial software is probably H264. It’s an MPEG-4 or MP4 codec, making it compatible with most video-playing software and hardware media players that you would plug into your TV set.

Frame rates – This depends on your source video. If you shoot on a camera and load the footage into an editing system it will tell you the frame rate your camera captured the footage in. Cameras from former NTSC territories tend to be 30fps. and PAL countries are 25fps (FPS is frames per second), so it will be either 30fps (sometimes expressed as 29.97fps) or 25fps. Don’t change or mix frame rates because that causes problems.

Key frames – In amongst all the mushy compressed frames there are uncompressed frames or “key” frames to give the compression something to chew on and help give the impression of uncompressed sharp video. Go for about one a second, meaning for 25fps video every 25 frames, for 30fps video one every 30 frames, etc.

Aspect ratio or resolution – Set “1920 x 1080” for full HD and “1280 x 720” for regular HD. Standard definition formats are minefield, so avoid them where necessary (We may cover this at some point in the future, so let us know if you need this.). Aspect ratio should be the same as source, they should be 16:9, or 16 units wide by 9 high.

Bitrate – This is a tricky one. Uncompressed, untreated full frame HD video, is a HUGE amount of data and can’t play smoothly at 25-30fps on a computer. In order to make it play, you have to compress it. It’s like the difference between a TIFF image and JPG or PNG.

Basically you take all the “air” out of the file; any unnecessary areas when you could get away with a block of solid color rather than a subtle graduated tint saves you bits. The trade-off means the file size goes down, but then so does the quality.

Here’s a before picture,

mac-video-video-before

and here’s an after picture.

mac-video-video-after

1500-3000 is okay for smallish decent quality video, but as you see above, the quality will be noticeable on any area of smooth shading, and forget detailed film grain, snow or other particles. So go as high as you dare. For guidance, DVD bitrate is usually around 5000-10000, and Blu-Ray more in the region of 20000-30000.

Interlace – Don’t bother. Interlacing comes from a long time ago and has no place in this world of progressive uninterlaced video.

There are many reasons you might need to encode video. Perhaps you are running a full video editing suite like Lightworks, and you want to make a video which is YouTube friendly or just plays well from email.

The most recent version of Quicktime takes care of a lot of the heavy lifting, but it’s a good thing if you can to get ahold of a copy of the old Quicktime 7 and upgrade it to the Pro version, as that accepts a lot of different video formats and exports them with a lot of fine control.

A good thing to have is FFMPGX, which is for all types of video not just MPEG. It’s a Swiss Army knife tool which can take just about any video file you throw at it and make it into something useful. It asks a $15 shareware fee and is well worth it if you can afford it, but it still allows you to use it for free and isn’t too harsh about it.

It’s very easy to use; just drop the video you want to recode, and select the target format from the drop-down.

mac-video-ffmpegx

So to recap, choose H264, and use the same FPS as your source video and turn interlace off. If 1920 x 1080 makes big files or runs slowly on your machine, downgrade the size to 1280 x 720. This smaller HD size was good enough for the early HD feature films, so it’s good enough for you.

Set your bitrate for 1500, then encode and see what you get. If it’s small but horrible quality for the video you are encoding, set it to 3000 and retry. It will be bigger in size but a lot smoother. If it’s still not good quality, set the bitrate higher until you get the quality and size balance you are looking for.

For YouTube, you need to do the following (Quicktime 7 is used in this example):

  • Use H.264 codec. Set Quality to Best and encoding to Multipass.
  • Set key frames and data rates to Automatic, and uncheck “Frame Reordering.”
  • Set it to 1920 x 1080 or 1280 x 720 for HD video and set frame rate same as original video.
  • For audio, set compression to AAC: 48 KHz, 128 kbps, Constant Bit Rate (CBR) 16 bits, stereo.
  • De-interlace, of course, but do so not just because it’s old-fashioned but because it helps smooth out those fast motion bits if you do. You don’t want those nasty comb-like fringes on everything.
  • And finally, Prepare for Internet Streaming by setting to “Fast Start”.

Do it like that, and you shouldn’t get any warnings about your video quality. Okay, they might say they have detected your video to be shaky, but apart from any tools or add-ons, your video should encode for YouTube’s flash or HTML5 without problems.

If you have any video encoding tips, let us know in the comments below.

Photo Credit: Fake the Pressure by Phil South