Streaming MPEG-4 with Linux | Linux Journal

来源:百度文库 编辑:神马文学网 时间:2024/04/19 14:04:26

Streaming MPEG-4 with Linux

Mar 13, 2003  By Donald Szeto  inInternet video for the next generation.

Editors' Note: This article has beenupdated since its original posting.

Seven years ago, when I was still a clueless kid, I played myfirst video clip on the Internet using a 56k connection. It was inReal Media format and contained a video track in 11Kbps and a monoaudio track. All the buffering drove me crazy. Today, with allsorts of high-speed lines, you seldom come across networkcongestion during playback of a streamed video clip. This new speedhas enabled rapid development of multimedia on the Internet. One ofthem is video streaming.

What is video streaming? Traditionally, we must download thewhole video file in order to play it. With streaming, video datasent to the streaming client is decoded and played immediately, asit is received. Implementations such as video conferencing,surveillance systems and video on demand (VOD) all are based onvideo streaming technology.

When people talk about video streaming, the first word thatcomes to mind is "expensive". Even if you are only convertingexisting media content, the software required for conversion mightnot be affordable for normal home users. One of the major reasonsto use Linux for video streaming is it is inexpensive. Most Linuxvideo encoding and streaming tools are free, and they are easy toset up. In less than an hour, one could have a streaming serverserving a dozen of MPEG-4 clips. MPEG-4 allows encoding to happenat different bit rates and resolutions, while these are limited insome 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 addingMPEG-4 support is easy. A few MPEG-4 audio and video playersalready are on the market, and more of them will be released in thefuture.

If you are streaming MPEG-4 clips, the setup is simple. Youneed only an MPEG-4 streaming server with a fast connection. A DSLline would be enough if you are serving only a few buddies. If youwant to implement video conferencing or surveillance systems,though, you need a live MPEG-4 encoder and a compatible videocapturing device under Linux. Of course, boards are on the marketthat encode video to MPEG-4 on-fly, but they are generally quiteexpensive for home users. Under Linux, the MPEG4IP suite, theFFmpeg multimedia system and Apple's Darwin Streaming Server offeran inexpensive way to stream and create MPEG-4 content.

Compiling and Installing MPEG4IP

The MPEG4IP project began in summer 2000 by David Mackie, whoworks on multimedia streaming for Cisco Systems. He is no longeractive on the project and Bill May is now the main developer. Theproject is licensed under Mozilla Public License 1.1, but thecodecs used in MPEG4IP are subject to patent royalties depending onhow they are used. You should read the COPYING file in the packagebefore using them. Licensing fees also are associated with MPEG-4,including a per-stream charge. People who plan to go commercialshould check it out first.

In the MPEG4IP box are handy tools that can help you encodeand play MPEG-4 clips. You may get your copy frommpeg4ip.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 outnew features, get release 0.9.7.7 from the CVS repository. You alsoneed the LAMEpackage if you are compiling mp4live (enabled by default),the live MPEG-4 encoder for live broadcasting. Extract the packageand begin compiling:

tar zxvf mpeg4ip-0.9.7.tar.gz./bootstrapmakemake install

To compile without mp4live (and LAME) add--disable-mp4live after./bootstrap. MPEG4IP uses a modified version ofthe SDL library, so you do not need to bother installing it. You doneed the GTK+ library, though, if you want to compile the GUIplayer.

Compiling and Installing FFmpeg

The FFmpeg Multimedia System itself is a complete solutionfor creating and streaming MPEG-4. When this article was written,the stable release was 0.4.6. The streaming server supports onlyHTTP streaming at this stage, so we take advantage of FFmpeg, theencoder, at the moment. Get the source from SourceForge and begincompilation:

tar zxvf ffmpeg-0.4.6.tar.gz./configuremakemake 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 respectivelibraries beforehand.

  • 1
  • 2
  • 3
  • 4
  • next ›
  • last »