How Streaming Video and Audio Work

New hotness: Entire episodes of television shows streamed directly to your computer.
New hotness: Entire episodes of television shows streamed directly to your computer.

In the early days of streaming media -- the mid-to-late 1990s -- watching videos and listening to music online wasn't always fun. It was a little like driving in stop-and-go traffic during a heavy rain. If you had a slow computer or a dial-up Internet connection, you could spend more time staring at the word "buffering" on a status bar than watching videos or lis­tening to songs. On top of that, everything was choppy, pixilated and hard to see.

Streaming video and audio have come a long way since then. According to Bridge Ratings, 57 million people listen to Internet radio every week. In 2006, people watched more than a million streaming videos a day on YouTube [source: Reuters]. The same year, television network ABC started streaming its most popular TV shows over the Web. People who missed an episode of shows like "Lost" or "Grey's Anatomy" could catch up on the entire thing online -- legally and for free.

­

­The success of streaming media is pretty recent, but the idea behind it has been around as long as people have. When someone talks to you, information travels toward you in the form of a sound wave. Your ears and brain decode this information, allowing you to understand it. This is also what happens when you watch TV or listen to the radio. Information travels to an electronic device in the form of a cable signal, a satellite signal or radio waves. The device decodes and displays the signal.

In streaming video and audio, the traveling information is a stream of data from a server. The decoder is a stand-alone player or a plugin that works as part of a Web browser. The server, information stream and decoder work together to let people watch live or prerecorded broadcasts.

In this article, we'll explore what it takes to create this stream of ones and zeros as well as how it differs from the data in a typical download. We'll also take a look at how to make good streaming media files.

Finding and Playing Streaming Video and Audio

A video for "The Mesopotamians" by They Might Be Giants plays in an embedded Flash player at stereogum.com.
A video for "The Mesopotamians" by They Might Be Giants plays in an embedded Flash player at stereogum.com.

If you have a connection to the Internet and you want to find streaming video and audio files, you shouldn't have to look far. Sound and video have become a common part of sites all over the Web, and the process of using these files is pretty intuitive. You find something you want to watch or hear -- you click it, and it plays. Unless you're watching a live feed or a webcast, you can often pause, back up and move forward through the file, just like you could if you were watching a DVD or listening to a CD.

But if you've never used streaming media, your computer may need a little help to decode and play the file. You'll need a plugin for your Web browser or a stand-alone player. Most of the time, the Web page you've visited points you in the right direction. It prompts you to download a specific player or shows you a list of choices.

These players decode and display data, and they usually retrieve information a little faster than they play it. This extra information stays in a buffer in case the stream falls behind. There are four primary players, and each one supports specific streaming file formats:

  • QuickTime, from Apple, plays files that end in .mov.
  • RealNetworks RealMedia plays .rm files.
  • Microsoft Windows Media can play a few streaming file types: Windows Media Audio (.wma), Windows Media Video (.wmv) and Advanced Streaming Format (.asf).
  • The Adobe Flash player plays .flv files. It can also play .swf animation files.

For the most part, these players can't decode one another's file formats. For this reason, some sites use lots of different file types. These sites will ask you to choose your preferred player or pick one for you automatically.

The QuickTime, RealMedia and Windows Media players can work as stand-alone players with their own menu bars and controls. They can also work as browser plugins, which are like miniature versions of the full-scale player. In plugin mode, these players can look like an integrated part of a Web page or pop-up window.

Flash video is a little different. It usually requires a Flash applet, which is a program designed to decode and play streaming Flash files. Programmers can write their own Flash applets and customize them to fit the needs of a specific Web page. Flash is becoming a more popular option for playing streaming video. It's what YouTube, Google Video and the New York Times all use to display videos on their sites. The video below, which demonstrates what would happen if you shot your TV, plays in a Flash applet.

Regardless of whether it's an applet or a fully functional player, the program playing the streaming file discards the data as you watch. A full copy of the file never exists on your computer, so you can't save it for later. This is different from progressive downloads, which download part of a file to your computer, then allow you to view the rest as the download finishes. Because it looks so much like streaming media, progressive downloading is also known as pseudo-streaming.

These players and applets do what many applications do -- they play files. We'll look at these files and how they travel to your computer in the next section.

Streaming Files

OK Go's video for the song "Here it Goes Again" plays in a small window on YouTube.
OK Go's video for the song "Here it Goes Again" plays in a small window on YouTube.

Streaming video and audio files are compact and efficient, but the best ones start out as very large, high-quality files often known as raw files. These are high-quality digital files or analog recordings that have been digitized, and they haven't been compressed or distorted in any way. Although you can watch a streaming file on an ordinary tv, editing the raw file requires lots of storage space and processing power.

It might seem strange that a file that ends up nimble and efficient started out large and unwieldy. The reason is that the compression process, required to make an ordinary file into a streaming file, lowers the file's quality. During compression, blurry, low-quality videos or hard-to-hear audio recordings will only get worse.

Fortunately, before you even compress a file, you can reduce its size without lowering its quality:

  • Make the picture smaller: Most streaming videos don't fill the whole screen on a computer. Instead, they play in a smaller frame or window. If you stretch many streaming videos to fill your screen, you'll see a drop in quality.
  • Reduce the frame rate: A video is really a series of still images. The frame rate is how quickly these images move from one to the next. A lower frame rate means fewer total images and less data needed to recreate them. The reduction in frame rate is why some streaming videos flicker -- the frame rate is slow enough that your eye and brain sense the transitions between pictures.
In YouTube's full-screen mode, the picture is fuzzier and more pixilated.

For both video and audio files, making the files even smaller requires codec, or compression/decompression software. Codecs discard unnecessary data, lower the overall resolution and take other steps to make the file smaller. Different codecs also create specific types of files, which work on specific streaming players.

The total reduction in quality depends on a number of factors, including the bitrate, or the speed of the transfer from the server to a computer. For example, the bitrate of a television broadcast is about 240,000 kilobits per second (Kbps), but the bitrate of a dial-up Internet connection is a maximum of 56 Kbps. Someone with a reliable broadband connection with lots of bandwidth can watch high-bitrate files, but someone using a dial-up modem needs to watch at a much lower bitrate. The basic idea is to encode a file that's large enough to look or sound good but small enough to work with the available bandwidth. Some codecs let you create files that will stream differently at different transfer rates, accommodating different connection types. This is known as multi-bitrate encoding.

Once a file is edited, compressed and encoded, it's uploaded to a server. We'll look at the server's role in streaming media in the next section.

Streaming Servers

If you work in an office that shares files over a network, you might think of a server as a computer that holds lots of data. But when it comes to streaming video and audio, a server is more than just a massive hard drive. It's also the software that delivers data to your computer. Some streaming servers can handle multiple file types, but others work only with specific formats. For example, Apple QuickTime Streaming Server can stream QuickTime files but not Windows Media files.

Streaming servers typically deliver files to you with a little help from a Web server. First, you go to a Web page, which is stored on the Web server. When you click the file you want to use, the Web server sends a message to the streaming server, telling it which file you want. The streaming server sends the file directly to you, bypassing the Web server.

All of this data gets to where it needs to go because of sets of rules known as protocols, which govern the way data travels from one device to another. You've probably heard of one protocol -- hypertext transfer protocol (HTTP) deals with hypertext documents, or Web pages. Every time you surf the Web, you're using HTTP.

Many protocols, such as transmission control protocol (TCP) and file transfer protocol (FTP), break data into packets. These protocols can re-send lost or damaged packets, and they allow randomly ordered packets to be reassembled later. This is convenient for downloading files and surfing the Web -- if Web traffic slows down or some of your packets disappear, you'll still get your file. But these protocols won't work as well for streaming media. With streaming media, data needs to arrive quickly and with all the pieces in the right order.

Too many outgoing streams can overload a server, causing users to see an error message.

For this reason, streaming video and audio use protocols that allow the transfer of data in real time. They break files into very small pieces and send them to a specific location in a specific order. These protocols include:

  • Real-time transfer protocol (RTP)
  • Real-time streaming protocol (RTSP)
  • Real-time transport control protocol (RTCP)

These protocols act like an added layer to the protocols that govern Web traffic. So when the real-time protocols are streaming the data where it needs to go, the other Web protocols are still working in the background. These protocols also work together to balance the load on the server. If too many people try to access a file at the same time, the server can delay the start of some streams until others have finished.

Step-by-step Streaming

Using streaming media files is as easy as browsing the Web, but there's a lot that goes on behind the scenes to make the process possible:

  1. Using your Web browser, you find a site that features streaming video or audio.
  2. You find the file you want to access, and you click the image, link or embedded player with your mouse.
  3. The Web server hosting the Web page requests the file from the streaming server.
  4. The software on the streaming server breaks the file into pieces and sends them to your computer using real-time protocols.
  5. The browser plugin, standalone player or Flash application on your computer decodes and displays the data as it arrives.
  6. Your computer discards the data.

All of this requires three basic components -- a player, a server and a stream of data that are all compatible with each other.

Creating and distributing a streaming video or audio file requires its own process:

  1. You record a high-quality video or audio file using film or a digital recorder.
  2. You digitize this data by importing it to your computer and, if necessary, converting it with editing software.
  3. If you're creating a streaming video, you make the image size smaller and reduce the frame rate.
  4. A codec on your computer compresses the file and encodes it to the right format.
  5. You upload the file to a server
  6. The server streams the file to users' computers.

Because of advances in home computers and software, it's become easier for people to create their own streaming videos at home. Most people can't afford to purchase and maintain their own streaming servers and instead pay a service provider to host the videos. But the increased availability of streaming video has also created some challenges. One is copyright. It's easier than ever to illegally copy TV shows or other videos and post them on the Web, and legal action from copyright owners has become more common.

Another challenge has to do with royalties. Streaming video has changed the way people watch TV shows and movies, and some actors, writers and other entertainment industry workers claim they aren't being paid as they would for TV broadcasts or theater screenings. In addition, in March 2007, the U.S. Copyright Royalty Board changed its royalty structure, making Internet radio far more expensive to produce than it had been.

In spite of these complications, the world of streaming video and audio continues to grow. In the next few years, Internet TV, Internet radio and other streaming applications may become real competitors against traditional media.

If you'd like to learn more about streaming video, streaming audio and related topics, you'll find lots of resources on the next page.

Related HowStuffWorks Articles

More Great Links

Sources

  • Adobe. "A Streaming Media Primer." (10/5/2007) http://www.adobe.com/products/aftereffects/pdfs/AdobeStr.pdf
  • Klass, Brian. "Streaming Media in Higher Education: Possibilities and Pitfalls." 5/30/2003 (10/5/2007) http://campustechnology.com/articles/38707/
  • Larson, Lisa. "A Crash Course in Flash Video." StreamingMedia.com. 9/24/2007 (10/5/2007) http://www.streamingmedia.com/article.asp?id=9711&c=8
  • Media College. "Introduction to How to Create Streaming Video." (10/5/2007) http://www.mediacollege.com/video/streaming/overview.html
  • Reuters. "YouTube Serves Up to 100 Million Videos a Day." USA Today. 7/16/2006 (10/5/2007). http://www.usatoday.com/tech/news/2006-07-16-youtube-views_x.htm
  • Steinmetz, Mike. "Streaming Media." (10/5/2007) http://www.digitalwebcast.com/Htm/Tutorials/streaming/streaming.htm
  • StreamingMedia.com. "Understanding Streaming Media Protocols." 2/2/2003 (10/5/2007) http://www.streamingmedia.com/article.asp?id=8291&c=1
  • University of Wisconsin. "Understanding Streaming Media." (10/5/2007) http://streaming.wisconsin.edu/understand/understand.html