RTSP/RTP streaming support for MPlayer
The Open Source
media player can now
receive and play
RTP audio/video streams,
"LIVE555 Streaming Media"
source code libraries.
- For example, MPlayer can be used to view the MPEG/RTP
streams sent by the
demo applications, using the corresponding ".sdp" file
(or, if the built-in RTSP server is enabled, using a "rtsp://" URL).
- MPlayer can also play many other "rtsp://" streams, including
ISMA-compliant MPEG-4 audio/video streams.
Note: We now recommend the use of the
VLC media player.
VLC, like MPlayer, uses the "LIVE555 Streaming Media"
code for RTSP client support, but is generally more reliable than MPlayer.
The VLC web site
also has pre-built binary versions; you may not need to build it from source code.
Building MPlayer to support RTSP/RTP streaming
Please do the following steps, in order:
- Download and build the
"LIVE555 Streaming Media"
You may wish to move the resulting "live/" directory to "/usr/local/",
"/usr/local/lib/", or "/usr/lib/".
(Note: If you do this, you must move the entire "live/"
directory - not just the library files.)
- Download the newest version of the
MPlayer source code.
If, in Step 1, you moved the "live/" directory to "/usr/local/",
cd MPlayer* ; ./configure
and check to see whether the "live555" library was automaticaly detected.
cd MPlayer* ; ./configure --extracflags=-I <path-to-LIVE555-Streaming-Media-library-directory>
- Now, build and install MPlayer as usual - i.e.,
make ; make install
(Note that you must build MPlayer with the same version of
"gcc" that you used to build the LIVE555 Streaming Media code.)
Running the new MPlayer
MPlayer can be run just as before.
However, it can now open "rtsp://" URLs:
Alternatively, using a "sdp://" pseudo-URL,
MPlayer can read a SDP file that describes a RTP session:
- To see details of the complete RTSP protocol exchange, add
the "-V" ('verbose') option.
(SDP files are usually used only for playing multicast RTP sessions.)
MPlayer's "A-V:" display (at the bottom of the console window) shows the
current time difference (in seconds) between the audio and video streams.
MPlayer will automatically attempt to synchronize audio and video
- i.e., to bring the "A-V:" number close to zero - using information
provided by incoming RTCP "Sender Report" packets.
Sometimes, however, MPlayer's default synchronization mechanism
can be slow to respond.
If you need to make it respond more aggressively, try adding
MPlayer's principal author has also written
an informative article
that discusses techniques for tuning the performance of MPlayer.
Streaming over TCP
By default, incoming data (RTP and RTCP packets) are streamed using UDP.
If, however, you have a broken Internet connection that
(for whatever reason) does not pass incoming UDP packets, then you
can ask that the incoming data be streamed over TCP instead.
(It will use the same TCP connection as RTSP.)
To do this, add the option
(Note that TCP streaming can be used only with "rtsp://" URLs; it can't
be used with sessions that are specified using a SDP file.)
Streaming access-controlled RTSP sessions
Some RTSP servers require user authentication (via a name and password)
before a session can be streamed. To stream such a session, use the
"-user <username> -passwd <password>" options.
The program authenticates using RTSP "digest authentication";
will not get sent in the clear over the net.
Alternatively, you could try including the user name and password inside
the URL, as:
(In this case, though, the password will be sent in the clear
over the net.)
Playing SIP (IP telephony) sessions
MPlayer can also open and play SIP IP telephony sessions
- i.e., those specified by a
Of course, because MPlayer is a receive-only application, you can
listen in on such sessions
- but you won't be able to talk back.
(For two-way communication on a SIP session, you should instead
use a dedicated
SIP 'softphone' application, such as
A note about RealAudio and RealVideo sessions
Note that the LIVE555 Streaming Media libraries do not
support RealAudio and/or RealVideo streams
- even those described by a "rtsp://" URL - because
these streams do not use RTP for transport.
(Instead, these streams use RealNetworks' proprietary
MPlayer was updated so that it can
play RealAudio/RealVideo "rtsp://" streams.
It does this by first checking whether the URL ends with ".rm"
If it does, it handles it as a special case,
not using the LIVE555 Streaming Media support.
Otherwise, it uses the LIVE555 Streaming Media support, as usual.
General questions about MPlayer should be posted to one of the
MPlayer mailing lists.
However, questions specifically
about the RTSP/RTP streaming support
(except for playing RealAudio or RealVideo streams)
should be posted instead to
the "LIVE555 Streaming Media" developers' mailing list.
Work still to be done...
- Support additional RTP media types.
At present, the following media types are known to work:
MPEG-1 or 2 elementary streams
(including layer III - i.e., "MP3");
MPEG-4 (AAC) audio;
PCM (u-law or a-law);
MPEG-1, 2 or 4 elementary streams;
- Use the RTSP "PAUSE" and "PLAY" commands to support the pausing and seeking
of RTSP-initiated streams.
- Handle video RTP multicast sessions that contain more than one
(multiplexed by RTP SSRC) - e.g., sessions such as the MBone
"Places all over the world".
For example, MPlayer might pop up a separate video window for
each such source.