Dialogic® PowerMedia™ Extended Media Server (PowerMedia XMS) - more articles
Streaming RTSP and Dialogic PowerMedia - A How-To Guide
One of the many functions of the Dialogic® PowerMedia™ Extended Media Servers (XMS) is the ability to work with a media stream delivered via Real Time Streaming Protocol (RTSP). RTSP is a protocol used to control media streaming servers. PowerMedia XMS can interface with an RTSP server serving up audio or video media. The stream will originate at a networked RTSP server and be available to be redirected to SIP video callers, either as part of an Interactive Video and Voice Response (IVVR) session or played into a video conference.
Setting up a demo or test system to do this may not be straightforward. This article provides instructions on how to use readily available open source and low-cost components for media production and an RTSP server as well as how to configure these with PowerMedia XMS. Several media files suitable for RTSP streaming are also provided.
While there are number of RTSP servers available today, this note focuses on a readily available open source utility called the VLC Media Player.
The following steps are described in this note:
- Download and install a suitable video transcoding agent (optional)
- Download and install the VLC Media Player
- Download and install either the PowerMedia XMS
- Obtain suitable media
- Process the media
- Start VLC, and play the RTSP stream through a DSS or XMS session
Preparing the Media Source
Although two media files are provided, the reader will likely want to process his own. This can be done using many different media editors and convertors. This article uses the suite of video utilities from AVS and the open source media processing utility FFMPEG.
Two AVS products may be used for media source preparation
- The AVS video converter can easily process a file to a format suitable for RTSP streaming to DSS or XMS
- If editing of the file is needed, the AVS Video Editor can save the results in the desired format
It is generally better to work with a master file of equal or higher resolution than the file to be used for streaming. Since the target resolution in this example is VGA, (640x480) use at least a VGA or 1080p file for the source. Convert to an Audio Videl Interleave (AVI) file with the following custom profile:
- Video Codec - H.264/AVC
- Frame Size - Custom
- Width - 640
- Height - 480
- Frame Rate - your choice, between 15-30 fps
- Bitrate - depends on projected network connection. 700 (Kbps) a minimum for VGA
- Audio Codec - PCM
- Sample Rate - 16000 Hz
- Sample Size - 16 bit
- Bit Rate 256 kbps
- Channels – mono
The FFmpeg open source project will also process most A/V files into a format suitable for RTSP streaming with DSS or XMS. Download of FFmpeg for many different platforms may be found here.
Parameters similar to those for AVS are needed:
- Video Codec – libx264
- Profile – baseline
- Level – 3.1
- Video Bitrate - 750K
- Format size – 640x480
- Frame rate – 15 fps
- Audio Codec – pcm_s16l3
- Audio bitrate – 16K
- Channels - 1
Since FFmpeg is command-line driven, here is an example of how the above parameters would be used:
> ffmpeg -y -i sintel.avi -vcodec libx264 -vprofile baseline -level 3.1 -vb 750k -s 640x480 -r 15 -ar 16000 -ac 1 -acodec pcm_s16le sintel_rtsp.avi
VLC Media Player
VideoLan’s VLC media player is used as the source for the RTSP stream. VLC is a multi-purpose encoder and streamer that works with a variety of sources/destinations and can be run on most any platform.
VLC may be downloaded here. The latest version as of this writing, 2.0.1, is recommended.
Streaming from a Prepared File
Two sample files can be downloaded from here (insert link) , PowerMedia_Sample1.avi and PowerMedia_Sample2.avi, have been prepared with the proper audio and video codecs, formats, bitrates, etc. to demonstrate the media capabilities of DSS and XMS. They have the following characteristics:
· VGA (640x480) resolution
· H.264 video codec with a profile/level of 3.1
· Frame rate of 25 fps
· G722 PCM 16Khz audio sampling at 256 kbps
· Max bitrate of 1000 kbps
Streaming Media Source Files
To process your own files, sources of streaming media include the following:
They are short, computer-generated animation features, done with open source graphics processing software such as Blender (www.blender.org) and, as of the publication of this article, are distributed under a Creative Commons license. All three of these have been successfully used with the conversion and RTSP streaming processes described in this article.
Setting Up VLC for RTSP Streaming
Using either the provided sample files or having converted your own, the next step is getting RTSP streaming from the file available on a network connection. However, setting up the VLC media player for RTSP streaming from a source file and starting the stream can be somewhat complicated. To help, a step-by-step procedure follows:
- Start VLC
- An empty playlist will be seen in the first screen. Hit Play (right arrow)
- Under File tab, Add a source file.
- Under the Play pulldown menu, select Stream. Source will be set to the file just entered.
- Hit Next for Destinations. Under the File pulldown menu, select RTSP.
- Hit Add. Change Port to RTSP standard port of 554. Path is set to a path/file name that will be referenced in the RTSP URL by the client requesting the stream. A simple single level name - /Sample1 or /Sample2 will be used in the examples here
- Unclick Activate Transcoding - the file from which the media is streamed is already in the correct format, and not doing audio or video transcoding "on the fly" should result in better quality media
- Next will display options sent to VLC media player. No changes are necessary
- Stream will start RTSP streaming server. The player will be seen again with a play in progress. It may be good to hit the loop button so that streaming from the file will repeat
- Right click on item in Playlist/Media Information/Codec Details to verify what you are streaming
Verifying the RTSP stream’s availability can be done by starting a second instance of VLC, connecting to it and playing the media stream just started:
You are now ready to play the stream using XMS.
General XMS Considerations
The remainder of this note assumes that you are familiar with installing and configuring XMS.
Since once-way streaming media will likely be originating from a good quality source, XMS should be set to use its best quality video if network bandwidth conditions permit. Some guidelines for audio and video follow:
- Video codec should be H.264 with a 3.1 profile suitable for VGA
- Audio codec should be G711 u-Law
- RTSP URL should be rtsp://<VLC server ip address>:554/stream_name This corresponds to the rtsp path/filename set in VLC while setting up the stream. The SIP video call to the media server should be set similarly.
Playing the RTSP media stream may be done using PowerMedia XMS via the RESTful interface.
Dialogic provides a test and demo utility, XMSTool, for the XMS server’s RESTful interface. The utility, along with operating instructions, is available as one of the downloads from the XMS user interface.
XMSTool’s demo or simple mode is sufficient for playing an RTSP stream. There is a demo called “rtsp_play” available with the tool. When started, it waits for an inbound SIP video call. When the call comes in, it is answered and then the RESTful Play command is issued. The media is played for 60 seconds and then the call is hung up.
The Play command, embedded in the XML file that controls the macro, is as follows:
<play offset="0s" repeat="0" delay="1s" terminate_digits="#" max_time="0s" skip_interval="1s">
Some adjustment of this command, located in the XMSTool file testing/rstp_play.xml, is necessary before using the demo. The line:
must be adjusted for the IP address of the system on which VLC media player is running and for the name of the RTSP stream. XMSTool can then be started the rtsp_play demo selected and a SIP call placed to display the RTSP stream.
A general note: the dvr_setting element in the RESTful Play command is not valid when playing an RTSP stream. This allows for DVR commands such as pause, stop play, etc. to be issued as RESTful commands. It is currently only available when playing media directly from a file.
It is also possible to play an RTSP stream into a multi-party video conference. The same approach is used – a conference is established and then a Play from the RTSP stream is done. Currently, the play cannot be directed into a specific window in the multi-party conference. It will instead overlay all conference participants until the play is done.
Files for RTSP Streaming
Click here to download a zip file of the media files mentioned in this article.
Dialogic® PowerMedia™ Extended Media Server (XMS) - http://www.dialogic.com/products/media-server-software/xms.aspx
VLC Media Player - http://www.videolan.org/vlc/
AVS Video - http://www.avs4you.com
Big Buck Bunny - http://www.bigbuckbunny.org
Sintel - http://www.sintel.org
Elephant Dreams - http://orange.blender.org
First published: 07-May-2014
Open access: Product rule: open; Page rule: Auto