Using GStreamer with Darwin Streaming Server as RTSP server

From RidgeRun Developer Connection

Jump to:navigation, search

A frequent customer request is “how do I stream the video over the network?”.

There are some solutions out there that aren’t FOSS and if you try to extend the demo to do what you really need to do… you start running on issues. That’s the reason we push GStreamer based solutions, where the design allow simple and fast design and prototype of streaming media solutions.

We have been looking for some time to provide a FOSS solution for an RTSP server, and when we found the gst-rstsp-server, we were really happy. Kapil expended some time extending it to work for a customer scenario, but unfortunately we run into some out-of-memory situations quickly due to some design decisions on the code that assume more memory that what is typically available in embedded devices.

Then Diego stumble upon an article from some MIT folks where they used the Darwin Streaming Server (DSS) as RTSP server. This GStreamer+DSS approach have some advantages:

But we also have disadvantages:

We were successful streamed video from a Leopard VGA camera using the following pipeline (using DDOMPE branch):

gst-launch v4l2src always-copy=false ! dmaiaccel ! queue ! dmaienc_mpeg4 !
rtpmp4vpay ! udpsink port=5434 -v

We require the -v option so we can get the codec_data information generated by the encoder and passed on the caps of the sink pad of the dmaienc_mpeg4 element. This information needs to be put in the sdp file as detailed below.

And the following sdp file on /streaming/movies/leopardlivecamera.sdp:

o=- 132 362358265 IN IP4
t=0 0 
m=video 5434 RTP/AVP 96
c=IN IP4
a=rtpmap:96 MP4V-ES/90000
a=fmtp:96 profile-level-id=5;config=000001010000012000845d4c28a021e0a21f
a=framesize:96 480-640

I’m not a dsp syntax expert, so I generated the sdp file with the help of the QuickTime Broadcaster and then just adjusted the parameters to the resolution of the camera, the config string with the information from the codec_data (obtained from the pipeline), and the IP addresses to pickup the stream from the localhost.

With this setup, we are able to stream from the camera into a local port and then having the DSS running on the same board serving the RTSP clients. To connect all you need is:

vlc rtsp://

Where the IP is obviously the address of the board we are running from.

The only issues we notice so far seem related to latency of the video, but probably some tweaking of the parameters will solve the issue.

The CPU consumption of DSS is good, and the memory consumed is low, so we got a good start.