Streaming MPEG-4 with Linux
March 13th, 2003 by Donald Szeto in
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.
Here at my school video clips are stored in different formats. This is likely to be the case in most situations--you do not need to convert only one format to MPEG-4 but many formats. Some of my fellow video team members store the clips in MPEG-1 and 2, some of them in DivX or XviD AVI and some use DV AVI if they do not have time to encode. Here, we discuss how we encode these formats to MPEG-4, as they are likely to be the most common formats we might come across.
No single tool with a single button can do all the encoding work well for you. You need to encode the video and audio separately, so the first thing to do is split up the video and audio. Under Linux, FFmpeg is a Swiss knife for video processing. It encodes and decodes various video formats and supports some basic video processing, such as de-interlacing. To extract the audio track from the source, type:
ffmpeg -i <input_file> -vn <output_file>
The command can be applied to both DV/DivX/XviD AVI and MPEG files. The vn switch disables video in the output file. The resulting file would be a raw PCM audio file.
To generate an MPEG-4 complaint clip, you need MPEG-4 AAC audio. The MPEG4IP suite includes a redistributed AAC encoder called FAAC. At the of this writing, FAAD2 is available on SourceForge and uses the version 1.1 library for encoding, which is a bit faster. If you are interested, you can grab the source from faac.sourceforge.net. A copy of the FAAC binary should have been installed properly when you were installing the MPEG4IP suite.
To encode the raw PCM audio track split by FFmpeg, type:
faac -m4 -b64 -r48000 -pLC <input_file> <output_file>
The -m flag specifies the AAC MPEG version. We are creating MPEG-4 AAC so we use -m4. The -b flag specifies the bit rate for the encoded output. A value of 32 or 64 produces satisfactory quality and is an economical size for streaming. The -r flag specifies the sampling rate of the input file; otherwise, FAAC would not read the file. Instead, it would produce an error notifying the user that the file format is not supported. The last -p flag, which specifies the profile, is a bit more complicated. The Main profile includes all the coding tools (an MPEG term understood as "features"). The LC profile, which stands for low complexity, reduces decoding complexity on the client side (for slow devices or machines). The LTP profile, which stands for long term prediction, provides significant improvement in quality but also increases decoding complexity. It is best used for audio tracks with clear pitch. I use LC most of the time for my school's MPEG-4 clips.
MPEG4IP suite comes with two encoders, mp4encode and xvidenc. mp4encode encodes an AVI file to an MPEG-4 video clip with its built-in OpenDivX encoder or ISO MPEG-4 encoder, if specified. xvidenc, on the other hand, encodes raw video file with the XviD encoder. If you encode with these utilities, the input AVI file must contain a video track in raw YV12 (YUV12) format, and the audio track must be in raw PCM format. In this article, instead, I show how we can use FFmpeg to simplify the video encoding process. Because FFmpeg decodes DV, MPEG-1 and 2, DivX and XviD, we can skip the step of preparing YV12 raw for mp4encode or xvidenc. The command for encoding from these formats to ISO MPEG-4 video is the same:
ffmpeg -i <input_file> -an -b 300 -vcodec mpeg4 <output_file>
FFmpeg then encodes the input file without audio (the -an flag) at 300 kilobits/second, using the ISO MPEG-4 encoder to an AVI video file containing a single MPEG-4 video track. If you want to perform inverse telecine (IVTC) for NTSC source under Linux, you would need transcode, another nice program suite that provides useful video processing functionalities. It also is possible to encode the video in 2-pass mode to get the best result.
1st pass:
ffmpeg -i <input_file> -an -pass 1 -passlogfile <log_file> -qscale 2 -vcodec mpeg4 <output_file>
2nd pass:
ffmpeg -i <input_file> -an -pass 2 -passlogfile <log_file> -b 300 -vcodec mpeg4 <output_file>
The input file, the output file and the log file in both passes must be the same. Also, you should specify your desired bit rate during the second pass instead of the first.
After encoding the audio and video, it is time to combine them to create a real MPEG-4 clip. The MPEG4IP suite provides a nice tool called mp4creator for this purpose. It can add or remove tracks in an MPEG-4 file. But, let's first create the MPEG-4 clip by adding a video track:
mp4creator -c myvideo.avi -hint mytest.mp4
The -hint flag tells mp4creator to add an additional hint track for the video track. Hinting is required if you are streaming a clip with Darwin Streaming Server. If the mytest.mp4 file does not exist already, mp4creator creates it for you. To add an audio track, enter:
mp4creator -c myaudio.aac -hint -interleave mytest.mp4
Both commands perform a similar action. The second command introduced the -interleave flag, which creates an interleaved RTP payload format for the audio hint track. If you are using MP3 for your audio track (possibly not), ignore this flag as it supports only AAC. Finally, optimize the clip:
mp4creator -optimize mytest.mp4
This command optimizes the file layout, hence improving its speed during streaming. The rearranged MPEG-4 file contains control information at the beginning of the file, thereby enabling HTTP streaming of the file. To see a list of tracks in an MPEG-4 file, use:
mp4creator -list mytest.mp4
If you have a successful MPEG-4 clip, the list should look something like this (a clip currently being streamed at my school):
Track | Type | Info |
1 | video | MPEG-4 Simple @ L3, 30.030 secs, 299 kbps, 352x240 @ 29.97 fps |
2 | hint | Payload MP4V-ES for track 1 |
5 | audio | MPEG-4, 29.973 secs, 65 kbps, 48000 Hz |
6 | hint | Payload mpeg4-generic for track 5 |
7 | od | Object Descriptors |
8 | scene | BIFS |
Before putting the clip up to the streaming server, you should test it. The MPEG4IP suite comes with mp4player and gmp4player for playing locally stored or streamed MPEG-4 files. You should use gmp4player, as the console player provides little control of video playback. If everything looks fine, upload the MPEG-4 file to your streaming server's media directory. Hurray! Your video is ready to be streamed over the net!
Starting from its fourth version, the Darwin Streaming Server does not stream only QuickTime movies but also MPEG-4 ones. The benefit is Darwin Streaming Server is completely free for non-commercial use, and it runs under Linux smoothly with a small load.
To get a copy of the streaming server, go to the Darwin project page. You are required to have a valid APSL (Apple Public Source License) registration in order to download the binary or the source. Follow the instructions on the web site for details on how to obtain an APSL registration. Get the server binary for Linux (the web site shows Red Hat Linux 7.x), and proxy if you need to serve clients behind firewall. Uncompress the package to a local directory and begin the installation:
tar zxvf DarwinStreamingSrvr4.1.2-Linux.tar.gz cd DarwinStreamingSrvr4.1.2-Linux ./Install
Make sure you have Perl installed for the web-based administration interface. Install also Net::SSLeay and OpenSSL with a valid certificate if you want SSL support. The installation script automatically copies the files to suitable places and displays where they are copied to. It then asks you for an administrative user name and password, which is used later to log in to the web-based administration interface, where you can access most of the server's features.
Next, launch the administration interface using the Perl script streamingadminserver.pl. It launches Darwin Streaming Server if it is not already running. Point your favourite browser to the video server's port 1220, 1240 if you enabled SSL support. Log in with the account you set during the installation. As this is your first time logging in, you are presented with the Setup Assistant. It guides you through the basic settings with detailed descriptions for each item. You need a valid SSL certificate to enable SSL support, unless you modify the script. After completing the Setup Assistant, you will have a running Darwin Streaming Server ready to flood the line with MPEG-4 videos.
Now you have an MPEG-4 clip on hand and ready to stream. One option is to stream it over HTTP; simply put the clip in a publicly accessible directory on your web server and point your player to the clip's URL. If you want to stream over RTSP, direct your player to rtsp://<server_name>/<clip_name>. (For example, rtsp://video.wyk.edu.hk/sample_100kbit.mp4 is a sample clip provided by Darwin Streaming Server.) Streaming over RTSP allows random seeking without waiting for the clip to be downloaded progressively.
If you want to create a playlist or make a live broadcast, you would need to create an SDP (session description protocol) file. To create one, log into your video server's administration interface and then go to the Playlists section. Create a new movie playlist and drag the accompanying media to the playlist. Give the playlist a name and a mount point, which is an SDP file. Save the list, and do not forget to start the list afterwards. Instead of pointing your player to the MPEG-4 file, supply the new URL, rtsp://<server_name>/<sdp_name> to receive the broadcast. Congratulate yourself! You have successfully created a streaming MPEG-4 system and your first MPEG-4 video clip.
If you want to stream live video from your capturing device, use mp4live which comes with MPEG4IP. You need a Video4Linux-compatible capturing device, Video4Linux and I2C support in the kernel for live broadcasting. The user interface of mp4live is quite self-explanatory. You can record the video to an MPEG-4 file or stream it to clients with unicasting or multicasting. Click the Generate button to generate an SDP file, and copy it to your video server's media directory.
If you are within a local LAN or enterprise, multicasting would be the best method. In this method (on both QuickTime, Real and gmp4player), you pass the SDP file directly to the program. Set up a web server on the broadcasting machine, then point the player to http://<server machine>/capture.sdp, where capture.sdp is the aforementioned generated SDP file. With unicasting, you would use rtsp://<server machine>/capture.sdp instead. The server machine must be running Darwin Streaming Server, and the result is the streams are unicasted and repeated. This should be used only where multicast is not available.
People who try encoding the video may complain about the video quality. The MPEG-4 codecs used in Windows and Linux are the same, so what is the difference? The key component that determines the ultimate quality of the video is the rate controller. The fact is rate controllers in Linux still need some work. I recommend using the famous VirtualDub (free and licensed under the GPL) if you can, because it is more powerful in video encoding and processing and significantly enhances video quality.
Most people prefer using QuickTime, RealPlayer or Windows Media Player to play streaming video. Starting with version 6, QuickTime has built-in support for MPEG-4, so what you need to do is upgrade your QuickTime Player. For RealPlayer and Windows Media Player, you must install the EnvivioTV plug-in, which can be freely downloaded and used. You may get your copy at www.envivio.com.
Many discussions of QuickTime 6's MPEG-4 support can be found on the Net. In short, a bunch of users cannot play streamed MPEG-4 with QuickTime 6, and sometimes they receive strange error messages. The problem lies in the implementation of MPEG-4 in QuickTime 6. It is known that MPEG-4 video encoded with GMC (global motion compensation), quarterpixels (qpel) and chroma motion cannot be played with QuickTime 6. QuickTime 6 also uses an MPEG quantizer, which improves cripsness and is better than H.263 for preserving quality. Extensive tests in my school show that MPEG-4 AAC audio with bit rates under 64 kilobits/second generate strange error messages in QuickTime 6. The players provided by MPEG4IP, however, do not have the same problems with QuickTime 6.
QuickTime 6:
Friendly user interface.
Popular.
Integrates with browsers.
Plays only some MPEG-4 files.
MPEG4IP mp4player:
The Windows version player lacks a good user interface.
Not very well known to the public.
Manual input of URL is required.
Plays most MPEG-4 files.
Before encoding an MPEG-4 streaming video clip, you must consider a few things. Do you want to keep the maximum quality or compatibility? Who is the intended audience for the clip? If you are showing the clip to a large group of people or the general public, it is best to encode the clip so it may be played by common video players. If you want to preserve quality, you can use an MPEG quantizer during encoding or the MPEG-4 encoding tools discussed above. You should provide download of the MPEG4IP player so users are able to play them properly. The MPEG4IP suite includes Visual Studio workspace files, which let you compile Windows version of the player, wmp4player. Provide it as well, as most of your clients are probably running Windows.
MPEG-4 will be the trend in video streaming in the coming years. The MPEG-4 implementations we have today are still not the full MPEG-4 toolbox. For example, integration of natural and synthetic content and broadcast-grade synchronization need to be advanced. With the technology becoming more mature, MPEG-4 will soon become the standard for internet video.
I would like to thank Bill May, the main developer for the MPEG4IP project, for his comments and suggestions on this article.
Special Magazine Offer -- 2 Free Trial Issues!
Receive 2 free trial issues of Linux Journal as well as instant online access to current and past issues. There's NO RISK and NO OBLIGATION to buy. CLICK HERE for offer
Linux Journal: delivering readers the advice and inspiration they need to get the most out of their Linux systems since 1994.
Sorry, offer available in the US only. International orders, click here.
Subscribe now!
The Latest
Featured Videos
The X Window System is a magnificent platform for many uses, but using it to run an application over a slow network is nearly impossible. This is an introduction to NX, a technology that makes remote applications fly even over commodity internet.
Linux Journal Gadget Guy, Shawn Powers, reviews the Flip Video Ultra, a small portable video camera, and shows us how easy it is to edit the video with Kino.
Thanks to our sponsor: Silicon Mechanics
Recently Popular
From the Magazine
September 2008, #173
Feeling a bit like a Thermian? Never give up, never surrender! Someday, you could go from underdog to top dog. Just take a look at a few of the underdogs we highlight in this issue: Mutt, djbdns, Nginix, Gentoo, Xara and the program voted mostly likely to fail just a few years back—Firefox. If Firefox not radical enough for you, check out Chef Marcel's column for some more alternatives. Having trouble mapping your program data to your relational database? If so, Rueven Lerner shows you some tricks in his At The Forge column.
Need to run GUI applications on your server in the next state? In his Paranoid Penguin column, Mick Bauer shows you how to do it securely. Kyle Rankin keeps hacking and slashing and shows you a few split screen secrets you may not be familiar with. Finally, we all know what happens next February, but only Doc knows what happens afterward.
Delicious
Digg
Reddit
Newsvine
Technorati







problem with ffmpeg..
On March 31st, 2008 Anonymous (not verified) says:
hello..
I installed ffmpeg-0.4.6..and tried to use it..
but it is showing this error..
"ffmpeg: error while loading shared libraries: libdc1394_control.so.12: cannot open shared object file: No such file or directory"
i even searched for this library file, in /usr/lib
its not there..
please help me in this regard..
help me urgently..
This "secret" applies to audio streaming too.
On April 15th, 2007 Rhonda Byrne (not verified) says:
I'm working on bringing up audio streaming functionality on PowerPC-based single-board computer running Linux. This article alone together with The Neuros MP3 Digital Audio Computer have allowed me to setup audio streaming functionality from my box. My next goal is to figure out how to configure and use TCP/IP networking with my board.
Great info, thanks a lot.
Real Time encoding and then streaming
On August 24th, 2005 IH (not verified) says:
Is it possible (with out any fancy hardware) to encode a file on the fly while you stream it?
So basically I want to begin encoding the file and start streaming it before the encoding is complete.
If this IS possible, is it possible to change the quality of the encoding as you are streaming?
'
Thank you
Real Time
On February 22nd, 2007 DrEaMeR (not verified) says:
It should be possible creating a pipe
Re: Streaming MPEG-4 with Linux
On October 21st, 2004 Anonymous says:
I am facing a problem of unaable to creat RTSP client.
Also it shows unable to creat socket 111.
I dont understand kindly help
-Kiran
Re: Streaming MPEG-4 with Linux
On October 5th, 2004 Anonymous says:
hi, i am new here.i have downloaded all the tool it need for installing the mpeg4ip, but i found some prolem to install it.i even can not install it even i double click on the install file.is it i need to change something before i install it??i have read a lot of this kind of article but i still a bit blur.so hope that someone can teach me in detail how to make it.thank!
Re: Streaming MPEG-4 with Linux
On October 8th, 2004 hans-juergen (not verified) says:
Maybe you should read the MPEG4IP forum (use the search function) and also the documentation files in their package and on their website about installing problems:
MPEG4IP Open Discussion
Another possibility is to search for compiled RPM packages with search engines like rpmseek.com or rpm.pbone.net.
mp4 file does not stream on DSS
On July 7th, 2005 emie (not verified) says:
hello !
i had a question .
i had a file in .avi format .I want to make it in mp4 format, hint it and stream it using DSS.
i have done that using the command given below . but DSS gives error :
There is (1) movie in the Playlist.
Ref Movie = /mnt/hdb3/movies/RoninComing_Soon.mp4
SDP file = /var/streaming/playlists/r/r.sdp
Problems found
--------------
- Movie set up failed: Movie file does not match SDP.
(file: /mnt/hdb3/movies/RoninComing_Soon.mp4 err: 16 Movie file does not match SDP.)
- PlaylistBroadcaster found one problem movie file.
There are no valid movies to play
Warnings: 1
Errors: 1
PlaylistBroadcaster preflight finished.
Here are the commands i used for encoding ,hiting steps.
ffmpeg -i RoninComing_Soon.avi -vn RoninComing_Soon_audio.wav
faac RoninComing_Soon_audio.wav
ffmpeg -i RoninComing_Soon.avi -an -vcodec mpeg4 RoninComing_Soon_rvideo.avi
avi2raw RoninComing_Soon_rvideo.avi RoninComing_Soon.mp4v
mp4creator -create RoninComing_Soon.mp4v -hint -rate 25 RoninComing_Soon.mp4
mp4creator -create RoninComing_Soon_audio.aac -hint -I RoninComing_Soon.mp4
mp4creator -optimize RoninComing_Soon.mp4
And here is the track created in the mp4 file.
mp4info RoninComing_Soon.mp4
mp4info version 1.2
RoninComing_Soon.mp4:
Track Type Info
1 video MPEG-4 Simple @ L1, 360.000 secs, 173 kbps, 320x240 @ 25.00 fps
2 hint Payload MP4V-ES for track 1
3 audio MPEG-2 AAC LC, 300.326 secs, 58 kbps, 44100 Hz
4 hint Payload mpeg4-generic for track 3
5 od Object Descriptors
6 scene BIFS
Metadata Tool: mp4creator 1.2
on placing the file in playlist of DSS and playing it it gives error as written above .
I have been searching for the soloution for over one week now , using google and source forge forum for mpeg4ip and apple forum too.havent find any specific answere yet.
Regards
mp4 file does not stream on DSS
On July 7th, 2005 emie (not verified) says:
hello !
i had a question .
i had a file in .avi format .I want to make it in mp4 format, hint it and stream it using DSS.
i have done that using the command given below . but DSS gives error :
There is (1) movie in the Playlist.
Ref Movie = /mnt/hdb3/movies/RoninComing_Soon.mp4
SDP file = /var/streaming/playlists/r/r.sdp
Problems found
--------------
- Movie set up failed: Movie file does not match SDP.
(file: /mnt/hdb3/movies/RoninComing_Soon.mp4 err: 16 Movie file does not match SDP.)
- PlaylistBroadcaster found one problem movie file.
There are no valid movies to play
Warnings: 1
Errors: 1
PlaylistBroadcaster preflight finished.
Here are the commands i used for encoding ,hiting steps.
ffmpeg -i RoninComing_Soon.avi -vn RoninComing_Soon_audio.wav
faac RoninComing_Soon_audio.wav
ffmpeg -i RoninComing_Soon.avi -an -vcodec mpeg4 RoninComing_Soon_rvideo.avi
avi2raw RoninComing_Soon_rvideo.avi RoninComing_Soon.mp4v
mp4creator -create RoninComing_Soon.mp4v -hint -rate 25 RoninComing_Soon.mp4
mp4creator -create RoninComing_Soon_audio.aac -hint -I RoninComing_Soon.mp4
mp4creator -optimize RoninComing_Soon.mp4
And here is the track created in the mp4 file.
mp4info RoninComing_Soon.mp4
mp4info version 1.2
RoninComing_Soon.mp4:
Track Type Info
1 video MPEG-4 Simple @ L1, 360.000 secs, 173 kbps, 320x240 @ 25.00 fps
2 hint Payload MP4V-ES for track 1
3 audio MPEG-2 AAC LC, 300.326 secs, 58 kbps, 44100 Hz
4 hint Payload mpeg4-generic for track 3
5 od Object Descriptors
6 scene BIFS
Metadata Tool: mp4creator 1.2
on placing the file in playlist of DSS and playing it it gives error as written above .
I have been searching for the soloution for over one week now , using google and source forge forum for mpeg4ip and apple forum too.havent find any specific answere yet.
Regards
Re: Streaming MPEG-4 with Linux
On September 6th, 2004 Anonymous says:
How would someone go about installing this server software and setting it up to recieve multiple simulcast audio/video streams coming from computers that are using Windows on their desktops?
Any ideas?
Re: Streaming MPEG-4 with Linux
On September 2nd, 2004 Anonymous says:
How is it possible to create multi-layer video in separate files? I want for example a video splitted in 4 files that I need to receive incrementally and simultanuosy if I want to increase the perceived quality.
Is this achieveble, for example to use it for multi-layer multicast?
Tnx
Emiliano
Re: Streaming MPEG-4 with Linux
On June 29th, 2004 mrbinky3000 (not verified) says:
Help!!
I do the following steps..
% ffmpeg -i MOV00148.MPG -vn audio.wav
% faac -m4 -b64 -r48000 -pLC audio.wav audio.aac
... and get this error message. What am I doing wrong?
FAAC - Freeware Advanced Audio Coder (http://www.audiocoding.com/)
Portions Copyright (C) 2001 Menno Bakker
Portions Copyright (C) 2002,2003 Krzysztof Nikiel
This software is based on the ISO MPEG-4 reference source code.
(see the faac.html file for more details)
libfaac version 1.20.1 beta (Jun 28 2004)
faac: invalid option -- b
faac: invalid option -- 6
faac: invalid option -- 4
faac: invalid option -- 4
faac: invalid option -- 8
faac: invalid option -- 0
faac: invalid option -- 0
faac: invalid option -- 0
faac: invalid option -- p
faac: invalid option -- L
Usage: faac -options infile outfile
Options:
-a Set average bitrate to approximately x kbps/channel.
-c Set the bandwidth in Hz. (default=automatic)
-q Set quantizer quality.
--tns Enable TNS coding.
-n Don't use mid/side coding.
-m X AAC MPEG version, X can be 2 or 4.
-o X AAC object type. (0=Low Complexity (default), 1=Main, 2=LTP)
-r RAW AAC output file.
-P Raw PCM input mode (default 44100Hz 16bit stereo).
-R Raw PCM input rate.
-B Raw PCM input sample size (16 default or 8bits).
-C Raw PCM input channels.
-I Input channel config, default is 3,4 (Center third, LF fourth)
--addsilent Add n silent frames at the end of output (default=1)
More tips on FAAC usage can be found in Knowledge base at www.audiocoding.com
Re: Streaming MPEG-4 with Linux
On October 8th, 2004 hans-juergen (not verified) says:
You are using a rather new FAAC version with the outdated command line options from the article written in 2003. For newer versions (current is v1.24+) you don't have to specify the profile anymore (default is LC), and the average bitrate counts for all input channels now, no longer per channel. So if your input file is stereo and you want a bitrate of 128 kbps, use -b 128. Defining the sample rate of the input WAV file when decoded with ffmpeg might not be necessary, but if you have to, use -R 48000, not -r 48000 (because -r is a completely unrelated option only for testing purposes).
So this command line should work:
%faac -b 128 audio.wav
This would give you a 128 kbps/stereo MPEG-2 AAC file with the same name as the input file. If you want to define another output file name, use the -o parameter which would also enable to wrap the AAC bitstream in the MP4 container when using the file extensions *.mp4, *.m4a or *.m4b with the latest version. MP4 tagging is also possible then.
For more information on the FAAC options etc. see the Wiki of Audiocoding.com, the homepage of the open source FAAC project:
FAAC Wiki page
A project summary is also available at Freshmeat.net now:
Freshmeat project page
Re: Streaming MPEG-4 with Linux/mp4player and playlists
On June 13th, 2004 Anonymous says:
Well, very nice article! But "manual input of URL" into mp4player is
not true;-)
We dont have reference movies etc, but we have playlists,
see mpeg4ip/player/src/main.cpp and
gui_main.cpp, there are some MPEG Video Playlist extensions hardcoded.
See also www.uni-bonn.de/~uzs106/ ..
The "MPEG Video Playlist game" may be confusing first, but
you can ignore it since mp4player cannot stream HTTP MPEG Video
streams.
Best, H.
Re: Streaming MPEG-4 with Linux
On March 16th, 2004 Anonymous says:
I got to making my mp4 and testing it before setting up the streaming server and when I open it in QuickTime 6.5 I get this error: "You may experience problems playing a video track in "movie.mp4" because the compressor found that the image data may be corrupted." It will let me play the movie and it works perfectly, but I want the warning message gone!
Re: Streaming MPEG-4 with Linux BUT NO VIDEO
On March 4th, 2004 Anonymous says:
Hi,
this is the best how to i read ever about mp4creator.
Now I have a litte imagination about the parameters.
But one problem : When I create a mp4 file I can play it with quicktime 6.
But streaming over darwin... no way. I can hear the sound but become a white video area with no action.
When i try to make an sdp with darwin there comes an error :
Problems found
--------------
- Movie set up failed: Movie file is invalid.
(file: /usr/local/movies//my.mp4 err: 17 Movie file is invalid.)
- PlaylistBroadcaster found one problem movie file.
There are no valid movies to play
Warnings: 1
Errors: 1
PlaylistBroadcaster preflight finished.
-------------
My capture scripts (capture from tv-card) :
mencoder -tv on:channel=SE17:fps=25:driver=v4l:width=384:height=288 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=500 -fps 25 -oac copy -vop pp=lb -o $1.avi
converting script :
-snip-
echo "avi -> m4v"
avi2raw --video $1.avi $1_enc.m4v
echo "ffmpeg -> mp3 dump"
ffmpeg -y -i $1.avi -r 25 -vn $1_enc.wav
echo "faac wav -> mp3"
faac -m 4 -c 44100 $1_enc.wav output_enc.aac
echo "mp4creator aac >> mp4"
mp4creator -c $1_enc.aac -H -I $1_final.mp4
echo "mp4creator m4v -> mp4"
mp4creator -c $1_enc.m4v -H -r 25 $1_final.mp4
-snip-
Has anyone a suggestion?
Hi, i'm from spain. Sorry for
On May 26th, 2005 cr0n (not verified) says:
Hi, i'm from spain. Sorry for my english.
This is my problem:
- [admin@Streaming pruebas]$ faac -m4 -b 64 -c44100 avi.wav avi.aac
- Freeware Advanced Audio Coder
- FAAC 1.24
-
- Multiple input files not supported yet
Could somebody help me?
Re: Streaming MPEG-4 with Linux BUT NO VIDEO
On June 18th, 2004 Anonymous says:
I forgoten said my email:
generalcordoba@yahoo.es
Re: Streaming MPEG-4 with Linux BUT NO VIDEO
On June 18th, 2004 Anonymous says:
Hello!, I have a problem wiht Darwing Streaming Server. The program said me:
========================================
There is (1) movie in the Playlist.
Ref Movie = /usr/local/movies//Dido_LifeForRent.mp4
SDP file = /var/streaming/playlists/dido/dido.sdp
- SDP generation failed (error: 15).
Warnings: 0
Errors: 1
PlaylistBroadcaster preflight finished.
=======================================
Some people can help me???
I am from Spanish, excuse me for my english.
Thank!
Error 15 is
On June 6th, 2007 Shuaibe (not verified) says:
Error 15 is eMovieFileNoHintedTracks, which is set when the QTFile library tries to open the file, doesn't find any hint tracks, and returns QTRTPFile::errNoHintTracks.
you need to add the hint trakc to the file. you can use QuickTime Pro for that.
Re: Streaming MPEG-4 with Linux
On July 20th, 2003 Anonymous says:
Hi, very very compliment for the article, it's the best I ever read, but I've had a problem... I've installed all the needed software, my original movie was a .avi movie (xvid + mp3), and in particularly I've made:
ffmpeg -i u571streamaudio3.avi -vn u571streamaudio3.wav
Input #0, avi, from 'u571streamaudio3.avi':
Stream #0.0: Video: mpeg4, 704x288, 25.00 fps, 800 kb/s
Stream #0.1: Audio: mp3, 48000 Hz, stereo, 115 kb/s
Output #0, wav, to 'u571streamaudio3.wav':
Stream #0.0: Audio: pcm_s16le, 48000 Hz, stereo, 1536 kb/s
Stream mapping:
Stream #0.1 -> #0.0
Press [q] to stop encoding
size= 239990kB time=1279.9 bitrate=1536.0kbits/s
and
faac -m4 -b64 -r48000 -pLC u571streamaudio3.wav u571streamaudio3.aac
FAAC - command line demo of Jul 17 2003
Uses FAACLIB version: 1.0
Encoding u571streamaudio3.wav took: 13 min, 12.00 sec. of cpu-time
and
ffmpeg -i u571streamaudio3.avi -an -b 300 -vcodec mpeg4 u571streamaudio3out.avi
Input #0, avi, from 'u571streamaudio3.avi':
Stream #0.0: Video: mpeg4, 704x288, 25.00 fps, 800 kb/s
Stream #0.1: Audio: mp3, 48000 Hz, stereo, 115 kb/s
Output #0, avi, to 'u571streamaudio3out.avi':
Stream #0.0: Video: mpeg4, 704x288, 25.00 fps, q=2-31, 300 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop encoding
frame=31999 q=31.0 size= 47914kB time=1280.0 bitrate= 306.7kbits/s
and
mp4creator -c u571streamaudio3.avi -hint mytest.mp4
mp4creator: Warning: no Visual Object Sequence Start (VOSH) header found in MPEG-4 video.
This can cause problems with players other than mp4player included
with this package.
and
mp4creator -optimize mytest.mp4
and
mp4creator -list mytest.mp4
Track Type Info
1 video MPEG-4 Simple @ L3, 1279.960 secs, 1231 kbps, 704x288 @ 25.00 fps
2 audio MPEG-1 (MP3), 1279.968 secs, 116 kbps, 48000 Hz
3 hint Payload MP4V-ES for track 1
4 hint Payload MPA for track 2
7 audio MPEG-4, 1279.957 secs, 64 kbps, 48000 Hz
8 hint Payload mpeg4-generic for track 7
9 od Object Descriptors
10 scene BIFS
and I0ve installed Darwin Streaming server, I've created SDP with admin panel but I obtain this error:
- Movie set up failed: Movie file does not match SDP.
(file: /Users/client_kylix/movies/mytest.mp4 err: 16 Movie file does not match SDP.)
[sorry for the length...]
Problem with Streaming MPEG-4 with Linux
On February 1st, 2006 Skillo (not verified) says:
I have the same problem. The version the MPEG4IP is 1.4.1, faac 1.24.
Is possible to explain me how to fix the problem or the solution to my stream?
Thanks,
Skillo
Re: Streaming MPEG-4 with Linux
On October 25th, 2004 Anonymous says:
Shouldn't
3 hint Payload MP4V-ES for track 1
come before
2 audio MPEG-1 (MP3), 1279.968 secs, 116 kbps, 48000 Hz
?
Re: Streaming MPEG-4 with Linux
On October 17th, 2004 Anonymous says:
I have got the same problem. My platform is Linux, mpeg4ip versions tested 1.0 and 1.1, Darwin Streaming Server 4.1.2 and 5.1.1. Tested mp4 contains two streams from an avi file - xvid encoded MPEG-4 and mp3 audio (hinded and interleaved).
use of H264 for streaming
On December 13th, 2004 adithyan (not verified) says:
Can I use H 264 streaming for a virtual classroom in linux,from where I get free software
Re: Streaming MPEG-4 with Linux
On March 2nd, 2004 Anonymous says:
got the same problem
Re: Streaming MPEG-4 with Linux
On December 21st, 2003 Anonymous says:
were you using DivX to encode your video? That's the same error I get when I try to DivX-encode, but XviD doesn't give that error (as of 1.0 beta 2). Try using XviD if you want a VOSH, and it shouldn't get you any more errors.
Re: Streaming MPEG-4 with Linux
On March 2nd, 2004 Anonymous says:
i use xvid and i got the same problem
i thougt this is because of some non obvious error in the PlayListBroadCster as when you try to launch it in a konsole you got some strange error
Re: Streaming MPEG-4 with Linux
On July 15th, 2003 Anonymous says:
I can stream mp4 after I installed Apple Darwin Streaming Server (eg. rtsp://192.168.0.99/sample_100kbit.mp4), but I cannot stream mp3 even I open port 8000 in firewall.
(eg. rtsp://192.168.0.99/sample.mp3)
anyone can help? Thanks alot!
The only method I know is to
On April 16th, 2005 Anonymous (not verified) says:
The only method I know is to wrap the bla.mp3 into a bla.mp4 with mp4creator -H bla.mp3 bla.mp4 and put that bla.mp4 into DSS.
BUT: Apple boycotts mp3 audio in mp4s (for whatever reason).
Real Player (Linux) doesnt like it as well. Older versions did play it (Real/Envivio).
Currently the only player that streams such rtsp://bla/mp3.mp4s fine is the dear and noble Cisco MPEG4IP mp4player.
H.
An example is rtsp://gurke.bootlab.org/venice24.mp4 (audio only)
Re: Streaming MPEG-4 with Linux
On June 8th, 2003 Anonymous says:
I want to use streaming of video from IP camera on Linux? What are the things I have to use. Currently I am using qt/embedded, ffmpeg. ffmpeg requires kde objects like arts and kdelibs. x11 in arts doesn't compile? Am I missing anything? Which are the other products I should use. I will be compiling on PowerPC. Do I require gcc 3.2? tmake 1.1x? Any kind of help is appriciated
Vinod
vbhat@bay-soft.com
Re: Streaming MPEG-4 with Linux
On April 10th, 2003 Anonymous says:
Another MPEG-4 player under Windows which is possibly better in some ways than QT and certainly has a better user IF than the wmp4player (i.e., MPEG4IP's) is the Philips Platform4 player, see
http://www.digitalnetworks.philips.com/InformationCenter/Global/FArticleSummary.asp?lNodeId=764&channel=764&channelId=N764A2175
G. Kinal
Re: Streaming MPEG-4 with Linux
On March 29th, 2003 Anonymous says:
could you tell me more about the format of Mpeg4?
i suggest you to include some introduction on Mpeg4 fomat.
Re: Streaming MPEG-4 with Linux
On April 8th, 2003 Anonymous says:
Visit the official MPEG homepage, a good start is to read the FAQs about all MPEG-4 parts (Sytems, Video, Audio etc.). Furhter descriptions are also available there:
http://mpeg.telecomitalialab.com/
Re: Streaming MPEG-4 with Linux
On October 17th, 2004 Anonymous says:
http://mpeg.telecomitalialab.com/
DEAD LINK
The MPEG homepage has moved:
On December 31st, 2004 hans-jürgen (not verified) says:
The MPEG homepage has moved:
FAQs
Re: Streaming MPEG-4 with Linux
On March 30th, 2003 dszeto (not verified) says:
Introduction to MPEG-4 itself could be a full-length article like this or even longer. In short, MPEG-4 is a video format target for low bitrate video which offers better compression over the former MPEG formats. It is engineered to become a standard format for Internet video (it could store vector graphics), but could also be used to store video at higher bitrates (e.g. movies in DivX).
I love this article, I am always interested in video algorithms;
On March 17th, 2003 Anonymous says:
This article is well explained, even well organized to the point where this article can fracture off into a book or informative pamphlet. However i see absolutely nothing wrong with this article, it has precisely what it needs in it; a perfect article.
Re: I love this article, I am always interested in video algorit
On March 18th, 2003 Anonymous says:
I agree with you.
The article is extremely well written. The authour must have a very deep understanding in this field. I am very proud to have such a talent as my classmate. Actually, he is the director of our school's computer team. I look forward to seeing his next pieces.
Rgs,
Beethoven
Re: I love this article, I am always interested in video algorit
On March 18th, 2003 dszeto (not verified) says:
Hey... It's not playground here... Only in classroom please.
Re: I love this article, I am always interested in video algorit
On March 17th, 2003 dszeto (not verified) says:
Thanks! =) I'll work on more articles soon. =)
From mpeg4ip.net:
Mpeg4ip Version 0.9.8 Released
wmaycisco - 2003-03-06 13:25
Hurray! =D
Re: Streaming MPEG-4 with Linux
On March 15th, 2003 Anonymous says:
FFmpeg 0.4.6 is quite old, I recommend using CVS version instead.
Anyway for encoding video you can use mencoder (from MPlayer) too. Same applies for playbac, MPlayer can play mpeg4 files/streams fine.
For rtsp:/ playback see www.live.com/mplayer
A'rpi
Re: Streaming MPEG-4 with Linux
On June 13th, 2004 Anonymous says:
Well, very nice article! But "manual input of URL" into mp4player is not true;-)
We dont have reference movies etc, but we have playlists,
see mpeg4ip/player/src/main.cpp and
gui_main.cpp, there are some MPEG Video Playlist extensions hardcoded.
See also www.uni-bonn.de/~uzs106/ ..
The "MPEG Video Playlist game" may be confusing first, but
you can ignore it since mp4player cannot stream HTTP MPEG Video streams.
Best, H.
Re: Streaming MPEG-4 with Linux
On March 21st, 2003 Anonymous says:
Ageed, V.good
P
Re: Streaming MPEG-4 with Linux
On March 15th, 2003 dszeto (not verified) says:
Thanks for your comment. =)
Also if you got problems on audio playback with mp4player you might try the CVS version of the player.
(I actually use CVS versions for most of the tools described. But it's better to write for stable versions, as most people would be successful. =)
I would like to see a more in
On June 27th, 2005 Anonymous (not verified) says:
I would like to see a more in-depth explanation of streaming live content from TV cards :)