Encoding Audio & Video for the Web Presented by William Haun

34
Encoding Audio & Video for the Web Presented by William Haun http://www.williamhaun.com/

Transcript of Encoding Audio & Video for the Web Presented by William Haun

Page 1: Encoding Audio & Video for the Web Presented by William Haun

Encoding Audio & Video for the Web

Presented by William Haunhttp://www.williamhaun.com/

Page 2: Encoding Audio & Video for the Web Presented by William Haun

Outline

• Understanding Bit Rates

• Tips for Encoding Audio

• Tips for Encoding Video

• Production and Post-Production Tips

2

Page 3: Encoding Audio & Video for the Web Presented by William Haun

Understanding Bit Rates

• What is Bit Rate?

• Recommended Bit Rates

• CBR vs. VBR

• One-pass vs. Two-pass

3

Page 4: Encoding Audio & Video for the Web Presented by William Haun

Understanding Bit Rates

What is Bit Rate (transfer rate)?

The number of bits transferred each secondUsually measured in kilobits per second (kbps)

Most encoders have you specify a bit rate for your file, then the rest of the settings affect the quality

Bit rate (kbps) ٭ length (sec) ÷ 8 ÷ 1024 = total size of file (MB)

Don’t forget that video files have a video bit rate & audio bit rate that combine to create the total bit rate.

4

Page 5: Encoding Audio & Video for the Web Presented by William Haun

Understanding Bit Rates

Recommended Bit Rates

Dial-UpProgressive Download: 56-110kbpsStreaming: 38kbps

DSLProgressive Download: 350-512kbpsStreaming: never over 350kbps

CableProgressive Download: 512kbps – 2mbpsStreaming: never over 512kbps

5

Page 6: Encoding Audio & Video for the Web Presented by William Haun

Understanding Bit Rates

Constant Bit Rate vs. Variable Bit Rate

- Constant Bit Rate (CBR) never fluctuates

- Variable Bit Rate (VBR) allocates more bits per second to the more complex parts of audio/video but keeps an overall average for the whole file

6

Page 7: Encoding Audio & Video for the Web Presented by William Haun

Understanding Bit Rates

Constant Bit Rate vs. Variable Bit Rate

- VBR should always be used with download & progressive download media

- VBR often can’t be used with real-time encoding

- VBR with streaming should only be used if a peak bit ratehas been set

7

Page 8: Encoding Audio & Video for the Web Presented by William Haun

Understanding Bit Rates

One-Pass vs. Two-Pass

Most encoding software lets you specify whether you want it to pass over the media file once or twice while encoding.

Two-pass takes longer to encode but provides a higher quality encoded file. It especially improves the quality of VBR encoded files.

Two-pass cannot be used with real-time encoding.

8

Page 9: Encoding Audio & Video for the Web Presented by William Haun

Tips for Encoding Audio

• Channels (Stereo vs. Mono)

• Sample Rates

• Choosing an Audio Codec

9

Page 10: Encoding Audio & Video for the Web Presented by William Haun

Tips for Encoding Audio

Channels (Stereo vs. Mono)

- The average user’s computer speakers are not high-quality and not positioned to take advantage of stereo sound(the user may also not have speakers plugged in correctly)

- Dropping a channel cuts the file size in halfYou can take advantage of that reduction to have higher quality mono sound

- Always convert audio for theweb to mono unless the stereoeffect is so important you cansacrifice quality and/or file size

10

Page 11: Encoding Audio & Video for the Web Presented by William Haun

Tips for Encoding Audio

Sample Rate

- Sample rate is one of the key contributing factors to audio file size

- Sample rates are measured in hertz and define how many samples are recorded per second

- More samples per second equates to higher fidelity

11

Page 12: Encoding Audio & Video for the Web Presented by William Haun

Tips for Encoding Audio

Sample Rate

- CD quality is 44.1khzFM radio is around 15khz

- 22khz is a perfectly acceptable rate for music online Down sampling from 44khz to 22khz cuts file size in half

- Audio that is primarily speech can be dropped significantly – even as low a 8khz

12

Page 13: Encoding Audio & Video for the Web Presented by William Haun

Tips for Encoding Audio

Choosing an Audio Codec

- You can’t go wrong with MP3,everything supports it

- MP4 is slowly becoming the new standard,it has a much better compression ratio

- WMA is another alternative with a great compression ratio but is mostly limited to Windows Media Player

13

Page 14: Encoding Audio & Video for the Web Presented by William Haun

Tips for Encoding Video

• Frame Rate

• Frame Size (Resolution)

• Key Frames

• Image Quality(Video Smoothness vs. Sharpness)

• Multiple bit rate streaming(also called “intelligent streaming”)

14

Page 15: Encoding Audio & Video for the Web Presented by William Haun

Tips for Encoding Video

Frame Rate

- NTSC video (TV standard) is 30 frames per second (fps)

- The average human eye can only process 20-22fps

- Dropping the frame rate of video for the web from 30 to 20 means 1/3 less file size

- Video without much motion can be dropped to 15fps(i.e. footage filmed on tripod, person talking)

- Stick with frame rates divisible by 5 or 6 (10,12,15,18,20,24,30)

15

Page 16: Encoding Audio & Video for the Web Presented by William Haun

Tips for Encoding Video

Frame Size (Resolution)

320x240 is the most common size on the web

Recommended frame sizes:- High Bandwidth: 400x300 or 480x360- Low Bandwidth: 240x180- Dial-up: 180x120 (pretty much worthless)

- Download for DVD/TV: 640x480

Make sure you don’t change the aspect ratio(it will stretch or squash your image)

16

Page 17: Encoding Audio & Video for the Web Presented by William Haun

Tips for Encoding Video

Frame Size (Resolution)

- The larger the frame size, the more noticeable low frame rates will be

- Crop widescreen barsThey are a waste of bits

17

640x270

640x480

Page 18: Encoding Audio & Video for the Web Presented by William Haun

Tips for Encoding Video

Frame Size (Resolution)

- If you are encoding NTSC footage be sure to de-interlace the footage if your final size is over 240px high

18

Page 19: Encoding Audio & Video for the Web Presented by William Haun

Tips for Encoding Video

Frame Size (Resolution)

- Crop overscan when digitizing footage from tape(especially VHS)

19

Page 20: Encoding Audio & Video for the Web Presented by William Haun

Tips for Encoding Video

Key Frames

- A key frame is a point in encoded video where the data for the entire frame is transmitted, rather than just the changes.

20

Page 21: Encoding Audio & Video for the Web Presented by William Haun

Tips for Encoding Video

Key Frames

- More key frames means sharper image but costs more bandwidth and may cause overall degradation of quality

- Less key frames means smoother video, too few gives “underwater look” (see YouTube)

21

Page 22: Encoding Audio & Video for the Web Presented by William Haun

Tips for Encoding Video

Key Frames

- Pay attention to setting values in your encoding softwareSometimes you set X key frames per second other times it is key frame every X frames

- If a “auto key frame on scene change” option is available ALWAYS check it

- Key frames also become the seek points in a video

22

Page 23: Encoding Audio & Video for the Web Presented by William Haun

Tips for Encoding Video

Image Quality (Smoothness vs. Sharpness)

- Some codecs let you set a “quality/smoothness” setting

- Choosing smoothness over quality means the encoder will not drop any frames to preserve the smoothest motion but will lower the quality of the image in order to do so

- Choosing quality over smoothness will drop frames to preserver the quality of the image

- Choose sharper (higher quality) for content without much detail and motion

- Choose smoother for high motion or a lot of detail

23

Page 24: Encoding Audio & Video for the Web Presented by William Haun

Tips for Encoding Video

Multiple Bit Rate Streaming

Uses a single file to deliver a video file to the user that is appropriate for his bandwidth

Windows Media calls it “Intelligent Streaming” and packages several different bit rate versions into one file

The Windows Media Server then automatically determines which version to stream to the user based on its calculation of what his bandwidth is (there is debate over how well this actually works)

24

http://www.microsoft.com/windows/windowsmedia/howto/articles/intstreaming.aspx

Page 25: Encoding Audio & Video for the Web Presented by William Haun

Tips for Encoding Video

Multiple Bit Rate Streaming

QuickTime requires you to encode the different bit rate versions, then use MakeRef tool to create a reference movie for them.

Their QuickTime player then chooses which version to stream to them based on their QuickTime player settings.

Some encoders have the MakeRef functionality built-in(Cleaner, Wirecast)

25

Page 26: Encoding Audio & Video for the Web Presented by William Haun

Tips for Encoding Video

Multiple Bit Rate Streaming

Flash Media Server has built-in functionality that will drop frames on-the-fly from the video if a user’s bandwidth can’t handle it

True multiple bit rate streaming with FMS is more complicated.Like QuickTime, you must encoded the different bit rate versions. Then a bandwidth detection movie needs to be run by the video player and then player must be programmed to determine which video to stream from an array of videos

http://www.adobe.com/devnet/flashcom/articles/flvideo_bandwidth.html

26

Page 27: Encoding Audio & Video for the Web Presented by William Haun

Tips for Encoding Video

Multiple Bit Rate Streaming

The SMIL XML standard also has a mechanism for delivering multiple bit rate files.

SMIL can be used with all four of the most common media players.

FLV & SMIL example: http://livedocs.adobe.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00003646.html

27

Page 28: Encoding Audio & Video for the Web Presented by William Haun

Production and Post-Production Tips

Tripod, Tripod, Tripod!

Video shot on a tripod provides the encoderwith frames that don’t change as much.

The encoder can then dedicate bits toimportant motion within the frame.

Even the steadiest handheld footage makes every single frame different from its preceding one.

The encoder then has a harder time determining what is frame movement and what is in-frame motion.

28

Page 29: Encoding Audio & Video for the Web Presented by William Haun

Production and Post-Production Tips

Minimize In-Frame Motion

29

Codecs will use the most bits on the portions of the frame that change

Help the codec out by keeping motion to a minimum

Avoid motion backdrops

Avoid patterned clothes on subjects (a small move shifts the whole pattern)

Page 30: Encoding Audio & Video for the Web Presented by William Haun

Production and Post-Production Tips

Avoid Fades & Fancy Transitions

Fades (dissolves) and animation transitions make more pixels change from frame to frame.

The encoder will do one of the following:With CBR your dissolves will just look terribleWith VBR it will focus its bits on making your dissolves look nice and your actual content’s quality will be compressed

30

Page 31: Encoding Audio & Video for the Web Presented by William Haun

Production and Post-Production Tips

Avoid Fades & Fancy Transitions

31

Page 32: Encoding Audio & Video for the Web Presented by William Haun

Production and Post-Production Tips

Use a Noise Reduction Filter

Some encoders offer the option to perform “noise reduction” before encoding. This will clean up grain and noise in the original footage that may confuse the encoder and cause it to waste bits.

Noise reduction is very useful with digital video footage shot inlow-light situations

Noise reduction significantly increases the encoding time

Overuse can cause the image to loose too much detail

32

Page 33: Encoding Audio & Video for the Web Presented by William Haun

Production and Post-Production Tips

Shoot & Edit a Cut Specifically for Web

When recording a production for distribution on tape, DVD, and the web consider creating a “web version.”

For live events shoot from one angle on a tripod.

In post-production remove transitions and stick to straight cuts.

33

Page 34: Encoding Audio & Video for the Web Presented by William Haun

Resources

Windows Media Resources

• Free Windows Media Encoder 9http://www.microsoft.com/windows/windowsmedia/forpros/encoder/default.mspx

• Windows Media Knowledge Centerhttp://www.microsoft.com/windows/windowsmedia/knowledgecenter/default.aspx

QuickTime Resources

• Quicktime Developer Connectionhttp://developer.apple.com/documentation/QuickTime/index.html

• Quicktime Developer Tools - http://developer.apple.com/quicktime/quicktimeintro/tools/

Flash Video Resources

• Compare Flash Video Encoders & Settings - http://www.flashvideofaq.com/

• Article on choosing your Encoder apphttp://www.adobe.com/devnet/flash/articles/selecting_video_encoder.html

• Flash Video Developer Center - http://www.adobe.com/devnet/flash/video.html

34