Showing posts with label encoding. Show all posts
Showing posts with label encoding. Show all posts

Feb 2, 2009

Encoding H.264 video using QuickTime Pro

You can export H.264 vide from QuickTime Pro in a number of ways. The simplest way is to use the iPod preset. This is perfect for creating iPod compatible files, but it gives you no control over any of the settings. You may want to tweak the settings a bit to suit your podcast, in which case you'll have to create your own encoding setting.

Using the iPod preset

Using the iPod preset is simple:

1. Open QuickTime Pro, and open the video to be encoded.

2. Choose Export from the File menu. This opens the Export window, shown in Figure 1


Figure 1: Export an iPod compatible video from QuickTime Pro using this preset.


3. From the drop-down menu, choose Movie to iPod (320×240).

4. Click Save. QuickTime Pro exports an iPod compatible H.264 video.

The only problem with using this preset is that it doesn't give you any control over any of the encoding options. You can't select a bit rate, a resolution, or anything else. Of course, it's guaranteed to work on an iPod, which is pretty handy. But the default bit rate is rather high, clocking in at over 800 kbps. This is fine for a short podcast, but if your podcast is longer than, say, 5 minutes, you're looking at a pretty serious download. You may want to dial the bit rate down to reduce the file size. To do this, you have to set your encoding settings by hand.

Encoding using custom H.264 settings

QuickTime also makes it easy to customize the encoding settings. There are a few more steps than using the iPod preset, but you have far more control over the output. Follow these steps:

1. Open QuickTime Pro, and open the video to be encoded.

2. Choose Export from the File menu. Again, this opens the Export window, as shown in Figure 2.


Figure 2: Here's how to get to the MPEG-4 video export settings.


3. Choose Movie to MPEG-4 from the Export drop-down menu.

4. Click the Options button to get to the video export settings. To begin with, this opens the MPEG-4 video settings, as shown in Figure 3.


Figure 3: Configure QuickTime MPEG-4 export video settings with this dialog box.


5. Select MP4 from the File Format drop-down menu.

Note QuickTime Pro defaults to MP4 (ISMA) for MPEG-4 output. ISMA stands for the Internet Streaming Media Alliance. Unfortunately the H.264 codec is not yet considered ISMA compliant (as of Fall 2006). This really doesn't mean anything. The H.264 codec is part of the MPEG-4 standard and will play back in any modern QuickTime player or iPod. For best quality, you should choose the MP4 option, not MP4(ISMA), so you can use the H.264 codec.


6. Choose H.264 from the Video Format drop-down menu.

7. Enter a bit rate for your file. Remember that the total bit rate is the video bit rate plus the audio bit rate.

8. Enter your screen resolution in the Image Size field. If you want iPod compatible files, choose 320×240.

9. Click the Video Options button to access the advanced encoding options. This opens the Advanced Video Settings window, shown in Figure 4.


Figure 4: Be sure to select Multi-pass encoding for the highest-quality results.


10. Choose Best Quality (Multi-pass) encoding mode, and click OK.

Note You may be wondering about the profiles restriction (Main versus Baseline) on this screen. In MPEG-4 encoding profiles define the "tools" that can be used to encode the video. Consequently these profiles also define the tools required to play back the encoded video. In this example, the Main profile provides more encoding tools than the Base profile. Since our goal is the highest quality video, we chose the Main profile.

The MPEG-4 standard is incredibly broad and frankly, not written in a way that a layman can understand. For a fantastic, concise, and fun-to-read explanation of the MPEG-4 standard, we recommend Damian Stolarz' Mastering Internet Video.


11. Now it's time to configure the settings for your audio. Select Audio from the second dropdown menu in the MPEG-4 Export Settings window. This changes the information displayed in the bottom half of the window from video settings to audio settings, as shown in Figure 5.


Figure 5: Configuring QuickTime MPEG-4 export audio settings


12. The first thing to choose is the audio codec you want to use from the Audio Format dropdown menu. In fact, the only codec offered for MPEG-4 encoding is AAC, which is just fine, because it offers great quality.

13. Next, select the desired bit rate from the Data Rate drop-down menu. A rate of 32 kbps should provide good quality.

14. If you're encoding spoken word content or want slightly higher fidelity, choose mono from the Channels drop-down menu.

15. The next available setting is the Output Sample Rate. This determines how much highfrequency information is contained in the final encoding. In general, the default setting works just fine. However, you can experiment with lowering the setting to get increased fidelity.

16. Finally, set your Encoding Quality to Best. This makes the encoding process take a little longer, but hey, your podcast is worth it.

17. Click OK to return to the Export menu, and then click Save to start the export/encoding process. You'll see the QuickTime Export progress window, shown in Figure 6, which gives you an idea how long the process will take. Depending on the length of your podcast, you may have time to grab a cup of coffee.


Figure 6: The QuickTime export progress window lets you know how long it's going to take.

Jan 3, 2009

Step-by-Step Encoding Examples | Podcast

Now it's time to actually encode some files. This section demonstrates audio and video encoding using stand-alone encoders, editing platforms, and even iTunes. If your editing application isn't demonstrated, don't worry: It probably works much the same way. Let's start with iTunes, which really isn't an encoder, but it can do the job.

Tip You should always archive the high-quality version of your file so that you can re-edit or re-encode it later.


Encoding MP3 audio using iTunes
iTunes automatically encodes all imported audio. When you insert a CD and iTunes offers to import it, the audio bits are pulled straight off the CD and encoded into whatever format has been specified. The default setting is to encode using AAC. However, iTunes will also convert music in MP3 if you prefer, and will convert any file into an MP3 file. All you have to do is import the file into iTunes, and then convert it to MP3.

Setting MP3 encoding defaults

To use iTunes as an MP3 encoder, you have to set the default encoding to MP3. Follow these steps to set iTunes to import using the MP3 codec:

1. Open iTunes, and open the Preferences window by choosing Preferences from the iTunes menu (the Edit menu on a PC). You also can open this window using the keyboard shortcut Command+, (Ctrl+, on a PC).

2. Click the Advanced icon/tab, and select the Importing tab.

3. Select MP3 encoder from the Import Using drop-down menu.

4. Select your bit rate from the Setting menu. By default, the lowest setting offered is 128 kbps stereo. For most podcasts, this is a perfectly fine setting. If, however, you want to economize on your bit rate, you can adjust the settings by selecting Custom from the Setting drop-down menu.

5. Select a bit rate from the Stereo Bit Rate drop-down menu.

6. You can select a sample rate or leave this set to Auto. If your podcast ends up sounding a little crunchy or distorted, you can try lowering the sample rate to get better fidelity.

7. If you want a mono podcast, select Mono from the Channels drop-down menu.

Note If you select Mono encoding, the bit rate will be half of what you specified in the Stereo Bit Rate drop-down menu.


8. Click OK to close the Custom Settings menu, and then click OK to close the Preferences window. iTunes will now import files using the MP3 settings specified.

Importing and Encoding
To encode using iTunes, you must first import the file, and then convert the imported file. Importing couldn't be simpler:

1. From the File menu, choose Import.

2. Browse to find the file you want to encode, and click Choose (Open on PCs). The file is imported and is listed in your music library.

3. Find the file in your music library. Click it to select it, and then from the Advanced menu, choose Convert to MP3.


That's all there is to it! iTunes encodes it using the settings specified on the Importing tab of the Advanced menu. The iTunes music folder is easy enough to find, but if you want to encode to a specific location, you can change this setting in the General tab of the Advanced settings window.

Caution Be careful when you change your iTunes music folder; otherwise, you'll end up with your music library in two different folders. It's probably a good idea to change the music folder back to the default after you've finished your encoding.

Dec 11, 2008

Multi-format encoding

In the beginning, podcasts were audio only and always encoded using the MP3 codec. But as people have started to realize the potential for video podcasting and portable media player displays have improved, the possibilities for podcasting have multiplied. The problem is that most of these enhanced opportunities come at a price, and that price is compatibility. Enhanced podcasts designed for the iPod do not play on other portable media players. Podcasts encoded using the Windows Media format for compatibility with the "Plays For Sure" portable players do not play on the iPod. And if you want to offer a video image larger than 320×240, it may or may not play back on portable media players.

So what can a podcaster who wants to push the envelope do? The best approach is to offer a number of formats and let your audience choose which version they'd like to subscribe to. Of course, if you're offering multiple formats, you're no longer encoding a single version of your podcast; you may be encoding three or four. For example, if you really want to offer every possible choice, you might offer the following:

  • An MP3 version for older media players

  • An enhanced iPod version with images

  • A 320×240 video version encoded in Windows Media

  • A 320×240 video version encoded in QuickTime H.264

  • A 640×480 video version encoded in Flash format for Web viewing

    Granted, this example may seem excessive, and the chances that someone would encode into so many different formats are pretty slim. However, it's not out of the realms of possibility. Rocketboom, one of the most popular video podcasts, is encoded into four different formats. If you want the largest possible audience and want to stay at the cutting edge of podcasting technology, you're going to have to encode multiple versions. This is where a multi-format encoder comes in handy.

    Tip If you're offering more than one format, offer separate RSS feeds for each so people can subscribe to their favorite format.


    Multi-format encoders enable you to choose a single source file and output to multiple formats. These encoders usually allow you to set up encoding presets, so you don't have to re-enter the encoding settings every time you encode. Many multi-format encoders also allow you to preprocess your original master, so if you want to do color correction or resizing, it can be done at the encoding stage.

    Some multi-format encoders offer automatic batch processing, where files placed into a specific directory are automatically processed and encoded. You can streamline your production chain if you're using a multi-format encoder with batch processing. This allows you to concentrate on your programming and let the batch processing take care of the rest.

    A number of multi-format encoding solutions are available, including these popular ones:

  • Sorenson Squeeze: The Sorenson Squeeze Compression Suite offers MP3, AAC, QuickTime, Windows Media, and Real formats (Mac users must have the Flip4Mac plugin installed to get Windows Media capabilities). You can add Flash encoding with an additional plug-in (see Figure 1), or by purchasing the Squeeze Power Pack.


    Figure 1: Sorenson Squeeze


  • Canopus Procoder: The Express version offers QuickTime, Windows Media, and Real support. The full 2.0 version also offers MP3 encoding, and Flash encoding if you have Flash MX installed.

  • Telestream FlipFactory: This offers MP3, QuickTime, Windows Media, Real, and Flash support. It also supports 3GPP (mobile phone format) with an additional plug-in.

  • Digital Rapids Stream: The basic version offers QuickTime, Windows Media, and Real support. The Pro version adds MP3 and Flash support. All Digital Rapids software requires Digital Rapids capture cards.
  • Nov 30, 2008

    Encoding Via Your Editing Platform

    If you've invested in a decent audio-editing or video-editing platform, chances are good that you'll use your editing platform to do your encoding. Most include a variety of export options. (You'll also want to export a broadcast-quality master for archival purposes, of course.) If your master includes lots of processing and complicated editing, you may want to render the broadcast-quality master and then encode using an encoding application or multi-format encoder, instead of doing all the processing twice. For most podcasts, exporting an encoded master directly from your timeline is probably easiest.

    Audio
    Most audio-editing platforms offer MP3 encoding. Many also offer encoding in a number of other formats:

  • Audacity (Windows, Mac, Linux): Offers MP3 and Ogg Vorbis export

  • Peak (Mac): Offers MP3 and AAC export

  • Garage Band (Mac): Offers AAC export, which is fine for iPods, but does not support MP3 export

  • Sound Forge (Windows): Offers a number of export options, including MP3, Ogg Vorbis, Windows Media, and RealAudio (see Figure 1)


    Figure 1: Sound Forge offers a large number of export options.


  • Audition (Windows): Also offers a wide variety of support, including MP3, Windows Media, and RealAudio

    Video
    Video-editing platforms also offer fairly rich export options:

  • Final Cut Pro (Mac): Offers QuickTime H.264 support

  • iMovie (Mac): Offers QuickTime H.264 support, including a preset for iPods

  • Adobe Premiere (PC): Offers Flash, QuickTime, Windows Media, and RealVideo support

  • Sony Vegas (PC): Offers QuickTime, Windows Media, and RealVideo support

  • Ulead Video Studio (PC): Offers QuickTime, Windows Media, and RealVideo support, and includes output templates for iPods and SmartPhones
  • Nov 17, 2008

    Basic Encoding Techniques

    Whether you encode your podcast by exporting directly from your editing platform or by using a stand-alone encoder, you can specify a number of parameters. You may have only a few choices if you're using encoding presets, or you may have the opportunity to specify exactly how you want your podcast encoded.

    In the early days of low bit-rate encoding, back when people were connected to the Internet via slow modems, encoding technology was limited and required lots of tweaking to extract the best quality. Now, ten years later, codec technology and Internet connection speeds have improved so much that encoding high-quality podcasts should be within everyone's reach.

    This is particularly true of audio podcasts. Modern codecs such as RealAudio and Windows Media Audio are capable of attaining FM-mono quality at a mere 32 kbps. The MP3 codec lags behind in quality, but because you can safely encode your podcast at 128 kbps, you should not have any quality issues.

    Video is a little trickier. Assuming the majority of your audience is on a broadband connection, your video quality is limited by available bandwidth. Although you can't expect DVD quality at these bit rates, there's no reason why you can't create a perfectly acceptable video experience. This chapter helps you choose settings that should do the job. Let's start off with the easy stuff — audio encoding.

    Audio Encoding


    Audio encoding is easy, for a number of reasons. Raw audio files are large, but nowhere near as huge as video files. Therefore, the amount of compression that is needed to reduce them to a size that is suitable for Internet distribution is not excessive. Audio codec technology has progressed to a point where low bit rate encoding produces very good results. Podcasting reaps the benefits of ten years of cutthroat competition between RealNetworks and Microsoft, and the progress made by the MPEG organization with AAC encoding.

    Because modern codecs sound so good, you really don't need to do much tweaking when you're encoding audio. You really have to decide only three things: whether to encode in stereo or mono, whether to use a speech or a music codec, and what bit rate to use.

    Mono versus stereo
    The first thing to decide is whether to encode your podcast in stereo or mono. If your program is predominantly interviews or spoken word, encode in mono. Mono encodings are always higher fidelity at a given bit rate, because only a single channel is encoded instead of two. If you're encoding in mono, you can use a lower bit rate and get the same quality or you can get better quality than a stereo encoding at the same bit rate.

    If your content is predominantly music, you should encode in stereo, although it isn't strictly necessary. Even though music is recorded in stereo, most of the content is right in the center of the mix. The lead vocal, the snare drum, the bass drum, all will be right in the center of the speakers. And watch where you place your speakers. If you aren't sitting directly between the speakers, you aren't experiencing the full stereo effect anyway. However, one good reason to target stereo if you're playing music is that half your audience may be listening on headphones, which exaggerates the stereo effect.

    Speech versus music
    The next thing to decide is whether to use a speech codec or a music codec. If you're encoding an MP3 file, you don't have a choice. MP3 is a music codec. The good news is that MP3 is perfectly suitable as a speech codec as well, provided the bit rate is high enough.

    Speech codecs can take special shortcuts during the encoding process due to the nature of speech content. With speech, the dynamic range tends to be very limited, as is the frequency range. After you start talking, the chances are good that you'll continue to speak at roughly the same volume and in the same register. Knowing this, a speech codec can make intelligent decisions about how to encode the audio.

    Music content, on the other hand, has a wide dynamic and frequency range. There are bass drums and bass guitars, as well as crashing cymbals and violins. The shortcuts that a speech codec takes are completely unsuitable for encoding music content.

    So the choice is fairly obvious: If you're encoding content that is speech only, you can encode at very low bit rates and still achieve high quality using a speech codec. However, for most applications, a music codec is perfectly appropriate.

    Bit rates, sample rates, and quality equivalents
    The most important decision to make about your audio podcast encoding is what bit rate to use. The bit rate determines the eventual file size of your podcast, which in turn determines how long it takes to download. The bit rate also determines the fidelity of your podcast. The higher the bit rate, the higher fidelity your podcast is.

    The listed audio bit rates range from 20 kbps to 256 kbps. If you're producing audio-only podcasts, you should target somewhere between 64 kbps and 128 kbps. If you're encoding predominantly speech, you can safely stay at the low end of that; if you're encoding music, you may want to stick to the higher end of the spectrum.

    Note At the end of the day, you know best how you want the podcast to sound. Try encoding at a couple of different bit rates, and see which one sounds best to you.

    The other thing you may be able to set is the sampling rate. The sampling rate determines how much high-frequency information is encoded. For example, CD-quality audio uses a sample rate of 44.1 KHz, to capture the full 20–20,000 Hz frequency range. The sampling rate has to be at least double the highest frequency you're trying to capture. Depending on what bit rate you're targeting, you may be offered a few different sampling rates.

    The interesting thing about sampling rates is that a higher sampling rate isn't necessarily better. The sampling rate determines how often the incoming audio signal is sampled, so it determines how much audio the encoder has to try to encode. If you set a higher sampling rate, you're telling the encoder to try to encode more high-frequency information, but the encoder may have to sacrifice the overall quality of the encoding. Essentially, the sampling rate determines the trade-off between the frequency range and the fidelity of the encoding. At a given bit rate, an encoder can offer higher fidelity with a reduced frequency range or reduced fidelity with a higher frequency range.

    We suggest that you choose a lower sampling rate, thereby allowing the encoder to create a higher fidelity version of your podcast. There is very little information above 16 KHz in most audio programming, and most people don't have speakers that reproduce it faithfully anyway. Therefore, choosing a 32 KHz or 22 KHz sampling rate should provide more than enough high-frequency information.

    Aug 22, 2008

    Encoding : Throughput & Quality equivalents

    Throughput
    As mentioned in the previous section, throughput is the measure of the amount of bandwidth you use over time. You'll encounter throughput when you use a service to distribute your podcast, because most offer a certain amount of throughput for free and bill you for any used in excess of that. Obviously, you want to keep your monthly bill as low as possible, so you want to try to limit the amount of throughput you use.

    When you encode your podcast, you want to balance the desire to provide the highest quality possible with the reality of your throughput bill at the end of the month. Many podcast distribution services offer generous amounts of free throughput each month, so this may not be an issue when you first start out. If your podcast becomes wildly popular, though, you may be faced with a need to cut your operating costs (until that first sponsor or advertiser comes around, of course). If so, you may want to consider reducing the bit rate of your podcast, which reduces the quality of your podcast, but that may not be noticeable to your audience. Remember, most people listen to podcasts while sitting in front of their computers, and multimedia speakers aren't renowned for their quality. What you want to deliver is a podcast quality that is equivalent to other broadcast media, which in the case of AM and FM radio isn't that high to begin with.

    Quality equivalents
    The concept of broadcast quality to mean really, really good. However, anyone who has listened to AM radio knows that it doesn't sound anywhere near as good as FM, and for that matter FM radio doesn't sound as good as CDs. Yet they're both broadcast standards, and we still listen to radio, even AM. Different types of programming do not need as much fidelity as others.

    The idea, then, is to figure out how much fidelity your programming requires and produce content to that standard. When recording the content, you should always record at a very high standard, because that gives you the most flexibility later on. But when it comes time to encode your content for Internet distribution, you may want to sacrifice a bit of quality for the cost savings it provides.

    Table 1 lists some common bit rates offered by encoding software and brief descriptions of what quality you can expect using different encoding technologies.



    Note In Table 1, you should notice that MP3 audio quality is always slightly worse than Windows Media, Real, and QuickTime AAC, particularly at low bit rates. This is because the MP3 codec is older and wasn't really designed for low bit rate encoding. At higher bit rates (128 Kbps and above), the quality differential is less apparent.

    Aug 12, 2008

    Why Encoding Is Necessary - Bandwidth

    You've spent countless hours and quite possibly a sizeable sum of money to produce a broadcast-quality podcast. Now you're being asked to take the polished result and convert it to a different format, which may compromise the quality of the original. Why?

    The simple answer is because the raw audio and video files are too large to deliver practically via the Internet. There's no technical reason you can't deliver the original files — but it would take an incredibly long time for the files to download, and your monthly delivery bill would be sky high. To better understand the practical limitations involved, you must understand the concepts of bandwidth and throughput.

    Bandwidth
    Bandwidth, in the networking sense of the word, is a measurement of the amount of data that is being transmitted at any given point. Throughput is the aggregate amount of bandwidth that has been used over a given time period. Think about water coming out of a faucet: The water can come out slowly or quickly depending on how much you open the tap. A gallon jug fills slowly or quickly depending on how fast the water is coming out. The "bandwidth" of the faucet is the speed of the water coming out; the "throughput" is the total amount of water that comes out.

    In podcasting, we come across bandwidth and throughput in a number of different areas. First, each of your potential audience members is connected to the Internet in some way, and that connection has an advertised bandwidth. If they're on DSL or cable modem, they may have a download bandwidth somewhere between 256 kilobits per second (kbps) to several megabits per second (mbps). Similarly, when you upload your podcast to a server or distribution service, you're using bandwidth, but you're uploading, not downloading. The upload or upstream speed of DSL and cable modems is usually far less than the download speed. Regardless of which direction the data is traveling, the bandwidth available determines the speed at which the transfer takes place.

    Let's say you've recorded a 20-minute audio podcast. If you've recorded at CD quality, you recorded in stereo, sampling at 44.1kHz, using 16 bits per sample. We can determine how large this file is using some simple math:

    44,100 samples/sec * 16 bits/sample * 2 channels = 1,411,200
    bits/second
    1,411,200 bits/sec / 8 bits/byte = 176,400 bytes/second
    176,400 bytes/second / 1024 = 172.3 kilobytes per second (KBps)
    172.3 KB/sec * 60 secs/min * 20 min = 206,718.75 KB
    206,718.75 / 1024 = Approximately 202 megabytes (MB)


    So the raw file is over 200 megabytes. (In fact, you can do this math much more quickly: One minute of stereo CD audio is approximately 10 MB, so 20 * 10 = ∼200 MB.) Let's assume one of your audience members is on a fairly standard DSL line, with a download speed of approximately 500 Kbps. You can calculate the download time with a bit of math. All you have to do is convert the file size from megabytes into kilobits, and then divide by the download speed:

    200MB * 8 bits/byte = 1600 megabits
    1,600 megabits * 1024 = 1,638,400 kilobits
    1,638,400 kilobits / 500 kbps = 3,266 seconds
    3,266 seconds / 60 seconds/minute = 54.6 minutes


    So your podcast would take just under an hour to download. If the person is downloading in the background, this might not be too much of a problem, but chances are he's checking e-mail, surfing the Web, and doing other things on his computer that might further constrict the available bandwidth, which in turn makes the download take even longer. Additionally, he may not be getting the full bandwidth that he's paying for (see the "Why Does My Broadband Connection Seem Slow?" sidebar). Overall, this is not an optimal experience.

    What we want to do is deliver a high-quality podcast that doesn't take hours to download. Encoding software enables us to do precisely this. For example, if we encode the file using an MP3 codec, we can achieve CD quality using only 128 kbps. In this case, our file would be:

    128 kbits/sec * 60 seconds/minute * 20 minutes = 153,600 kilobits
    153,600 kbits / 8 bits/byte = 19,200 kbytes
    19,200 kbytes / 1024 = 18.75 MB


    Our file size is less than ten percent of what it was before, and the download time is therefore reduced to about five minutes, which is much more like it. And because each of your listeners is downloading a smaller file, you use much less throughput.