Streaming – Music and Movies on Demand

Streaming technology has made listening to music or watching movies on the Internet as easy as turning on the radio or TV. Here’s how the technology works.

The first music and movie files you could find on the Internet were just short clips because you had to download the whole file before you could play it. Nowadays, however, you can start playing the file as soon as the first bytes begin to arrive… thanks to streaming.

This immediacy is possible because streaming does not send files on the Internet the same way as most other files are sent. It uses a different protocol.

User Database Protocol

A protocol is a set of rules defining how two computers connect with each other and how they send each other data.

Most data that is sent through the internet is first broken up into packets (small blocks of data). The packets are sent separately and are the rejoined at their destination so that the receiver gets the whole file.

The sending of most data on the Internet is governed by a set of rules called the Transmission Control Protocol (TCP). Streaming however uses the User Database Protocol (UDP).

These two protocols are quite different. The crucial difference is in how they check for errors.

If one packet gets damaged when downloading is being controlled by TCP, downloading will be suspended while that packet is resent. That way, once the download has been completed, you can be sure that you have the entire data file.

When you are streaming files, however, UDP allows packets to get lost now and then without interrupting the downloading. This is fine because, when an occasional packet is lost, you are unlikely to notice any interruption to the music or movie. But if everything froze very briefly while a lost packet was being resent, you probably would notice the interruption.

With streaming technology, you don’t have to wait for files to be downloaded entirely before you can begin listening to audio or watching a video. You can listen to a concert on the other side of the world in real time, make a video call or watch a movie just like on TV.

Here’s how.

Listening to music

Streaming audio, or listening to music or speech on the Internet, is bringing joy to many. How audio streaming works is easy to understand.

When you click on a link to an audio file, your web browser will contact the relevant server on the Internet. The server will then send a metafile to your browser.

Metafile is a general term for a file format that can store multiple types of data.

The metafile will tell your browser where it can find the audio file you are looking for. This may be on the same or a different server. The metafile will also deliver instructions on the type of audio file that will be delivered and how it should be played. The file will tell the browser to launch the particular audio player needed to play the sound file.

The player that you need will be a plug-in, an app or mini-program designed to work with a particular browser such as Chrome, Internet Explorer or Firefox. Well-known plug-ins for browsers include Adobe Flash Player, QuickTime Player and Java.

If your browser does not have the particular plug-in needed to play the sound file you want to hear, you’ll have to download and install it before you can listen to the audio.

Once it’s ready to go, the plug-in will contact the audio server that is going to send the audio file and will tell it how fast your Internet connection is. The audio server will use this information to decide which version of the audio file it will begin sending.

If you have a fast connection, ie, you have plenty of bandwidth, the audio server can send you a high-quality sound file. However, if your connection is slow, it will send a lower-quality sound file.

Once it knows which version of the sound file to send, the server uses the UDP rules to send the audio in a series of packets.

Buffering

A buffer is a part of a physical memory device where data is stored temporarily. For audio and video files, it is a section of your computer’s RAM (random access memory) where the data can go in and out quickly.

When the sound packets arrive at your computer, they are decompressed and decoded, and placed in the buffer in RAM. This buffer can hold a few seconds of sound.

Once the buffer is full, the audio player starts using your computer’s sound card to turn the data into music, voices and other sounds. As the audio is played, the data in the buffer empties while the audio server continues to refill the buffer by sending the rest of the sound file.

The flow of the audio data through the buffer can go on indefinitely. However, the flow can be interrupted occasionally when, for example, the buffer has not received enough data to replenish it.

This can happen if the speed of our connection starts to drop or Internet traffic suddenly becomes very heavy. The buffer can also end up empty if you are processing other files or otherwise using up a lot of your computer’s resources, while you are listening to music.

When the buffer empties, the audio will pause for a few seconds while the buffer is being refilled. Once the buffer is full again, playing will resume.

The effect of a pause on your listening pleasure will depend on the source of the sound file. If you are listening to music being broadcast in real-time, ie as a concert is actually taking place, you will miss a little bit of the music. But if the sound source is a pre-recorded concert, the music will resume from the point where it stopped.

Watching a movie

Streaming video works in a similar way to streaming audio, except that the video has to be divided into its separate audio and video components when it is in the buffer in the RAM.

The server that holds the video for streaming will have a video capture expansion card which can capture either a live feed from a video camera or a pre-recorded video. The capture board turns the analogue signals it receives into digital data and compresses it.

At the same time, it employs a trick to avoid having to capture more data than it needs in order to make transmission easier.

When the camera used to record the video is stationary, ie, it is not panning, the amount of data created can be reduced. This can be done because all moving images are made up of a series of frames (still images) that change in rapid succession to give the illusion of continuous movement. The rate is usually 30 frames a second which gives the video a smooth look.

The compression system reduces the number of frames needed by comparing adjacent frames and only taking account of pixels that change from one frame to another. It does this by establishing what the background looks like.

As long as the camera remains still, only the changes in the frame, such as the movement of the actors, have to be transmitted. The background only has to be transmitted again once the camera starts to pan and the background changes.

Video streaming will also skip frames when your Internet link is slow, which may make the video jerky. Thus the faster your connection, the smoother the video will be.

When your computer receives the video signals, it will decompress them and load them into a small buffer in RAM as it does for audio.

At this point the signals are split into separate video and audio components which are sent to the video card and sound card respectively, whence they are output to your monitor and speakers so you can watch the movie and hear the sound-track.

Entertainment on demand

We’ve come a long way since the Internet began as a text-only medium. Though streaming technology is relatively young, millions of users flock to streaming sites every day to watch and record all sorts of multi-media.

Thanks to streaming, you can listen to good music… attend a lecture… watch the finals of the 6-nations cup or a baseball game… get training in a practical skill… attend a conference… make a video call… watch breaking news… and so on… in real-time as it happens.