If you want to understand video streaming over the Internet, you must first have a solid grasp on what a Streaming Server is, and how it works. This article provides a simple overview of the entire chain of events, and is written for the absolute newbie.
Entering a foreign country
Imagine getting off the plane and walking into an airport terminal. You enter a huge hall labelled ‘Immigration’. There are many desks at the far end, and you are expected to join the queue at the ‘appropriate’ desk. If you don’t, you will be shot and killed, and must be born again and make the same trip, again.
To help you a bit, above each desk is a sign that displays options for the purpose of your visit: Business, Pleasure, Terrorism, etc. They really have their bases covered.
You are here on vacation, so you join the queue and finally arrive at the ‘Pleasure’ desk, where an ugly officer welcomes you with a frown – surely a foreboding of what’s in store ahead. You smile, because you’re here to enjoy yourself. You remark on how nice the weather is, blah blah.
He doesn’t care. He asks: “What’s the purpose of your visit?”
The smile on your face is wiped out. This is the point when you realize if you gave the wrong answer you’ll be shot. You manage to squeak: “Pressure…I mean, pleasure, officer. If I’m in the wrong queue I’m terribly…”
You hand him your passport. Do they confiscate your passport and then shoot you?
“Where’s your visa?”
You show it to him. He studies it like it’s a photograph of his dead cat. He regretfully picks up his stamp, and with an emotional intensity befitting his grievance at his cat’s untimely demise, he stamps your visa. The noise is so loud you suffer a minor heart attack, and the person behind you thinks you’ve been shot (He’s in the wrong queue, you see).
The officer hands you back your passport, and then smiles. “Hope your stay is pleasurable!”
End of story. The point is, there are three things that must be unique to you, and these are non-negotiable:
- Passport (IP address)
- Visa (Protocol)
- Purpose of your visit (Port number)
IP address, protocol and the port number
The IP address is a unique identity number for every computer (server) connected to the Internet. At any given time, a computer can have one and only one IP address. If you’re on a shared Internet connection, the next time you log in you might have a different IP address, but you’ll only have one at any given point.
This makes the IP address analogous to your passport, which is also unique (unless you’re Bourne).
Different cultures have different ways of doing things. When two cultures meet, they must have a set of rituals that explicitly display their ability to be friends with each other. A handshake is one such gesture. A peck on the cheek is another. A kick in the groin is third, and so on.
This is a protocol. In Internet-speak, a Protocol is a mix between a ritual and a language. You must speak the same language, and you must display the same set of rituals – like a Michael Jackson music video.
And protocols have to be strictly enforced. You can’t tattoo your visa on to your buttocks, it has to be where it belongs.
Finally, the purpose of your visit dictates the kind of ‘treatment’ you’re going to get. If you want a foot massage you’re not going to your dentist. You better go through the right ‘gateway’, and that in Internet-speak is a Port. The first time I heard the word ‘port’, I actually looked behind my computer case to see if there’s a physical port or something. The fact of the matter is, a port is a software thing, sort of like a guest list for a party.
How do these three things come together? That’s what the next part is about.
The client-sever relationship
On the Internet, if you’re not a client, then you’re a server. You either want something (client) or you have something that others want (server). You could be both at the same time (or at different times). If you’re connected to the Internet but not using it, you can be neither.
Don’t let the word ‘relationship’ fool you. It’s strictly business, and usually starts with you, the client, making a request to the server for something, and then being at the server’s mercy.
So, you’re a client who’s anxious to get into this cool nightclub because your friends are in there with this hot girl you want to meet. The nightclub is the entire Server (hardware and software put together). You’d better:
- Have an ID (IP address)
- Have your name on the guest list (Port number)
- Be dressed to kill (Protocol)
If you’re missing any of the above, you get shot down, and must repeat the process from scratch again. The bouncer is the dude who makes the final call. He’s the operating system that holds the guest list (list of port numbers), and your protocol must be congruent with your purpose. Your purpose must be something the server wants to handle. What the server offers, is a service. A night club offers many services (dance floor, music, F&B, rest rooms, important vending machines, etc.), and most nightclubs give you access to all services once you enter.
Some nightclubs, though, have different ‘levels’ for different folks. To get into one, you must have a set of unique values for your IP address, Port number and Protocol. Nobody else can have the same set of values at the same time. Without this, you can’t enter the server, let alone receive any service.
This process, of clients sending an IP address, Port number and Protocol along with its request, and the server accepting the information as true, is called Binding. It’s only after this stage that any information transfer can take place, which is what we’ll look at next.
The application (software) within the Server that can give you what you want is a Service. A server can hold many services. Some of the common ones are:
- Hypertext transfer (HTTP)
- File transfer (FTP)
- Email transfer (POP3, IMAP, SMTP)
- Chat (IRC)
The letters in brackets are protocols. Let’s come back to the meaning of protocol. It’s ritual+language.
The reason why we have many protocols is to ensure information isn’t passed to the wrong service. E.g., if a request from a client is in HTTP language+ritual, the application that only understands FTP will not understand the request, and won’t waste any time on it. However, this does not mean the FTP dude is free of stupid HTTP requests. For this reason, each protocol is given a secretary – the port number. The Internet, by standard and by years of habit, have assigned unique port numbers to certain protocols:
- 20 & 21: File Transfer Protocol (FTP)
- 22: Secure Shell (SSH)
- 25: Simple Mail Transfer Protocol (SMTP)
- 80: Hypertext Transfer Protocol (HTTP)
- 110: Post Office Protocol (POP3)
- 143: Internet Message Access Protocol (IMAP)
- 194: Internet Relay Chat (IRC)
- 443: HTTP Secure (HTTPS)
- 465: SMTP Secure (SMTPS)
So, if you’re making a request to view a web page (HTTP), you must also make that request with the right port number, which is usually 80. I say ‘usually’ because it’s not etched in stone. For this reason, these port numbers are called ‘well-known port numbers’. They’re like celebrities.
Port numbers serve an important function. They help the service focus only on pertinent requests while throwing out the gate-crashers. This speeds up the data transfer, and keeps things organized. Once your request is past the port number and in the hands of the service, all it has to do is speak the right language, the protocol.
The service (just software, an application) studies your request and then decides to respond. Just because you managed to get through doesn’t mean you get to roam in Wonderland. When the application responds though, it responds in the same protocol. So, if you request a web page via HTTP, your web page is delivered via HTTP. If you request email via IMAP, your email is delivered via IMAP, and so on.
The most important reason why protocols are different for different apps is because you can write a protocol to take advantage of a service’s unique needs. Sometimes, a handshake is fine. If two political leaders are meeting, then a more elaborate ritual is involved. Whatever gets the job done the quickest.
All right, then. The server has accepted your request, and delivers your data. Now, it’s back to you.
The browser or player
When data arrives back to your computer, it too, must treat your computer like a server. If you have a firewall or an anti-virus software set up to protect your computer, it will check the arriving information for the same things you were molested for: Port number, IP address and Protocol. It’d better be the same.
The ‘window’ through which you see what’s happening is a software (nothing to do with Microsoft Windows). The most common software we use to get data over the Internet is the browser. The browser is designed to read specific protocols. It’s like working in CinemaDNG. Some NLEs can’t read it natively, so you can’t open the file. Similarly, if you’re opening an HTTP file, a browser is your best tool for the job. Browsers not only get the data, they are also good at converting the information into a human readable form, a web page. Some browsers also scan data for malicious content.
Sometimes, a browser is not the best tool for the job. E.g., if you just want email, then an email application (like Outlook or Apple Mail, etc.) is better.
What about video? Is a video player better than a browser? Yes and no. A browser by itself is nothing. A modern browser offers more and more value with every passing update. At its most basic, a browser must read HTML and CSS, so it can display a web page correctly. Modern browsers must handle:
And so on. These are languages and rituals, just like protocols. But just like we designed protocols for speed and efficiency, these languages are also designed for whatever need they are meant to fulfill. One of the most important requirements for these browser-based languages are that they have to be human readable, so humans can write them when creating web pages.
Take the case of HTML. It must be able to display text, images, color, fonts, layouts, links, and many other things. With HTML5, it can also directly play back video, without the need for a player or plug-in.
Therefore, a browser capable of displaying HTML5 can play back video, which was sent over HTTP. What’s cool about this? Nothing has to change. All you need to do is update your browser to the latest version.
So, why do we need video players then? Many reasons, but some really important ones:
- HTML5 only supports some codecs, while good media players (like VLC) can read many kinds of videos.
- You can control videos better with media players.
- You can receive videos through other protocols and ports.
This last point is very important. If your port 80 is busy with HTTP, why burden it with video? It’s cool and dead simple to watch browser-based videos as a client, but is it the most efficient method? Nobody knows!
Wait a minute! This article is about streaming servers, but you passed on to browsers. Why?
My bad, lets go back to our server.
If you want to set up a streaming video business, you could start by buying a computer (server hardware), and then installing an application that is designed to stream video. Such an application is technically a service, but because the Internet already has a habit of confusing the word ‘server’ with ‘services’ (Apache, nginx, etc.), we can call this software program a Streaming Server.
Its job? To take requests from your clients, decide to honor them or not, and finally, to pass on video data (not web pages or email!) in real-time (that’s what streaming is all about). It can (and should) do a whole lot more, but this is its core function. So, if you are looking for good streaming servers to install, what names should you research? Here are a few:
- Wowza Media Server
- VideoLAN VLC
- Quicktime Streaming Server
- Adobe Media Server (Flash Media Server)
- Windows Media Services
- Telestream Wirecast
There are hundreds more. Each and every application comes with its own ‘baggage’, one of which is the protocol. Obviously, it stands to reason that a protocol must be invented just for video. Sadly, protocols are also invented to limit you. Here are some examples of protocols:
- Apple HLS (HTTP Live Streaming)
- RTMP, RTMPT, RTMPS, RTMPE, RTMPTE, Flash
- Adobe HTTP Dynamic Streaming (HDS)
- MS-WMSP (Windows Media HTTP Streaming Protocol), Windows Smooth Streaming, MMS, MMSH
- RTSP, RTP, UDP
- MPEG-DASH (HTTP)
Most of the common protocols in vogue today support streaming over HTTP. In fact, these protocols are just layers over HTTP, to make streaming video over HTTP work so the end user does not have to do anything (read: buy) special. However, for the person who is delivering streaming video, this ‘layer’ usually means ‘proprietary technology that is not interchangeable’. Not only do you pay extra for the privilege, you’ll have a horrific time changing everything if you don’t see eye-to-eye with them at a future date.
It’s your problem to solve.
All the big guns, Adobe, Apple, Microsoft, and MPEG support streaming via HTTP. There are a host of challenges in streaming video over HTTP, but that’s for another day.
Basically, a streaming server must support the most number of protocols, in addition to other things like codecs, bit rates, operating systems, DRM, switching, etc. The primary feature is definitely the kind of protocols it supports, because that’s what decides which devices the stream can be played back on. To read more about streaming, head over to the following topics:
- What is adaptive streaming?
- How to broadcast on the Internet (Three parts)
- What is MPEG-DASH?
- What is video encryption and should you care about DRM?
- Chapter on streaming from the Comprehensive Guide to Rigging ANY Camera
I hope this simple explanation has helped you understand the basic ideas that govern the need for a streaming server. If all this confuses you, don’t worry. The world is just making it all up as it goes along.