Upload
others
View
11
Download
0
Embed Size (px)
Citation preview
page 1 of 18
www.take247.com – Movies worth watching. Free to upload, free to watch. The indie film network.
Compressing QuickTime Video for the Internet
June 12, 2007 - Perry Kroll - Technical Guide
Compressing video for the Internet is one of those things that everyone talks about and no
one knows how to do. More often than not, dabbling in this peculiar branch of nerd magic
results only in confusion and madness.
In this article, I will shed some light on the closely guarded secrets of do-it-yourself web
video compression — from deinterlacing to calculating a target bit rate and choosing a
compression codec.
You’ll need access to a high quality video file and a program capable of exporting to
QuickTime. Three options — QuickTime Pro (Mac/Win), Final Cut Pro’s Compressor
(Mac) and the industry standard Sorenson Squeeze (Mac/Win)—are discussed in detail,
and you should be able to follow the QuickTime Pro instructions in virtually any standard
video application.
One of the biggest points of confusion faced by the unsuspecting filmmaker is the myriad
of video compression codecs offered by QuickTime. Luckily, there are only two good
choices: Sorenson 3 and H.264.
Sorenson 3 is older and more widely compatible, while H.264 is modern, efficient (files
tend to be surprisingly small), slightly prettier than ordinary Sorenson 3, and less widely
supported. Only users with QuickTime 7 or later can view H.264 files. The professional
Sorenson Squeeze is still the best of all, and the best choice is often Sorenson 3, but if
you’re not worried about compatibility with older systems and you need that extra
compression edge, H.264 is your weapon.
page 2 of 18
OVERVIEW
This article is divided into four parts.
Deinterlacing (page 2)
(A critical but often overlooked step. Totally necessary for nice-looking footage.)
Compressing in QuickTime Pro (page 7)
(Simple and quick – read this section for important details even if you’re going to use a
different program! I discuss calculating bit rates and determining file dimensions here.)
Compressing in Final Cut Pro’s Compressor (page 12)
(Still very simple, but with an extra dose of awesome. Do this if you can.)
Compressing in Sorenson Squeeze (page 15)
(The industry standard, delivers beautiful Apple Trailer quality files. If you’ve got this
program, use it.)
Deinterlacing
Interlacing is the horrifying system used by ancient television engineers to transmit more
information through a limited bandwidth. While interlacing works just fine on a TV
screen, it tends to look dreadful when viewed on a computer, which is why you need to
deinterlace your files if they weren't created with a progressive camera.
As you probably know, the image is broken down into alternating rows of pixels. If your
video frame rate is 29.97 (which it usually is), then 59.94 images per second will flash
across the screen. Each image will contain only half of the picture: either the even rows or
the odd rows. The television screen draws one row, and then the other. This leads to all
kinds of nightmarish format conversion problems, makes ugly jaggies in the picture, and
causes flickering. Interlacing is bad.
page 3 of 18
Interlacing can sometimes be apparent in QuickTime Player. Look for a frame like this
one, where quick motion within the clip has revealed the interlacing lines.
To force the interlacing to show itself, you can set the view mode in Final Cut Pro to 100%
zoom and disable Show Square Pixels. Now find a fast video movement in your clip, and
look for horizontal lines. Camera pans are a dead give-away.
Progressive video (called things like 480P, 720P, 24P, etc.) is much better. It’s more like
film in the fact that one image is displayed, and then another. There’s no complicated
alternation of lines and no doubling of frame rates. It’s just a series of still images
refreshing very quickly, exactly the way our modern computer screens work.
If your original file came from a DV format (NTSC or PAL) or an HDV or HD format with
a description like 1080i, 60i or 29.97 fps, chances are: it’s interlaced. If it’s a progressive
format like 480P, 24P or 720P then you’re all set. Ignore this stage of the process and
allow yourself a short gloat.
page 4 of 18
If you’re like most of us, you need to deinterlace and rid yourself of those ugly alternating
rows.
A high-end compression package like Sorenson Squeeze of Final Cut’s Compressor will
usually offer to do this as part of the compression process, but it can sometimes be
beneficial to do it yourself anyway. If you have Compressor, it is very easy to do it there.
Deinterlacing can be done in any decent editing package. Instructions here are for Final
Cut Pro, with traditional DV-NTSC footage from a DV camcorder.
DEINTERLACING: STEP 1
Here, a simple project has been assembled. The clips are edited together in the timeline of
Sequence 1, and the movie is ready for deinterlacing and compression.
Make a new sequence (Apple+N). Edit the settings for the sequence by ctrl+clicking it in
the Browser and choosing Edit Settings.
page 5 of 18
You need the sequence settings to match the correct video preset for the footage you’re
working with. (In this case, DV-NTSC.) It will probably be set correctly by default, but if it
isn’t, just click the Load Sequence Preset button in the lower-left corner and choose the
correct preset.
(IMPORTANT: If you’re using a format like HDV or HD, you’ll need to make sure all the
settings are correct for your particular “flavor” of video. This can take some researching
online, but it’s important because every camera creates slightly different settings
depending on which options were chosen during shooting.)
DEINTERLACING: STEP 2
Before closing the Sequence Settings box,
we need to change the settings to do two
things: remove interlacing and alternating
fields, and change to a codec which will
allow this to happen.
Change the Field Dominance drop-down
menu to None.
page 6 of 18
Select Photo - JPEG in the Compressor menu. (If you’ve got an HD original and you’re
really, really picky about preserving video quality and have oodles of hard drive space,
choose Animation instead, because Photo - JPEG technically compresses the file just a
little bit.)
Click OK.
DEINTERLACING: STEP 3
Now, open your new sequence (Sequence 2), revealing an empty timeline. Select your
original sequence (Sequence 1) in the browser, and drag it into the timeline of the second
sequence. It will behave just like a video clip and appear as a single item, which contains
all of your cuts and edits in the timeline.
page 7 of 18
DEINTERLACING: STEP 4
Select the Sequence 1 clip on the timeline and go to Effects > Video Filters > Video > De-
Interlace. If you were at frame with motion, you’ll see those nasty lines vanish.
You’re all set! If you’re going to compress through Final Cut Pro’s Compressor, you don’t
need to export your video—just choose the new sequence when you export to Compressor.
If you’re compressing with Sorenson Squeeze or QuickTime Pro, or any other application
outside of Final Cut Pro, you need to export.
Choose File > Export > QuickTime Movie and then make sure Current Settings and Audio
and Video are selected. Save the file. This may take a while, as Final Cut Pro will have to
render the deinterlacing filter.
Compressing in QuickTime Pro
Compressing through QuickTime Pro is one of the simplest and most versatile methods,
although Sorenson Squeeze and Compressor can provide higher quality and more
sophisticated options. If you have either, you should use them; but still read this section,
as I will explain how to calculate bit rates and determine file dimensions.
page 8 of 18
QuickTime Pro is an electronic purchase ($29.99) which upgrades your copy of QuickTime
Player for Mac or Windows to QuickTime Pro, unlocking the extra features necessary to
export video.
If you have an editing program like Final Cut Pro, iMovie, Vegas, Avid, Adobe Premiere,
etc., the QuickTime export settings box will have the same options as QuickTime Pro, and
you can follow these steps there as well.
If your video needs deinterlacing, do it first.
QUICKTIME PRO: STEP 1
Open your video file in QuickTime Pro. Choose File > Export.
Select Movie to QuickTime Movie in the Export dropdown menu, and then click Options.
QUICKTIME PRO: STEP 2
The Movie Settings box will appear.
page 9 of 18
Under Video, click Settings.
Choose either Sorenson 3 or H.264 from the Compression Type drop-down menu at the
top of the box. Sorenson 3 is more compatible and slightly lower in quality than H.264,
which requires a brand new QuickTime 7 installation to play.
Choose Current for the Frame Rate.
For Keyframes select Automatic (go for an actual number if it seems like you’re getting
smearing in the final output at places where the compressor hasn’t noticed that a
significant change has occurred in the image from one moment to another).
Set Quality to the highest level. It might be locked at High with H.264 compression. This
is fine.
page 10 of 18
If you’re using H.264, leave Frame Reordering turned on and select Best quality (Multi-
pass), which makes the codec double-check its work and optimize wherever it can.
Stay in this box for the next step.
QUICKTIME PRO: STEP 3, CALCULATING YOUR DATA RATE
Now you need to select a data rate for kilobits per second, so break out the calculator or a
smart friend.
The quick formula is:
(target size in megabytes ! 8192) ⁄ length in seconds " 200 = desired kilobits per second
For the sake of morbid curiosity, I’ll walk you through the steps of the calculation.
Figure out how big you want the compressed file to be. For Take 24:7 the maximum size,
or target file size, is 100 megabytes. Multiply this number by 1024 to get kilobytes and
multiply again by 8 to get kilobits. A kilobit is an eighth of a kilobyte and is a common unit
of measure for data online.
In this case, you’re looking at the number 819200. Divide it by the length of your movie in
seconds. For this example, I’m going to say the movie is five minutes, or 300 seconds,
long.
Our new number is 2730.66. Subtract 200 to make up for the audio track, and other
miscellaneous errors that the compressor may have to deal with.
2530 kilobits per second is our answer for this scenario!
Plug that number into the Restrict To box under Data Rate. Turn on Streaming under
Optimize For if you have the choice.
Click OK to return to the previous screen.
page 11 of 18
QUICKTIME PRO: STEP 4, FILE DIMENSIONS
From the Movie Settings screen, click Size.
Choose Custom from the Dimensions menu.
Enter the file dimensions you’re aiming for. A table below shows three sizes for the most
common aspect ratios. Click OK to return to the previous screen
Take 24:7 Size Larger Extra-large
4:3 Standard 348 x 261 480 x 360 640 x 480
16:9 Widescreen (no bars) 348 x 196 480 x 270 640 x 360
QUICKTIME PRO: STEP 5
Under Sound click Settings.
page 12 of 18
Choose AAC under Format. Qualcomm PureVoice and QDesign Music 2 also work well, if
AAC isn’t available.
If you have stereo sound you’d like to preserve, choose Stereo (L R) for Channels.
Otherwise, Mono will do.
Rate should be 44.100 khz.
Quality is always nice at Better, and you can choose Best if you’re feeling elite.
Target Bit Rate is usually just fine at 160.
Remember, we’ve only left 200 kilobits per second to spare after calculating our video data
rate, and it’s a good idea to leave some left over after sound is used as well, for random
errors in the compression. If you want higher quality audio, you’ll need to subtract more
than 200 kilobits per second from the video rate.
Click OK to return to the previous screen.
QUICKTIME PRO: STEP 6
Make sure that Prepare for Internet Streaming is checked and Fast Start is chosen. If you
don’t do this, the movie will need to download entirely before it begins to play, and the
Take 24:7 staff will make you do it all over again.
You’re all done! Click OK and then save and wait while your movie compresses.
When it’s done, open it in QuickTime Player, make sure it looks good, and go to Window >
Show Movie Info. There, you can check to make sure the Data Size is lower than your
target size.
Compressing with Final Cut Pro’s Compressor
For the sake of brevity, I’m going to assume that you’ve read the guidelines above for
compressing with QuickTime Pro, which go into detail on the calculations and choices you
might need to make when compressing video. The same Video Settings and Sound
page 13 of 18
Settings screens will confront you here, and that section of the article will prepare you for
the scuffle.
FCP COMPRESSOR: STEP 1
Make sure the sequence you want to compress is open in Final Cut Pro and the timeline is
selected. Go to File > Export > Using Compressor.
Compressor will load and display four windows. Find the Batch window, and look for the
row with your project’s name in it.
Click on the menu under the Setting column where it says Click the pop-up.
Choose Web Streaming (QuickTime 7 compatible) > H.264 800Kbps Streaming.
We’ll adjust those settings in a moment, and it won’t necessarily have to be limited to
QuickTime 7.
page 14 of 18
FCP COMPRESSOR: STEP 2
The Inspector window will now offer you an
overview of your compression settings. Go to the
second tab, which is identified with a weird picture
of a film strip full of binary numbers.
Click Video Settings and you will find yourself inside
of the familiar old Video Settings box from
QuickTime Pro. The same rules apply, so jump back
to that part of the article (page 9) for the details.
Also, use the calculation rules from the same section
(page 10) to determine your data rate.
When you’re done, click Sound Settings and refer to
the earlier portion of the article (page 11) for the
details on how to set this box as well.
Streaming should be set to Fast Start.
FCP COMPRESSOR: STEP 3
Jump to the third tab of the Inspector window. This
one has a clock inside a film frame for its icon.
Set Frame Controls to Custom.
Resize Filter should be on Best.
Output Fields must be set to Progressive to
eliminate interlacing. Deinterlace won’t be
necessary if you’ve already done it, but if you
haven’t, set this to Best as well. Magic!
page 15 of 18
FCP COMPRESSOR: STEP 4
Click the second-to-last tab. The penultimate tab, if
you will. These are the Geometry settings, and this
is where you will choose the output dimensions.
Choose Custom for Frame Size.
Refer to the chart earlier in this article (page 11),
under QuickTime Pro compression, for common
sizes.
You can also set Constrain to the aspect ratio of
your film (likely either 4:3 or 16:9 for widescreen
without black bars) and then enter only one of the
dimensions. Compressor will calculate the other.
Take 24:7 has a maximum width of 348 pixels, so
you can start with that.
FCP COMPRESSOR: STEP 4
You’re all ready!
Click Submit in the Batch window, and watch as invisible demons guide your computer
through the complex chain of weird commands necessary to begin the compression
process.
Compressing in Sorenson Squeeze
At last! The holy grail of web compression! Sorenson Squeeze does something incredible,
called Variable Bit Rate Multi-pass encoding. What this means is that the file is encoded
once, using only as much information per frame as is necessary, and then the compression
engine goes back over it again, tidying up all the weird bits, so that the final result is darn
page 16 of 18
near perfect. It’s survival of the fittest for video, and your video turns into a hungry
python.
SORENSON SQUEEZE: STEP 1
Import your file into Sorenson Squeeze by dragging it into the large canvas area.
Find the QuickTime section in the list under Format & Compression Settings to the left.
Choose any of the presets contained within (Lg_prog works fine) and click Apply. We’re
going to be modifying everything, so it doesn’t matter which preset you choose.
Expand the triangle arrows under your movie’s title until you see the items MP3 and SV3
Pro or similar. Double click SV3 Pro.
page 17 of 18
SORENSON SQUEEZE: STEP 2
This magical box will appear. Don’t panic.
I’m going to walk you through every setting. You can copy most of them off of the
screenshot.
Stream Type: Streaming (Hinted)
You can check Constrain File Size if you want, and enter a maximum file size in kilobytes
(megabytes multiplied by 1024), or you can do the old calculation trick from the
QuickTime Pro section of this article (page 10), and use a data rate like usual. Your choice.
Under Audio:
Codec: Fraunhofer MP3. This sounds amazingly good.
Data Rate: 160 kbps.
Sample Size: 16
Sample Rate: 44100
Channels: Stereo, unless you don’t need it.
page 18 of 18
Under Video:
Codec: Sorenson Video 3 Pro (it’s that “Pro” part that makes this so beautiful.)
Method: Sorenson 2-Pass VBR (this is also important!)
Data Rate: you can either use the data-rate calculation techniques in the QuickTime Pro
compression guide above (page 10), or ignore this and enter a maximum file size in
kilobytes as described just before.
Frame Size: uncheck Maintain Aspect Ratio and use the chart in the QuickTime Pro
compression guide above (page 11) to calculate your video dimensions.
Frame Rate should be whatever your original file is. Most likely 29.97 or 24.
Bidirectional Frames: Allow
Minimum Quality: 100
Drop Frames to Maintain Data Rate should be checked.
Quick Compress should be turned off.
Auto Key Frame on Scene Change should be turned on and set to a number around 90-
100, depending on the frequency of cuts in your movie.
Image Smoothing and Streaming should be turned on. Leave the settings for streaming
(1425 bytes and 5.00 sec) at their defaults.
Phew! That’s it! Click OK.
From the main screen, click Squeeze It!
You’re done!
PERRY KROLL is a filmmaker, mac nerd and web designer working in New York City and
Boston. He is the Lead Developer for Take 24:7 (the indie film network) and one of the
founding partners at Top Right Corner, LLC.
www.perrykroll.com — www.take247.com — www.toprigtcorner.com