Streaming MPEG-4 with Linux
Editors' Note: This article has been updated since its original posting.
Seven years ago, when I was still a clueless kid, I played my first video clip on the Internet using a 56k connection. It was in Real Media format and contained a video track in 11Kbps and a mono audio track. All the buffering drove me crazy. Today, with all sorts of high-speed lines, you seldom come across network congestion during playback of a streamed video clip. This new speed has enabled rapid development of multimedia on the Internet. One of them is video streaming.
What is video streaming? Traditionally, we must download the whole video file in order to play it. With streaming, video data sent to the streaming client is decoded and played immediately, as it is received. Implementations such as video conferencing, surveillance systems and video on demand (VOD) all are based on video streaming technology.
When people talk about video streaming, the first word that comes to mind is "expensive". Even if you are only converting existing media content, the software required for conversion might not be affordable for normal home users. One of the major reasons to use Linux for video streaming is it is inexpensive. Most Linux video encoding and streaming tools are free, and they are easy to set up. In less than an hour, one could have a streaming server serving a dozen of MPEG-4 clips. MPEG-4 allows encoding to happen at different bit rates and resolutions, while these are limited in some other codecs. The utmost advantage of using MPEG-4, of course, is it offers a standard format that is becoming more popular. Unlike proprietary formats, MPEG-4 is an open standard, so adding MPEG-4 support is easy. A few MPEG-4 audio and video players already are on the market, and more of them will be released in the future.
If you are streaming MPEG-4 clips, the setup is simple. You need only an MPEG-4 streaming server with a fast connection. A DSL line would be enough if you are serving only a few buddies. If you want to implement video conferencing or surveillance systems, though, you need a live MPEG-4 encoder and a compatible video capturing device under Linux. Of course, boards are on the market that encode video to MPEG-4 on-fly, but they are generally quite expensive for home users. Under Linux, the MPEG4IP suite, the FFmpeg multimedia system and Apple's Darwin Streaming Server offer an inexpensive way to stream and create MPEG-4 content.
The MPEG4IP project began in summer 2000 by David Mackie, who works on multimedia streaming for Cisco Systems. He is no longer active on the project and Bill May is now the main developer. The project is licensed under Mozilla Public License 1.1, but the codecs used in MPEG4IP are subject to patent royalties depending on how they are used. You should read the COPYING file in the package before using them. Licensing fees also are associated with MPEG-4, including a per-stream charge. People who plan to go commercial should check it out first.
In the MPEG4IP box are handy tools that can help you encode and play MPEG-4 clips. You may get your copy from mpeg4ip.sourceforge.net/ or from its CVS on SourceForge. While I was writing this article, 0.9.7 was the latest stable release. If you would like to try out new features, get release 0.9.7.7 from the CVS repository. You also need the LAME package if you are compiling mp4live (enabled by default), the live MPEG-4 encoder for live broadcasting. Extract the package and begin compiling:
tar zxvf mpeg4ip-0.9.7.tar.gz ./bootstrap make make install
To compile without mp4live (and LAME) add --disable-mp4live after ./bootstrap. MPEG4IP uses a modified version of the SDL library, so you do not need to bother installing it. You do need the GTK+ library, though, if you want to compile the GUI player.
The FFmpeg Multimedia System itself is a complete solution for creating and streaming MPEG-4. When this article was written, the stable release was 0.4.6. The streaming server supports only HTTP streaming at this stage, so we take advantage of FFmpeg, the encoder, at the moment. Get the source from SourceForge and begin compilation:
tar zxvf ffmpeg-0.4.6.tar.gz ./configure make make install
This configuration is sufficient for encoding MPEG-4 video. If you want MP3 and OggVorbis encoding support, add --enable-mp3lame and --enable-vorbis and install their respective libraries beforehand.
- Promise Theory—What Is It?
- Integrating Trac, Jenkins and Cobbler—Customizing Linux Operating Systems for Organizational Needs
- Tech Tip: Really Simple HTTP Server with Python
- New Products
- Linux In Government: Interoperability
- Examining Load Average
- Validate an E-Mail Address with PHP, the Right Way
- Virtualization Poll
- EdgeRouter Lite