The ElementaryDesign HTTP Streaming HowTo

Introduction

HTTP Streams are served like html or image files: there is no special server-side software required, which makes inexpensive web hosting a viable option for those who wish to serve audio files on their sites. In order to compare the leading HTTP-streamable audio file types, I have posted 12 different encodings each of two of my favorite songs, "Town and Country," from the Trolleyvox's soon-to-be released Leap of Folly (4:24), and "Your Submarine Gown," from emma's Garden City 44 (4:31). These encodings cover the Internet's four most common audio formats: RealAudio, mp3, Ogg Vorbis, and Windows Media. Each format has its strengths and weaknesses; the examples and accompanying text are intended to help you make an informed decision.

While listening for audio quality, which should be the primary determinant in selecting a protocol or protocols, it is also important to take storage and bandwidth into consideration. Storage refers to the amount of space you have in which to store files on your web server's hard drive. For example, if you have 100 .html files that average 10 Kilobytes (K) each, you have used 1 Megabyte (MB): 1,000K is equal to 1MB. Bandwidth refers to the amount of times you are allowed to have visitors access the files on your web servers's hard drive; what actually happens when visitors access these files is they are being transferred from your web server's hard drive to the visitor's hard drive over the Internet. For example, if you have a 4MB mp3 file that visitors access 1,000 times, you have transferred 4 Gigabytes (GB) of data: 1,000MB is equal to 1GB.

I have used my hosting plan for reference: VerveHosting's $7.50/month Webmaster Lite provides 100MB of storage and 7GB/month of data transfer. I am going to reserve 10MB for the non-audio files that make up my site, though that is probably overly cautious; I have also assumed that I will need 1GB of data tranfer per month for serving non-audio files, though that number likely should be considerably lower as well. The numbers next to the audio files indicate how many of these files could be stored in the 90MB left on the server and how many times they could be downloaded in the remaining 6GB allowance. The Summary section of this site should simplify side-by-side comparisons of file size.

Another consideration in choosing a format is the time and effort it takes to prepare files for HTTP streaming. No one encoding protocol strikes me as significantly easier than any of the others, but please review the Preparing Files section of this site before making a firm commitment. It also may assist in you in checking my work: it is likely that I made decisions you would have made differently.

If you expect high traffic and either have more to spend or know how to run your own server, you might consider server-side software (like Icecast, SHOUTcast, or Netjuke). For more information on these more robust solutions, and on the software and websites I have used in creating the audio files on this site, see the Resources section.

RealAudio

Advantages: Created specifically to provide streaming. Offers optimization for those with slower connections. Widely supported.

Disadvantages: Proprietary. Offers fewer encoding quality options than other formats.

Alternative Media (Transcripts): Lyrics to "Town and Country" and "Your Submarine Gown."

Technical Notes: How I prepared RealAudio files for HTTP streaming.

Optimized for 56K (34kbps)

Town and Country (1.04MB) | 86 files | 5,769 streams

Your Submarine Gown (1.06MB) | 84 files | 5,660 streams

Optimized for High Bandwidth (225kbps)

Town and Country (5.63MB) | 15 files | 1,065 streams (temporarily removed)

Your Submarinie Gown (5.78MB) | 15 files | 1,038 streams

MPEG-1 Layer III or MPEG Audio Layer III (mp3)

Advantages: Widely supported. Files can easily be converted to .wav files for playback in standard CD players, and native support is common in handheld devices.

Disadvantages: Because files can easily be converted to .wav files for playback in standard CD players, and because native support is common in handheld devices, piracy may be a concern. Proprietary, patented format.

Alternative Media (Transcripts): Lyrics to "Town and Country" and "Your Submarine Gown."

Technical Notes: How I prepared mp3 files for HTTP streaming.

Minimum Quality (32kbps)

Town and Country (1.25MB) | 72 files | 4,800 streams

Your Submarine Gown (1.28MB) | 70 files | 4,687 streams

Low Quality (64kbps)

Town and Country (2.50MB) | 36 files | 2,400 streams

Your Submarine Gown (2.58MB) | 34 files | 2,325 streams

Average Quality (128kbps)

Town and Country (4.05MB) | 22 files | 1,481 streams

Your Submarine Gown (4.14MB) | 21 files | 1,449 streams

Near CD Quality (192kbps)

Town and Country (6.16MB) | 14 files | 974 streams (temporarily removed)

Your Submarine Gown (5.64MB) | 15 files | 1,063 streams

Ogg Vorbis

Advantages: Format is free, open, and unpatented. Created by geeks for geeks, who claim it offers audio quality that is better than mp3 in smaller files. Supported in the latest version of WinAmp, etc. Not widely supported in handheld devices and many are not aware that Ogg Vorbis files can be easily converted to .wav files for playback in standard CD players.

Disadvantages: Still fairly new, so older versions of WinAmp and other media players lack native support, which means visitors may need to upgrade their software or add plugins in order to listen to streams. Not widely supported in handheld devices and many people are not yet aware that Ogg Vorbis files can be easily converted to .wav files for playback in standard CD players.

More importantly, listening to streams takes a bit of doing. Here are the currently available methods/software I have found:

You may have to change or establish certain file associations in order to make the above software play Ogg Vorbis http streams. Take the following steps if you use Netscape/Mozilla:

  1. To open the Netscape preferences dialogue, go to the Edit menu and click Preferences.
  2. Expand the + next to Navigator, and click on Applications (or Helper Applications in Mozilla).
  3. Click New Type to add the Ogg Vorbis file association.
  4. In the Description of Type box, type Ogg Vorbis Streaming Audio.
  5. In the File Extension box, type m3u.
  6. In the MIME Type: box, type audio/x-mpegurl.
  7. Click Browse to browse to the folder in which you installed one of the above software packages. (e.g., C:\Program Files\Winamp2.81\)
  8. Browse to this folder and double-click winamp.exe.
  9. Click OK to add the type, and then click OK again to exit preferences.
  10. Restart your Netscape browser to finish the association process.

Internet Explorer, at least on machines running Windows, relies on its operating system to tell it which program should open specific files (i.e., Word opens files with the .doc extension). Here is a Microsoft-endorsed tutorial on files associations.

Alternative Media (Transcripts): Lyrics to "Town and Country" and "Your Submarine Gown."

Technical Notes: How I prepared Ogg Vorbis files for HTTP streaming.

Minimum Quality (45kbps)

Town and Country 1.46MB | 61 files | 4,109 streams

Your Submarine Gown 1.50MB | 60 files | 4,000 streams

Low Quality (64kbps)

Town and Country 1.91MB | 47 files | 3,141 streams

Your Submarine Gown 1.97MB | 45 files | 3,045 streams

Comparable to mp3 Average Quality (112kbps)

Town and Country 3.20MB | 28 files | 1,875 streams

Your Submarine Gown 3.21MB | 28 files | 1,869 streams

Lossless Stereo Coupling (192kbps)

Town and Country 5.42MB | 16 files | 1,107 streams

Your Submarine Gown 5.18MB | 17 files | 1,158 streams

Windows Media Audio (WMA)

Advantages: Widely supported. Files can easily be converted to .wav files for playback in standard CD players.

Disadvantages: Files can easily be converted to .wav files for playback in standard CD player, which may make piracy a concern. Proprietary, patented format. Dance with the devil, you don't change the devil - the devil changes you.

Alternative Media (Transcripts): Lyrics to "Town and Country" and "Your Submarine Gown."

Technical Notes: How I prepared Windows Media files for HTTP streaming.

"FM" Quality (32kbps)

Town and Country 1.03MB | 87 files | 5,825 streams

Your Submarine Gown 1.06MB | 84 files | 5,660 streams

"CD" Quality (64kbps)

Town and Country 2.04MB | 43 files | 2,898 streams

Your Submarine Gown 2.10MB | 42 files | 2,857 streams

Town and Country

Oh I think I must be thick
The falling stars were falling quick
I held my ground like a fool in a downpour

I'd start but I don't know where to begin
The queen to be has traded in
Her dalliance with impermanence

I've been calling out your name all day
And slipping into fever dreams
If the meteors were working right
Then I'd be yours forever

Can you tell the wallpaper beneath the paint?
Or what's in the box by the ribbon?
Are brighter days intermittent?

All the stuff that I own is breaking down
The stereo, the rocking chair
The keep in touch who come untethered

I've been calling out your name all day
And slipping into fever dreams
If the meteors were working right
Then I'd be yours forever

Ragtag is nowhere faster to there and then
But now it's all slow down to town and country
Remember when we were friends

I've been calling out your name all day
And slipping into fever dreams
If the meteors were working right
This wouldn't be a leap of folly
Detonate your dynamite
And I'll be yours forever

Your Submarine Gown

Note: These are not the right lyrics. I hope to post the right ones soon.

By the big container
Another frozen moment

We were exploding
All the stars in the sky
When I realized that the whole thing turns upon
Your submarine gown
Ay yi yi yi yi yeah
Your submarine gown
Ay yi yi yi yi yeah

In the basement
Of the holy rollers
They really turn around you like the sun
To my amazement
It's a quarter to five
I touch the hem and the colors start to run
On your submarine gown
Ay yi yi yi yi yeah
Your submarine gown
Ay yi yi yi yi yeah

We were
We were
Every second brings another

We were floating
I thank God I'm alive
And I realize that it all depends upon
Your submarine gown
Ay yi yi yi yi yeah
Your submarine gown
Ay yi yi yi yi yeah

Summary: "Town and Country"
Specs RealAudio mp3 Ogg Vorbis WMA
Low High Min Low Avg High Min Low Avg High Low Avg
Notes: Files refers to the number of files that can be stored in 90MB; Streams refers to the number of streams that can be served in 6GB of bandwidth.
Kbps 34 225 32 64 128 192 45 64 112 192 32 64
MB 1.04 5.63 1.25 2.50 4.05 6.16 1.46 1.91 3.20 5.42 1.03 2.04
Files 86 15 72 36 22 14 61 47 28 16 87 43
Streams 5,769 1,065 4,800 2,400 1,481 974 4,109 3,141 1,875 1,107 5,825 2,898
Summary: "Your Submarine Gown"
Specs RealAudio mp3 Ogg Vorbis WMA
Low High Min Low Avg High Min Low Avg High Low Avg
Notes: Files refers to the number of files that can be stored in 90MB; Streams refers to the number of streams that can be served in 6GB of bandwidth.
Kbps 34 225 32 64 128 192 45 64 112 192 32 64
MB 1.06 5.78 1.28 2.58 4.14 5.64 1.50 1.97 3.21 5.18 1.06 2.10
Files 84 15 70 34 21 15 60 45 28 17 84 42
Streams 5,825 1,038 4,687 2,325 1,449 1,063 4,000 3,045 1,869 1,158 5,660 2,857

Preparing Files for HTTP Streaming

An Overview of the Entire Process:

  1. Start with a high quality audio file. Typically, this means a CDDA/Red Book file, a format invented by Sony and Philips in 1982. Never heard of it? CDDA refers to CD Digital Audio, the file format still used to store audio data on compact discs. Do not start with a file that has been converted from a compressed format, like mp3 or Ogg Vorbis, to a file that will play in a standard CD player. Start with a high-quality original.
  2. Use an audio extractor (often called a CD-ripper) to create a digital version of the audio file on your computer.
  3. Convert the digital version of the audio file into an audio format you wish to stream. Note that some audio extractors can convert CDDA files directly into web-appropriate audio formats. If this isn't an option, use an extractor to go from CDDA to .wav, then use an encoder to convert the .wav file to one of the above formats.
  4. Use a text editor to create metafiles that give information on the audio files. In the above examples, my links to audio streams point to small, format-appropriate text files (.ram for RealAudio, .m3u for mp3 and ogg vorbis, and .wax for Windows) that in turn point to the actual audio files.
  5. Post your audio files and metafiles to a web server.
    • If you wish to keep visitors from accessing your audio files without visiting your website, set permissions for the folder which holds your audio to Owner RWX, Group X, and Other X: chmod 711. If this makes no sense to you, read A quick and dirty chmod Tutorial.
    • If you wish to keep other web developers from linking directly to your audio files from links on their pages, include the following lines in your .htaccess file:

      RewriteEngine on
      RewriteCond %{HTTP_REFERER} !^$
      RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain.com/.*$ [NC]
      RewriteCond %{HTTP_REFERER) !^http://www.yourdomain.com/.*$ [NC]
      RewriteRule .*\.(ram|rm|m3u|ogg|wax|wma)$ - [F]

      Substitute your own domain where it says yourdomain above. If this makes no sense to you, read the Comprehensive guide to .htaccess.
  6. Link to the metafiles from a web page, e.g., a href="Town_and_Country_ogg_45kbps.m3u".
  7. Test your files in a variety of audio players.

How I Prepared RealAudio Files

  1. I extracted a .wav file from the CD with CDR Tools Front End (which uses the cdda2wav application), quality set to maximum.
  2. I used Helix Producer Basic to create the .rm file. Settings:
    • Audio Mode: Music
    • Video Mode: No Video
    • High Quality Resampler for Audio: Checked
    • Audience: I set Audience first to 56K Dial-up (34 kbps) only, and encoded a .rm file, then to 256K DSL or Cable (225 kbps) only, and encoded a second .rm file.
  3. I used my favorite text editor, EditPad Lite, to create .ram metafiles.

How I Prepared mp3 Files

  1. I downloaded Exact Audio Copy and installed it using the Quickstart Manual for EAC and Lame from The Coaster Factory.
  2. I started EAC and selected Action, then Test and Copy Selected Tracks, then Compressed, first with the settings on High (192kbps), then Low (128kbps). Settings are found under EAC, Compression Options, External Compression.
  3. For the lower quality mp3 files, I extracted a .wav file from the CD with CDR Tools Front End (which uses the cdda2wav application), quality set to maximum.
  4. I converted the .wav to mp3 with CDex, set first at 64kbps (VBR default, Bitrate Min 48kbps/Max 80kbps), then 32kbps (VBR default, Bitrate Min 32kbps/Max 40kbps). Like EAC, CDex employs the LAME encoding engine to convert WAV files to mp3.
  5. I used my favorite text editor, EditPad Lite, to create the .m3u metafiles.

How I Prepared Ogg Vorbis Files

  1. I extracted .wav file from the CD with CDR Tools Front End (which uses the cdda2wav application), quality set to maximum.
  2. I converted the .wav to Ogg Vorbis with CDex. To change from the LAME encoder (the CDex default) to the Ogg Vorbis encoder, I selected Options, then Settings, then Encoder, then Ogg Vorbis DLL Encoder.
  3. Before converting the .wav file to a compressed audio file (in this case, Ogg Vorbis), I set the Quality slide control to -1.00 (45kbps), then 0.00 (64kbps), then 3.00 (112kbps), then 6.00 (192kbps).
  4. I used my favorite text editor, EditPad Lite, to create the .m3u files.

How I Prepared Windows Media Files

  1. I extracted a .wav file from the CD with CDR Tools Front End (which uses the cdda2wav application), quality set to maximum.
  2. I selected the Convert a file Wizard, set my source file and destination folder, selected Web server (progressive download), then FM quality audio (CBR). I repeated the process with CD quality audio (CBR) for each song.
  3. I used my favorite text editor, EditPad Lite, to create the .wax files.

Resources

Extractors

Encoders

How to Create Metafiles

Players

Hosting Plans

Aside from its outstanding reliability and excellent customer service, I like VerveHosting because all accounts include access to a secure server and shopping cart software. I also think it's pretty neat that Verve's sysadmin runs cool sites like Christine's Genealogy Website and The Women's Basketball Server.

If storage or bandwidth becomes an issue it may be worth considering another host, such as the well respected tera-byte. Tera-byte's Unix 4U plan includes 200MB storage and 20GB/month transfer with a $99/annual contract, though tera-byte charges $160/year for a secure server certificate and shopping carts are not included (individual users are allowed to install their own).

For more information on VerveHosting, Tera-byte, and other hosts (there are hundreds of alternatives), visit the WebHosting Talk Forums.

Server-side Software

Other Resources

About the Site