RidgeRun RTSP GStreamer Server

From RidgeRun Developer Connection

Jump to:navigation, search

Contents

Streaming NTSC video from DM365 device to VLC

This page describes the steps to stream NTSC video from DM365 device to VLC using hardware acceleration when possible. The example hardware being used is a LeopardBoard365 and a Windows PC running VLC.

Overview

The device sending the video runs an RTSP server based on the gst-rtsp-server library. An RTSP server is created that is similar to the test-launch.c included with the gst-rtsp-server source code.

The address of the sending device is referred to by the shell variable SOURCE_IP.

Source code

The professional version of the RidgeRun SDK includes integration of Wim Taymans GStreamer RTSP Server library along with a RTSP server that uses the library.

You can port the gst-rtsp-server GStreamer RTSP server library following the Integration Guide. The test-launch.c is a good example RTSP server implementation.

Sending device

You can create an GStreamer RTSP server following the instruction included with the source code and referring to an sample implementation, such as the test-launch.c example.

In our GStreamer RTSP server we set the server IP address to 554 using the gst_rtsp_server_set_service() API and allow the factory to be shared via a call to the <tt>gst_rtsp_media_factory_set_shared() API.

The GStreamer pipeline used on the sending device for 720p streaming (using librraew) is:

RTSP_PIPE="v4l2src always-copy=false chain-ipipe=false ! video/x-raw-yuv,format=(fourcc)NV12, width=1280, height=720 ! dmaiaccel ! queue ! dmaienc_h264 encodingpreset=2 ratecontrol=4 ! queue ! rtph264pay pt=96 name=pay0"

Streaming 1080p (using librraew):

RTSP_PIPE="v4l2src always-copy=false chain-ipipe=false ! video/x-raw-yuv,format=(fourcc)NV12, width=1920, height=1088 ! dmaiaccel ! queue ! dmaienc_h264 encodingpreset=2 ratecontrol=4 ! queue ! rtph264pay pt=96 name=pay0"

Run the RTSP server using:

rr_rtsp_server "( $RTSP_PIPE )"

Other alternative is to use the rr-rtsp-server available at $DEVDIR/myapps, rr-rtsp-server demo will start automatically a pipeline and will stream the pipeline through the gstreamer rtsp server. In order to use rr-rtsp-server demo just select it at the make config menu:

User Applications -> [*] RTSP server example

After installing and starting the embedded device, the rr-rtsp-server demo should start automatically

Receiving device

Determining the IP address of the sending device

Using either VLC and GStreamer for the receiving viewer requires that you know the IP address of the sending device. The IP of the embedded device can be obtained with "ipconfig" at the console:

ifconfig eth0 | sed -e 's/inet addr:\(.*\)Bc.*/\1/'

VLC viewer

When the embedded device has booted, it's necessary to open VLC and select Media, Open Network Stream, this can be done with "Ctrl+N", a window will appear. Choose at protocol "RTSP" and at address write the hardware's IP address plus "/test" as appears at the following image:

Figure 1. VLC Network Open Media

QuickTime viewer

When the embedded device has booted, it's necessary to open QuickTime and start the streaming, this can be done if you go to File->File Location, at Movie Location write the rtsp url, "rtsp://" plus the hardware's IP address plus "/test" e.g: rtsp://10.251.101.152/test

GStreamer viewer

The following pipeline on your host computer should display the live view with less latency than seen with VLC:

gst-launch rtspsrc location=rtsp://$RTSP_IP/test ! rtph264depay ! ffdec_h264 ! xvimagesink sync=false

Notes

1080p support in MT9P031 driver

You might need to add something like:

{
    /* 1080P-HDTV height=1088 for dm36x encoding. Encoder needs
     * dimensions (width and height) multiples of 16*/
    .framesize = { 1920, 1088},
    .frameintervals = {
        {  .numerator = 1, .denominator = 31 },
        },
    .num_frmivals = 1
},

to the $DEVDIR/kernel/linux-2.6.32.17-psp03.01.01.39/drivers/media/video/mt9p031.c driver to support 1080p resolution.

SDK configuration

The following configuration items need to be enabled for RTSP streaming to work:

CONFIG_BSP_VIDEO_INPUT_SIZE_1080P=y
CONFIG_SOC_CAMERA_MT9P031=y
CONFIG_PROPRIETARY_DVSDK_MEM_VALUE=0x4600000
CONFIG_PROPRIETARY_DVSDK_AUTO_SETUP_CMEM=y
CONFIG_PROPRIETARY_DVSDK_CMEM_RESERVED_MEMORY=0x2800000

Running IPIPED

If you are setting chain-ipipe=false parameter for GStreamer element v4l2src, you need to run the following commands before starting the RTSP streaming:

WIDTH=1920
HEIGHT=1088
ipipe-client set-previewer-mode cont
ipipe-client set-ae electronic-centric weighted
ipipe-client set-awb gray-world digital
ipipe-client init-aew 200000 $WIDTH $HEIGHT 100

See also

Navigation
Toolbox