encoding recipes

55
Recipes show settings in Apple Compressor, Telestream Episode Pro and Sorenson Squeeze on Macintosh OS X. They are also applicable to QuickTime Player, ProCoder and other encoding software. SIMPLE ENCODING RECIPES FOR THE WEB MPEG-4 H.264 MPEG-4 (Simple Profile) Windows Media Flash 8 or 9 (On2 VP6) YouTube

Upload: anders-pedersen

Post on 22-Nov-2014

270 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Encoding Recipes

1

Recipes show sett ings in Apple Compressor, Telestream Episode Pro and Sorenson Squeeze on Macintosh OS X.

They are also appl icable to QuickTime Player, ProCoder and other encoding software.

SIMPLE ENCODINGRECIPES FOR THE WEB

MPEG-4 H.264

MPEG-4 (Simple Profile)

Windows Media

Flash 8 or 9 (On2 VP6)

YouTube

Page 2: Encoding Recipes

ForwardThese Recipes do not pretend to teach you about compression and encoding. Instead they are simple recipes that will get you great results with minimal effort, whether you use Compres-sor, Episode Pro or Sorenson Squeeze.

I’ve also included a section on encoding for YouTube (or other video sharing sites that encodes whatever is uploaded) which is a common area of confusion.

Another good source of Tips can be found each in the Pro Apps Hub where each weekday there are free productivity tips.

The Pro Apps Hub is a development of Intelligent Assistance.

Intelligent Assistance, Inc.

519 S. Victory Blvd

Burbank CA 91502

http://www.intelligentassistance.com

Copyright ©2007 Philip Hodgetts and Intelligent Assistance, Inc.

All rights reserved.

2

Page 3: Encoding Recipes

TABLE OF CONTENTS

Introduction 6The encoding triangle 6

Choosing a Format 7Flash 7 8

Flash 8 or 9 8

Real Video 8

Windows Media 9 9

MPEG-1 9

MPEG-2 9

MPEG-4 9

DivX 10

Analyze the audience 11

Encoding Techniques 12Work from the source 12

Preprocessing 12

Cropping 12

The rule of 8 13

De-interlace 13

Simple De-interlacing 14

Advanced De-interlace 15

Crush (Restore) the Blacks 15

Encoding Recipes 17

3

Page 4: Encoding Recipes

H.264 MPEG-4 17Gamma and Crop 19

Reduce the Data Rate 20

The Recipe for H.264 MPEG-4 in Compressor 2 21

The Recipe for H.264 MPEG-4 in Compressor 3 22

The Recipe for H.264 MPEG-4 in Episode Pro 23

The Recipe for H.264 MPEG-4 in Squeeze 26

MPEG-4 Simple Profile 28

Summary 29

The Recipe for MPEG-4 (Simple Profile) in Compressor 2 30

The Recipe for MPEG-4 (Simple Profile) in Episode Pro 32

Windows Media 34The Recipe for Windows Media 9 in Compressor 2 or 3 35

The Recipe for Windows Media 9 in Episode Pro 36

The Recipe for Windows Media 9 in Sorenson Squeeze 38

Flash 8 or 9 FLV 40The Recipe for Flash 8/9 in Compressor 42

The Recipe for Flash 8/9 in Sorenson Squeeze 45

Working with 16:9 Source 4716:9 Letterbox 47

16:9 Anamorphic or Square Pixels (HD) 47

16:9 Letterbox settings in Compressor 2 48

NTSC 48

PAL 48

16:9 Letterbox settings in Episode Pro 49

NTSC 49

PAL 49

16:9 Letterbox settings in Squeeze 50

4

Page 5: Encoding Recipes

NTSC 50

PAL 50

16:9 Anamorphic/Square Pixel (HD) settings in Compressor 51

16:9 Anamorphic/Square Pixel (HD) settings in Episode Pro 51

Encoding for YouTube, or other Video Sharing Site, for Maximum Quality 53

General Purpose Recipe - up to 6 minute videos 54

Calculating Data Rate 6 to 10 minute videos 55

5

Page 6: Encoding Recipes

INTRODUCTION

In the billing for this presentation at the Los Angeles Final Cut Pro User Group meeting, Head Cutter Michael Horton introduced the segment saying I would be telling the group:

“How to make great looking videos for the web that are small in file size and take no expertise to create.”

Unfortunately that was an exaggeration. Encoding, the term I prefer to use over “compres-sion,” is a skill set at least as complex as editing. Besides, if I did have the secret to great looking, low bandwidth encoding at a simple push of a button, I wouldn’t be writing it into a PDF to sell cheaply. If I had that secret, I’d be out there in the marketplace capitalizing on it. After all, the “World’s Greatest Compressionist” used to charge $3000 a day consulting until he went to work at Microsoft.

What this book will give you are some simple recipes to produce reasonable quality video without going into the techniques that a full time encoding professional would use to get great quality. For example, everyone loves the quality of the Movie Trailers at Apple’s web-site. To get that quality, Apple has an employee who works from the highest quality source files and spends days to optimize the encoding for each Trailer to do just a few a week. To achieve that he experiments, tests, tests and tests again with each test requiring a re-encode.

The encoding triangleAny time we encode video we trade off three values: Quality, File Size and Ease of encoding. Like most of these type of 3-sided trade-offs you get to pick two.

Small file size and high quality is not easy.

High quality and easy encoding means a large file size.

Small file size and easy encoding usu-ally means the quality will be compro-mised.

However the simple recipes provided here will give good quality at reason-able file size with simple settings.

6

Page 7: Encoding Recipes

CHOOSING A FORMATBefore we get to the specific so encoding, let's talk briefly about what formats are suitable for which purposes. The main contenders are:

Flash 7

Flash 8 or 9 - there's a big differ-ence between these and Flash 7

Real Video and audio

Windows Media 9

MPEG-1

MPEG-2

MPEG-4 Simple Profile

MPEG-4 H.264 and

DivX.

What have I missed?

If you responded “QuickTime” you’d be right.

QuickTime is missing from the list for a reason: as a distribution format, Apple is recommend-ing .mp4 because it is fully supported within QuickTime plus it is more widely compatible with non-Apple MPEG-4 players. QuickTime as a media architecture remains important to Apple: it powers iTunes, Apple TV and the iPhone’s audio/visual features but for web distribution the .mov format has been ignored. No new codecs (other than the MPEG-4 Simple Profile and H.264) have been developed for .mov since Sorenson Video 3, which is a very long time ago in codec development.

QuickTime is still essential for production and for building media applications on Macintosh and Windows, but for all intents and purposes Apple have decided that it makes more sense to build great support for the ISO standards, which are kind-of based on QuickTime anyway, in-stead of competing. So Apple have built support for .mp4 in their QuickTime Player and made it the most common .mp4 player.

If you're encoding for really, really old computers and feel you must use .mov then go for it, but you'll absolutely need the professional version of the Sorenson Video 3 encoder and that's going to cost you a couple of hundred dollars. Frankly I don't think it's worth it because MPEG-4 video is about the same quality and, while you could put it in a .mov container, I can't think why you'd want to use a proprietary format over an open ISO standard format.

So, back to the formats we might actually use.

7

Page 8: Encoding Recipes

Flash 7Flash 7 video support is bad, but it was better than the pseudo support in earlier versions of Flash. Flash 7 uses the Sorenson Spark codec, which is really a slight rehash of the decades old H.263 codec and, while it was an improvement on the video quality of earlier versions of flash - because video support was non-existent before Flash 7 - that's damning with faint praise. Before Flash 7, Flash only supported still image sequences.

Even though YouTube uses Flash 7, it requires a lot of bandwidth for mediocre quality and needs a proprietary encoder from Sorenson. Not a good choice, I'm voting it off the island.

Flash 8 or 9Flash 8/9, on the other hand, use the VP6 codec from On2 Technologies and is a viable con-tender. In fact it's the choice of Google Video and most video sharing sites. Flash is installed on most computers used for the Internet and, even if they need an update, it's a small one.

Flash 8/9 is a good choice for general distribution, but it does require a 3rd party encoding tool for best quality. You can purchase QuickTime export components for VP6 from On2.com, buy a version of Episode Pro with Flash 8/9 encoding from Telestream, or pay for the optional VP6 module for Sorenson Squeeze.

Flash 8/9 is a very viable choice for corporate or retail distribution, and is pretty much head-ing for dominant video format on the web.

Unfortunately it's not as easy to use as other formats because you not only have to encode the video but you've got to build or borrow a player and wrap the video in the player. The player gets embedded in the web page.

Real VideoOnce king of Internet video Real doesn't have much of a place any more. Real Net-works are more of a content company and their codecs and container format are mostly just for distributing their content.

Real is the only format where you have to pay for the server, another reason that makes it unsuitable.

Unless specifically requested, I don't see a role for Real anymore, so "off the island" with you.

8

Page 9: Encoding Recipes

Windows Media 9Another good choice for delivering to corporate America and, a little less so, to the general public.

If you want to use Digital Rights Management (DRM) you make the choice simple: Windows Media 9 is the only format that supports robust DRM.

As an aside, I have no idea why you would want to use DRM since it does not work and only devalues the content, but if you have some insane desire to make your project hard to work with, not play at all on the Mac, and of less value, then use Windows Media DRM.

Without DRM, WMV is still a great format but again you'll need to buy proprietary tools for en-coding on a Mac. You should at least have the free player-only version of Flip4Mac installed for playing Windows Media on your Mac.

MPEG-1Probably still the most ubiquitous format: every player will play MPEG-1 but it's an old codec and unless you're going to buy the Digigami MegaPEG Pro encoder, you're not going to get good quality with low bandwidth or ease. I think we can eliminate that from regular consideration.

MPEG-2MPEG-2 is the format for DVD, Digital Television and, for now, Digital Cable and Satellite, but it’s not a web format.

MPEG-4Two entries for MPEG-4 don't make it twice as good! Apple supports two variations on MPEG-4 and both use the .mp4 container.

Support for MPEG-4 was added to QuickTime at version 6.0.2 after some delay waiting for acceptable licensing conditions. QuickTime 6 supports MPEG-4 video at what is known at "Simple Profile" - up to 2 Mbit/sec.

You would use MPEG-4 like this if you need compatibility with QuickTime 6 era players or if the target audience was using quite old, slow computers. MPEG-4 simple profile requires a lot

9

Page 10: Encoding Recipes

less computing power to play than H.264. In fact Apple's Compressor presets for "QuickTime 6 Compatible" use MPEG-4 simple profile.

Other than that you'd create an MPEG-4 with H.264 video for higher quality at lower band-width.

H.264, just to confuse the issue, is technically MPEG-4 Part 10 - Advanced Video Codec, which is why it's sometimes known as AVC. H.264 is the name for it in the European ITU which shares the same standard. Nice thing about standards is there are so many of them!

H.264 scales really well so you can use the same codec from cell phones to digital cinema, which is unusual because most codecs are optimized for a small range of sizes, but H.264 is a great all-round codec.

MPEG-4 H.264 is what Apple expect you'll use, but as Apple so often is, one team gives great support while another team artificially cripples the software! Apple giveth, Apple taketh away. You have a lot more options for encoding H.264 from QuickTime Player Pro than in Compressor.

MP4 with H.264 video and AAC audio would be my choice for regular web video. It has one other big advantage. MPEG-4 both Simple Profile and H.264 are the only formats compatible with video iPods and Apple TV, so if that's your target the decision is easy.

DivXOne last common choice. DivX is an odd case: an MPEG-4 compliant video track with an MP3 audio track in an AVI container. DivX got its popularity with the "pirate video" community and that's probably where it's still the strongest. QuickTime Player will play most DivX files al-though, if they have VBR MP3 audio, it will be silent!

DivX is capable of very good results but is not really mainstream and I'd avoid it for client review or regular web video where it's not commonly seen. If you want to send out your project on Pirate Bay or other peer-to-peer network then DivX might be a good choice.

10

Page 11: Encoding Recipes

ANALYZE THE AUDIENCEBefore you decide on the format, it's really important to know the audience and target ac-cordingly. If you want your video seen by people at work in corporate environments, then Windows Media 9 or Flash would be the best choice.

Otherwise I'd tend to encode to MPEG-4 with H.264, or a .mov with H.264 if you want to use other QuickTime features like a chapter track.

But if you have the tools Flash 8 or 9 is fine as well.

If you want to deliver video for an iPod, then you should use the “Export for iPod” setting in QuickTime Player, or “H.264 for iPod” in Compressor 2.3 or later. In Episode Pro, choose one of the iPod-specific settings as a starting point. Encoding for iPod seems to require some “se-cret sauce.”

For Apple TV, use the “Export for Apple TV” setting in QuickTime Player Pro 7.1.5 or later. Presumably settings for Apple TV will be added to Compressor and Episode Pro in future re-leases.

11

Page 12: Encoding Recipes

ENCODING TECHNIQUES

Work from the sourceAlways work from the source - encoding already encoded video is not going to deliver good results because the encoding artifacts from the first encoder are going to be preserved by the second encoder while it introduces its own artifacts. So, always work from the source, pref-erably uncompressed video or at least the native format of the edit.

Never use a video that has been encoded to Sorenson Video, Cinepak or other distribution co-dec. DV and HDV are acceptable if they are the native format. Also acceptable, if no real master is available, is a “rip” from a DVD using MPEG Streamclip, DVDxDV or Cinematize.

PreprocessingA very large part of what a professional encoding specialist will do is in the pre-processing of the video before it’s encoded to make it easier for the encoding software to get the best pos-sible image.

Pre-processing is out of the scope of “Simple” recipes for encoding but it should not be over-looked as you develop skills in this area. The most bang-for-buck pre-processing is to:

Crop;

De-interlace; and

Crush the blacks in the image.

CroppingIn traditional video, at least 5% of the image from each side was never intended to be seen. This is the “Safe Action” zone and was an allowance for the part of a CRT that was hidden be-hind the cowling. Of course, in web video we see from edge to edge.

Since this part of the image was never intended to be seen, it rarely has anything essential to keep in so we can crop it away when we are encoding to a finished size smaller than 640 x 480.

NOTE: Do not crop when going to 640 x 480 because that would require the encod-ing engine to scale the image larger, and that would reduce quality.

Also note that we do not crop HD sizes before scaling because they are de-signed without significant overscan - HD displays are usually LCD or Plasma and (mostly) display the full raster.

12

Page 13: Encoding Recipes

Five percent of 720 pixels is 36 pixels.

Five percent of 480 pixels is 24 pixels.

Five percent of 486 pixels is 24.3 pix-els, so for both 480 and 486 (NTSC) we use 24 pixels.

In PAL territories, the same horizontal measure applies, but 5% of 576 pixels is 28.8 pixels. Given that we like whole numbers (in fact most cropping tools only allow whole numbers) you’d think can go with 28 or 29, but in practice only 28 is reason-able.

The rule of 8A good general rule of thumb is to make sure that any dimension we work with a codec is di-visible by 8. Exactly divisible by 8. Codecs work most efficiently when they are working in blocks of 8. If we were to throw in an odd number, like cropping 29 from top and bottom, the codec has to pad out to the next largest block of 8 pixels, even though most of the pixels in the block will be null.

On decode the codec has to eliminate the redundant parts before it displays, reducing the efficiency of the codec and making both encoding workstation and playback computer work harder.

Simple Rule: Always make sure both dimensions of your encoded video are divisible by 8.

We use the same rule here, so that the scaling will happen more linearly than if we did a dif-ferent crop value, keeping maximum resolution.

De-interlaceNTSC and PAL video are interlaced. Much HD source is interlaced as well. All interlaced source should be de-interlaced for web video because all computer screens are progressive. There-fore video for the web must be de-interlaced.

Fortunately, when we’re going to 320 x 240 we’re using only one field so it should be simple! Most of the time it is simple but...

You need to know the software you’re using and work out how it goes from interlaced 480/576 lines to 320 x 240 lines. I prefer to de-interlace first, then allow the software to scale the im-age.

If the encoded size will be larger than 240 pixels tall (NTSC source) or 384 pixels tall (PAL source) then more control of the de-interlace is required.

13

Page 14: Encoding Recipes

Simple De-inter lacingMost encoding tools have a de-interlace control. In Compressor 2.x the controls are in the Frame Con-trols area. In Episode Pro they’re in the Video settings area, under their own heading.

For web video and the size we’re recommending, 320 x 240, the sim-plest de-interlace is preferred because it is the fastest and because we’re not needing to see the results of two fields.

In Compressor match the settings above. In Episode Pro, match the settings below.

In Sorenson Squeeze 4.5 (or earlier) the De-interlace settings are in Filters. Create a new filter and choose any of the first three options.

In other software, use a De-interlace filter or other simple control.

If your source includes 3:2 pulldown with clean (i.e. continuous) cadence then remove the pull-down using the final two options. Simple de-

interlacing like this is really only suitable for sizes below 320 x 240 (one field height).

14

Page 15: Encoding Recipes

Advanced De-inter lace

Although the recipes we’re showing in this book are for 320 x 240 (mostly), if you do need to ever encode for 480 x 360 or other size between 640 x 480 and 320 x 240, then a more sophis-ticated de-interlace is desirable.

Episode Pro, using the settings below, will detect which parts of the image are movie and then de-interlace those parts of the image and interpolate (create new pixels between the values either side) only in the moving parts. This retains maximum quality but is much slower to encode.

In Compressor, the settings to the right will work well. For most encoding, use “Better” as highlighted. For the absolute best qual-ity use “Best” but be prepared for a long, slow encode because Compressor is track-ing where pixels are moving between the fields and interpolating new pixels.

In Sorenson Squeeze 4.5 there is no equivalent to these advanced de-interlace options.

Crush (Restore) the BlacksBlack is complicated in video. As the signal gets closer to black, it becomes noisy. Noise - a random dancing pattern - is a problem for encoding software because it does not know that noise is unimportant, so it devotes large amounts of the available data rate to preserve the noise. This is exactly what we do not want!

So we want to make all the near-black values into real black. To do this we use a tool called Black Restore in most encoding software.

15

Page 16: Encoding Recipes

In Compressor apply a BlackWhite Restore Filter and set it so the black is crushed down to one value, or as far as you can go without compro-mising the image.

In Episode Pro it’s simpler - set the Black level to its value from 0-255. Usually something in the 20-30 range will kill the noise in the very darkest parts of the im-age.

Finally, in Sorenson Squeeze, the setting is precalibrated to “5” with a smoothness of 10. These two figures combine to set the Black Restore. Five is the actual amount (cut off level) and the smoothness deter-mines how smoothly that will blend with the other values, bringing some additional lev-els down close to black.

This simple technique probably brings the greatest benefit to images that are dark or have dark areas, and still need to be encoded.

16

Page 17: Encoding Recipes

ENCODING RECIPESThese recipes are designed for most types of footage. They are not optimized for “easy” or “hard” to encode material. Source with lots of cuts, lots of camera moves and lots of action are more difficult to encode than talking heads.

For these tests I used two pieces of source material: a talking head of Ethan Markowitz dem-onstrating the Gorilla software at a Los Angeles Final Cut Pro meeting (Gorilla) and a short piece of mountain bike footage (Bikes). The Gorilla footage is relatively easy to encode.

H.264 MPEG-4These first examples will show the results using an H.264 codec in an MPEG-4 wrapper.

I’m going to show the original size stills. The actual movies are available online (from a link nearby) so you can see the movie in motion. The idea of the double-size version is so you can see the difference that each change is making.

I chose the iPod compatible settings in Compressor and Episode Pro so that there was that additional bonus. The other reason is that, as of Compressor 2.3, there are odd restrictions so that if

you choose .mp4 for output, we can’t use H.264. Bizarre, as that restriction doesn’t exist in Export with QuickTime Conversion from Final Cut Pro, nor export to MPEG-4 from QuickTime Player Pro.

In Compressor 2.3 or later, choose “H.264 for iPod” as the starting point in a custom setting. The default is 320 x 240 (the origi-nal iPod size) which is what we want to use here.

These are the default settings.

For comparison of the difference between the default of Multi-pass (the default, but slower) and single pass, see the next pages.

17

Page 18: Encoding Recipes

Figure 1: Single Pass “H.264 for iPod” at default settings as per those on page 15, except for the Option of Multi-pass being turned off.

If you ever wondered whether the extra time it takes for Multi-Pass encoding was worthwhile, compare with the next example.

To view this movie in a browser, click here.

Figure 2: Multi-pass H.264 at default settings as per those on page 15.

This example is smoother, less blocky and shows better detail.

To view this movie in a browser, click here.

In motion, it’s hard to tell the difference between the two examples.

18

Page 19: Encoding Recipes

Figure 3: With the Gorilla movie, there was no noticeable difference between the single and multi-pass. This is because this footage has fairly constant amount of action so allocating bits from parts with lower mo-tion to parts with higher mo-tion gives no payback.

To view this movie in a browser, click here.

Gamma and CropFigure 4: After applying the recommended gamma and crop settings, the Gorilla footage looks like this;

Some of the irrelevant edge content has been removed, and the image has better gray-scale values, noticeable around Ethan’s head.

To view this movie in a browser, click here.

19

Page 20: Encoding Recipes

Figure 5: The same frame of the Bikes movies with the recommended crop applied, and Gamma set to .9, with Multi-pass and the data rate at the default setting.

A bonus advantage for crop-ping here is that we’ve lost the excess blanking at the sides of the image, common in less expensive cameras.

To view this movie in a browser, click here.

Reduce the Data RateThat’s all good but the data rate is way too high for web video. Any video can look good at high data rates but what about at a data rate we really want to use for the web, like 300 Kbits/sec, not 600 Kbits/sec, which is Compressor’s default for this material?

Figure 6: The same frame, as Figure 5, with the same crop and Gamma setting (.9), but with the data rate restricted to 300 Kbit/sec for the video. (It actually averages 302 Kbits/sec for the video, which is close enough).

There is definitely a deterio-ration in the quality, but it’s very close, considering it’s half the data rate, and more than acceptable for most web video. Remember this is worst-case content with a moving camera and motion in the frame.

To view this movie in a browser, click here.

20

Page 21: Encoding Recipes

The Recipe for H.264 MPEG-4 in Compressor 2

21

Page 22: Encoding Recipes

The Recipe for H.264 MPEG-4 in Compressor 3

22

Page 23: Encoding Recipes

The Recipe for H.264 MPEG-4 in Episode ProIn Episode Pro start with the iPod_H264_320x240 preset (in the By Workflow > iPod Video group) if you want iPod compatibility, or mp4_H264_medium_dl (in the Templates > H264 > Download group). I’d recommend the iPod one as starting point because it’s closer to what we want.

23

Page 24: Encoding Recipes

24

Page 25: Encoding Recipes

The addition of a Contrast filter here is because the H.264 encoder in Episode Pro noticeably darkens the image and the Gamma filter seems to increase contrast instead of being a purely gamma filter. The combination of the Contrast and Gamma filter together give the same net result as the Gamma filter at 0.9 in Compressor.

25

Page 26: Encoding Recipes

The Recipe for H.264 MPEG-4 in Squeeze

26

Page 27: Encoding Recipes

Sorenson Squeeze 4.3, used in these tests on an Intel MacBook Pro, took approximately 4x the encode time of Compressor and Episode Pro. This may be because this version of Squeeze is PPC, which runs in Rosetta emulation on an Intel Mac.

27

Page 28: Encoding Recipes

MPEG-4 SIMPLE PROFILE If you ever wondered why we recommend H.264 for web video over the “original” MPEG-4 provided in QuickTime (technically MPEG-4 Part 2, Simple Profile), then compare Figure 6 with Figure 7. It’s amazing what a few years of codec development will do for you!

It should be noted that, while this is 2 pass, it is at a Constant Bit Rate - CBR - so bits were not allocated from one part of the movie to another where they are more needed. This is be-cause Compressor does not allow us to set 2 pass VBR with a fixed or target data rate. When High VBR was selected in Compressor the file size jumped from 452 KBytes for this short video, to 6.9 MB! That’s 15 times larger but it did look good, as you would expect. (Figure 8)

Figure 7: The same frame and settings as Figure 6, but using Simple Profile MPEG-4 (aka MPEG-4 in QuickTime). Settings were otherwise the same as were used for H.264 MPEG-4 in Figure 6.

To view this movie in a browser, click here.

Figure 8: Setting Compressor to High VBR gives a great looking file but one that is a lot larger than desirable.

As we said at the start, you can always get quality by increasing the data rate, but that makes the movie slow to download and uses more bandwidth.

To view this movie in a browser, click here.

28

Page 29: Encoding Recipes

Episode Pro does allow for a 2 Pass VBR with fixed target data rate as shown in Figure 9. As should be obvious comparing Figure 9 with Figure 7, two pass VBR, where bits are allocated from the easy-to-encode parts of the movie to the hard-to-encode parts of the movie, con-tributes significantly to improved quality.

Figure 9: MPEG-4 Simple Profile encoded with Episode Pro using 2 Pass VBR.

Although this is a big improve-ment on Compressor’s MPEG-4 Simple Profile encode, comparing it to Figure 6 (reproduced below for your convenience) shows that H.264 still has some significant quality advantages.

To view this movie in a browser, click here.

Figure 6: The same frame as Fig-ure 9 using H.264, everything else being equal.

To view this movie in a browser, click here.

SummaryWhile H.264 is clearly better quality, it requires QuickTime 7 or other MPEG-4 Part 10/AVC com-patible player. Older installations might only have QuickTme 6 and in that case MPEG-4 Simple Pro-file is preferable. However, if us-

ing this format, try to use Episode Pro for the encoding to maximize the quality by using 2 Pass VBR. Be sure to select Simple Profile for QuickTime 6 Compatibility. Simple Profile is the default in the MPEG-4 Templates in Episode Pro.

29

Page 30: Encoding Recipes

The Recipe for MPEG-4 (Simple Profile) in Compressor 2

30

Page 31: Encoding Recipes

The Recipe for MPEG-4 (Simple Profile) in Compressor 3

31

Page 32: Encoding Recipes

The Recipe for MPEG-4 (Simple Profile) in Episode Pro

32

Page 33: Encoding Recipes

You’ll notice the gamma is different for this setting compared with H.264 because the MPEG-4 Simple Profile codec does not encode as dark as Episode’s H.264 code.

33

Page 34: Encoding Recipes

WINDOWS MEDIAEncoding Windows Media is not natively supported on OS X but there are at least 3 solutions:

QuickTime Export Components from Flip4Mac that integrate in any QuickTime applica-tion including Compressor or Export with QuickTime Conversion from Final Cut Pro;

Episode Pro; and

Sorenson Squeeze Compression Suite.

At the time of writing there has been a long standing bug in the Flip4Mac Export Components affecting 2 Pass VBR encoding - it unfortunately shifts to green progressively over the encode, making the results unusable. Telestream, Flip4Mac’s parent company, are aware of the prob-lem and are working on a fix. This bug is specific to the Flip4Mac Export Components.

Figure 10: Export to WMV 9 from Compressor using the Flip4Mac Export Components and 1 Pass VBR.

To view this movie in a browser, click here. This file will play in QuickTime Player if the free Flip4Mac Windows Media Playback option is installed.

In these examples the difference between 1 Pass VBR and 2 Pass VBR is not as pronounced as the difference between CBR and 2 Pass VBR for MPEG-4.

Figure 11: Export to WMV 9 from Episode Pro with 2 Pass VBR.

To view this movie in a browser, click here. This file will play in QuickTime Player if the free Flip4Mac Windows Media Play-back option is installed.

34

Page 35: Encoding Recipes

The Recipe for Windows Media 9 in Compressor 2 or 3Using the Flip4Mac WMV Studio QuickTime Export Components. For QuickTime Components in Compressor, the important settings are usually hidden behind an “Options” button.

The Frame Controls (for de-interlacing) are inactive when en-coding to Windows Media with this configuration so we must use a De-interlace Filter.

35

Page 36: Encoding Recipes

The Recipe for Windows Media 9 in Episode Pro

36

Page 37: Encoding Recipes

37

Page 38: Encoding Recipes

The Recipe for Windows Media 9 in Sorenson SqueezeAs Sorenson license the Windows Media component from Telestream, the settings will be simi-lar to those in Episode Pro. Unfortunately our copy of Squeeze would not encode the test piece, indicating an error at every attempt, so we are unable to show the exact settings for gamma correction settings in Sorenson Squeeze. The image shown is our estimate of what should work. The Encode settings, being identical to Episode Pro, will be correct.

38

Page 39: Encoding Recipes

39

Page 40: Encoding Recipes

FLASH 8 OR 9 FLVFlash 8/9 uses the On2 VP6 Codec. This codec is a big step up from Flash 7 but it is still not as good as WMV, H.264 or MPEG-4.

Figure 12: FLV Encode from Sorenson Squeeze to On2 VP6 Flash Video using 2 Pass VBR. This is at the same 300 Kbits/sec, crop and gamma settings as for all the other encodes. This appears to be lower quality than the other for-mats.

Flash 8 or 9/VP6 encoding is an extra price option in Squeeze, hence the water-mark.

But here’s something very, very odd.

Figure 12A: This is the exact same file but embedded in a SWF player on the website. The quality is significantly better than when playing the FLV locally.

To view this movie in a browser, click here.

This quality is comparable with WMV or MPEG-4 H.264, as one would expect with the On2 VP6 codec.

IMPORTANT: On a Mac you cannot tell the final quality on the Internet, by viewing the FLV file.

40

Page 41: Encoding Recipes

Figure 13: FLV Encode from Episode Pro to On2 VP6 Flash Video using 2 Pass VBR. This is at the same 300 Kbits/sec, crop and gamma settings as for all the other encodes.

Similarly compare this image with the same frame once em-bedded in a SWF player and uploaded. The embedded ver-sion looks dramatically better.

To view this movie in a browser, click here.

The results from Compressor using the On2 VP6 FLV QuickTime Export Components are similar at this data rate.

41

Page 42: Encoding Recipes

The Recipe for Flash 8/9 in CompressorCompressor requires the optional cost QuickTime Components from On2 for VP6 to encode to Flash.

Figure 14: Increasing the data rate to an average “450” Kbit/sec in Compressor, using the On2 VP6 Ex-port Components resulted in an actual data rate of 475 Kbits/sec using 2 Pass VBR. .

42

Page 43: Encoding Recipes

The Recipe for Flash 8/9 in Episode ProTo encode to Flash in Episode Pro, you will need the appropriate version. Flash 8/9/VP6 is an optional cost item.

43

Page 44: Encoding Recipes

44

Page 45: Encoding Recipes

The Recipe for Flash 8/9 in Sorenson SqueezeTo encode to Flash in Squeeze, you will need the appropriate version. Flash 8/9/VP6 is an op-tional cost item.

45

Page 46: Encoding Recipes

46

Page 47: Encoding Recipes

WORKING WITH 16:9 SOURCEThere are two types of 16:9 source: Letterbox and full height/full frame.

With full height there are two types of source: square pixel, usually used for High Definition source, and anamorphic. All Standard Definition 16:9 is anamorphic. It has the same number of pixels as regular 4:3 but the pixels are stretched wider to fill the full screen. Both HD and SD Anamorphic are handled same way when encoding.

16:9 LetterboxThere is no point encoding black for the web. Although pure black takes relatively few bits to encode, why waste even one bit for irrelevant data? An iPod or Apple TV will automatically letterbox when playing back, and all other PC/Mac playback will show the full frame without black letterboxing.

So, for 16:9 Letterbox source we need to crop the black from the image and encode only the image component, telling our encoding tool that it should be displayed as 16:9.

Only the crop and size settings change. All other components to the recipe - data rate, gamma, etc. - are the same as for the other recipes in this book.

16:9 Anamorphic or Square Pixels (HD)When the source is full height Anamorphic or square pixels (HD) then we only need to use our standard crop settings (24 pixels off top and bottom, 36 pixels off both sides) and tell the en-coding tool that the output should be 16:9.

47

Page 48: Encoding Recipes

16:9 Letterbox settings in Compressor 2Before changing the crop settings you need to go to the Encoder settings and change the As-pect ratio setting to 16:9 (320 x 180). This is the 16:9 equivalent of 320 x 240 that keeps the aspect ratio correct.

NTSCAlthough technically there should be two settings, depending on whether your source is 720 x 480 or 720 x 486, in practice the small amount of “overscan” won’t make enough difference to warrant complicating the description. Cropping 60 pixels will take us to the edge of the image, then cropping an additional 20 pixels will remove the unnecessary material previously lost to overscan.

PALFor PAL, we need to keep the Left and Right crop the same, but take 72 pixels off the top and bottom of the image to get to the edge of the image, and then crop off the unnecessary ma-terial previously lost to overscan.

48

Page 49: Encoding Recipes

16:9 Letterbox settings in Episode Pro

NTSC

PAL

49

Page 50: Encoding Recipes

16:9 Letterbox settings in SqueezeIn the Encode settings set the size for the finished encode to these settings:

NTSCCrop settings are in the Filters area in Squeeze.

PALCrop settings are in the Filters area in Squeeze.

50

Page 51: Encoding Recipes

16:9 Anamorphic/Square Pixel (HD) settings in Compressor

16:9 Anamorphic/Square Pixel (HD) settings in Episode Pro

51

Page 52: Encoding Recipes

16:9 Anamorphic/Square Pixel (HD) settings in SqueezeThe crop settings are in the Filters area in Squeeze.

The size is set in the Compression Setting area in Squeeze

52

Page 53: Encoding Recipes

ENCODING FOR YOUTUBE, OR OTHER VIDEO SHARING SITE, FOR MAXIMUM QUALITY

What people tend to forget is that you are sending YouTube a master for them to compress, therefore send the highest quality you can, that fits with their limita-tions.

YouTube.com is well know for being the busiest video sharing site, but unfortunately YouTube uses the much older Sorenson Spark codec for their video encoding. This was the "improved" video format for Flash 7 but is based on the very old H.263 video conferencing codec. Even when new this was an old, inefficient codec.

Many people send YouTube an already compressed video, and are disappointed when they see the quality that results on YouTube. That's because most of the information was first thrown away by the encode before upload, so there was little quality left to be encoded to Flash 7.

The goal is to give YouTube a master that they can use for encoding.

YouTube have two limitations: no more than 10 minutes per video and no larger than 100MB per video.

YouTube converts everything that is uploaded to Flash 7 video at 320 x 240.

Remember the good old days of VHS distribution? You wouldn't give the duplicator a VHS copy of the show to duplicate. No, you'd give them the highest quality master you could. Therefore, to get the best quality from YouTube, give them a high quality "master" that is close to 99MB.

Use any application that exports to .mp4 with H.264 video, including QuickTime Player Pro; Final Cut Pro, Sony Vegas, et. al.

• Export as MPEG-4 with H.264 and set the size to 320 x 240. There is no point providing more resolution than YouTube's finished size. By going direct to that size means that you can devote bandwidth to making that master look great, instead of sending excess size that will be scaled down. Bonus is that you get to control de-interlacing and scaling.

From here on there are two choices: calculate the maximum data rate that will keep the file un-der 99 MB, or use some general purpose settings.

53

Page 54: Encoding Recipes

General Purpose Recipe - up to 6 minute videos

A simple way to ensure that the quality is there is to export to MPEG-4 with:

• H.264 video at 2000 Kbits/sec (2 Mbits/sec or 250 KBytes/sec)

• 320x240 video size (deinterlaced or simply use one field)

• Mono audio with AAC at 64 Kbit/sec (or 128 Kbits/sec for stereo)

• Recommended Sample Rate, and

• Best Encoding Quality.

• In the Video Options Main Profile should be checked on and Best Quality (Multi-pass) is advised for best quality.

These settings will be fine up to 800 Mbits aka 100 MBytes. At the proposed settings, any file shorter than 6 minutes and 15 seconds will be within YouTube's 100 MB per upload limit.

If your video is longer than that but still less than 10 minutes then you're going to have to do some math to work out the maximum data rate you can afford.

54

Page 55: Encoding Recipes

Calculating Data Rate 6 to 10 minute videosThis method requires you to know the duration of your video in seconds. If it's less than 375 seconds (6 minutes 15 seconds), use the General Purpose Recipe above, if it's more than 375 some calculation is required.

We have 800 Mbits to work with (100 MBytes x 8 bits-per-Byte).

• If we divide that by the number of seconds to be encoded we get our maximum bit rate per second.

• After deducting the 64 Kbits/sec for mono audio or 128 Kbits/sec for stereo audio, the remainder is the maximum data rate is the data rate for the video. Two pass will be important for this.

• Let's consider an example. The video is 8 minutes long - that's 480 seconds.

800,000 Kbits divided by 480 seconds gives us 1,667 Kbits/sec to keep within the 100 MB up-load limit.

Less 128 Kbits/sec for stereo audio (or use mono and subtract only 64 Kbits/sec) leaves 1,538 Kbits/sec for video.

So in the Data Rate set 1500 Kbits/sec instead of 2000.

If you want to see an example uploaded using this method, check out this video. This is a par-ticularly difficult source to encode - fast flashes, leaves, lots of motion and yet, the quality is very high compared to the quality with other YouTube videos.

55