Gstreamer pipelines for DM385

From RidgeRun Developer Connection
Jump to: navigation, search


Introduction

On this page you are going to find a set of pipelines used on the DM385 (FossilShale board). The video capture is done through the MIPI serial interface so be sure to use the /dev/video7 device implemented in RidgeRun's SDK in order to set GStreamer input source to the MIPI interface.

Please disable the graphics plane before running the pipelines to display video:

 echo 0 > /sys/devices/platform/vpss/graphics0/enabled

DM385

Display videotest pattern


gst-launch videotestsrc ! 'video/x-raw-yuv,format=(fourcc)NV12,width=1920,height=1080,framerate=(fraction)60/1' ! omx_scaler ! gstperf  ! \
v4l2sink sync=false device=/dev/video1

Video test pattern display will be output on the HDMI port.


Scale the QVGA video test pattern to VGA

gst-launch -v videotestsrc ! 'video/x-raw-yuv,width=320,height=240' ! omx_scaler ! 'video/x-raw-yuv,width=640,height=480' ! \
omx_ctrl display-mode=OMX_DC_MODE_1080P_60 ! gstperf ! omx_videosink sync=false -v

Scaled video test pattern display will be output on the HDMI port.


Live Preview 1080@30fps

HDMI:

echo 0 > /sys/devices/platform/vpss/graphics0/enabled
gst-launch v4l2src device=/dev/video7 always-copy=false queue-size=8   ! 'video/x-raw-yuv,format=(fourcc)YUY2,width=1920,height=1080,framerate=(fraction)30/1'  !  \ 
omxbufferalloc numBuffers=10  ! gstperf  ! v4l2sink device=/dev/video1 sync=false


Encoding: Video (H264) 1080@30fps

gst-launch v4l2src -e device=/dev/video7 always-copy=false queue-size=8  ! 'video/x-raw-yuv,format=(fourcc)YUY2,width=1920,height=1080,framerate=(fraction)30/1'  ! omxbufferalloc numBuffers=10  ! \
omx_noisefilter  ! gstperf  ! queue  ! omx_h264enc force-idr-period=23 i-period=23 bitrate=10000000 profile=1  ! queue  ! rr_h264parser singleNalu=true  ! mp4mux dts-method=0  ! filesink location=<output_file>


Decoding: Video (H264) 1080@30fps

HDMI:

echo 0 > /sys/devices/platform/vpss/graphics0/enabled
gst-launch filesrc location=<FILE_NAME>.mp4  ! qtdemux name=mux mux.video_00  ! queue  ! h264parse  ! 'video/x-h264, stream-format=(string)byte-stream, alignment=(string)au'  ! omx_h264dec  ! \
omx_scaler  ! 'video/x-raw-yuv, width=(int)1920, height=(int)1080'  ! gstperf  ! v4l2sink device=/dev/video1 sync=false


Interpipe example: Live-preview Video (H264) 1080@30fps (also supported by gst-daemon)

You need to have the gst-interpipe plugin from RidgeRun to be able to run this pipeline

HDMI:

echo 0 > /sys/devices/platform/vpss/graphics0/enabled
CAPS="video/x-raw-yuv,format=(fourcc)YUY2,width=1920,height=1080,framerate=(fraction)30/1"

gst-launch -e v4l2src device=/dev/video7 always-copy=false queue-size=8   ! capsfilter caps=$CAPS  ! omxbufferalloc numBuffers=10  ! \
gstperf  ! queue  ! capsfilter caps=$CAPS  ! omx_noisefilter   ! gstperf   ! queue   ! omx_h264enc force-idr-period=30 i-period=30 \
bitrate=6000000 profile=high   ! queue  ! rr_h264parser singleNalu=true  ! interpipesink node-name=camera sync=false qos=false enable-last-buffer=false

    interpipesrc name=src is-live=true format=3 listen-to=camera ! video/x-h264, mapping=/stream1  ! rtspsink name=sink service=5001

    interpipesrc name=src is-live=true format=3 listen-to=camera ! mp4mux dts-method=0 ! filesink location=test_1080_30fps.mp4


Stream H.264 video test pattern over RTP

*Server: DM385


gst-launch videotestsrc ! omx_h264enc ! queue ! h264parse ! gstperf ! rtph264pay ! udpsink host=<host_pc_ip> port=5001 -v

This pipeline is going to print the capabilities of each element's pad thanks to the -v option. The pipeline should print something similar to this output:

.
.
Setting pipeline to PAUSED ...
/GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0.GstPad:src: caps = video/x-raw-yuv, format=(fourcc)NV12, width=(int)320, height=(int)240, framerate=(fraction)30/1, color-matrix=(string)sdtv, chroma-site=(string)mpeg2
Pipeline is PREROLLING ...
/GstPipeline:pipeline0/GstOmxH264Enc:omxh264enc0.GstPad:sink: caps = video/x-raw-yuv, format=(fourcc)NV12, width=(int)320, height=(int)240, framerate=(fraction)30/1, color-matrix=(string)sdtv, chroma-site=(string)mpeg2
/GstPipeline:pipeline0/GstOmxH264Enc:omxh264enc0.GstPad:src: caps = video/x-h264, width=(int)320, height=(int)240, framerate=(fraction)30/1, stream-format=(string)byte-stream, alignment=(string)au
/GstPipeline:pipeline0/GstQueue:queue0.GstPad:sink: caps = video/x-h264, width=(int)320, height=(int)240, framerate=(fraction)30/1, stream-format=(string)byte-stream, alignment=(string)au
/GstPipeline:pipeline0/GstQueue:queue0.GstPad:src: caps = video/x-h264, width=(int)320, height=(int)240, framerate=(fraction)30/1, stream-format=(string)byte-stream, alignment=(string)au
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:src: caps = video/x-h264, width=(int)320, height=(int)240, framerate=(fraction)30/1, stream-format=(string)byte-stream, alignment=(string)au, parsed=(boolean)true
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:sink: caps = video/x-h264, width=(int)320, height=(int)240, framerate=(fraction)30/1, stream-format=(string)byte-stream, alignment=(string)au
/GstPipeline:pipeline0/Gstperf:perf0.GstPad:src: caps = video/x-h264, width=(int)320, height=(int)240, framerate=(fraction)30/1, stream-format=(string)byte-stream, alignment=(string)au, parsed=(boolean)true
/GstPipeline:pipeline0/Gstperf:perf0.GstPad:sink: caps = video/x-h264, width=(int)320, height=(int)240, framerate=(fraction)30/1, stream-format=(string)byte-stream, alignment=(string)au, parsed=(boolean)true
/GstPipeline:pipeline0/GstRtpH264Pay:rtph264pay0.GstPad:sink: caps = video/x-h264, width=(int)320, height=(int)240, framerate=(fraction)30/1, stream-format=(string)byte-stream, alignment=(string)au, parsed=(boolean)true
/GstPipeline:pipeline0/GstRtpH264Pay:rtph264pay0.GstPad:src: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, sprop-parameter-sets=(string)\"J0KAKouVAoPyAA\\=\\=\\,KN4BriAA\", payload=(int)96, ssrc=(uint)351372116, clock-base=(uint)2835173849, seqnum-base=(uint)45865
/GstPipeline:pipeline0/GstRtpH264Pay:rtph264pay0: timestamp = 2835173849
/GstPipeline:pipeline0/GstRtpH264Pay:rtph264pay0: seqnum = 45865
/GstPipeline:pipeline0/GstUDPSink:udpsink0.GstPad:sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, sprop-parameter-sets=(string)\"J0KAKouVAoPyAA\\=\\=\\,KN4BriAA\", payload=(int)96, ssrc=(uint)351372116, clock-base=(uint)2835173849, seqnum-base=(uint)45865
.
.

you need the udpsink:sink capabilities for the client pipeline.


*Client: Ubuntu PC


Copy the udpsink caps given by the server pipeline, erase the spaces and the (uint) cast.

CAPS=application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264,sprop-parameter-sets=(string)\"J0KAKouVAoPyAA\\=\\=\\,KN4BriAA\",payload=(int)96,ssrc=351372116,clock-base=2835173849,seqnum-base=45865


gst-launch udpsrc port=5001 ! $CAPS ! rtph264depay ! queue ! ffdec_h264 ! xvimagesink sync=false -v


RTSP Streaming: Video File (H264) 1080p@30fps

You need to have gst-rtspsink plugin from RidgeRun to be able to run this pipeline

gst-launch filesrc location=<FILE_NAME>.mp4  ! qtdemux name=mux mux.video_00  ! queue  ! rr_h264parser singleNalu=true  ! \
video/x-h264, mapping=/stream1  ! rtspsink name=sink service=5001

You can watch this streaming using VLC:
Open Media menu, then Open Network Stream and add the streaming url

rtsp://<DM385_IP>:5001/stream1


RTSP Streaming: Live-preview Video (H264) 1080@30fps

You need to have gst-rtspsink plugin from RidgeRun to be able to run this pipeline

gst-launch v4l2src -e device=/dev/video7 always-copy=false queue-size=8  ! 'video/x-raw-yuv,format=(fourcc)YUY2,width=1920,height=1080,framerate=(fraction)30/1'  ! \
omxbufferalloc numBuffers=10  ! omx_noisefilter  ! gstperf  ! queue  ! omx_h264enc output-buffers=4 input-buffers=4 force-idr-period=30 i-period=30 \
bitrate=6000000 profile=high  ! queue  ! rr_h264parser singleNalu=true  ! video/x-h264, mapping=/stream1  ! rtspsink name=sink service=5001

You can watch this streaming using VLC:
Open Media menu, then Open Network Stream and add the streaming url

rtsp://<DM385_IP>:5001/stream1


Interpipe example: UDP Streaming Video (H264) 1080@30fps (also supported by gst-daemon)

You need to have the gst-interpipe plugin from RidgeRun to be able to run this pipeline

CAPS="video/x-raw-yuv,format=(fourcc)YUY2,width=1920,height=1080,framerate=(fraction)30/1"

gst-launch -e v4l2src device=/dev/video7 always-copy=false queue-size=8 ! capsfilter caps=$CAPS ! omxbufferalloc numBuffers=10 ! interpipesink node-name=camera \
sync=false qos=false enable-last-buffer=false

    interpipesrc name=src is-live=true format=3 listen-to=camera ! omx_noisefilter ! gstperf ! queue ! omx_h264enc force-idr-period=23 i-period=23 bitrate=1000000 \
    profile=1 ! queue ! rtph264pay scan-mode=0 ! udpsink async=false sync=false enable-last-buffer=false qos=false port=5000 host=<host pc_ip> auto-multicast=true


You can watch this stream using a GStreamer pipeline in your client PC:

UDP_CAPS='application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264,sprop-parameter-sets=(string)"J0KAKouVAPAETIAA\,KN4BriAA", \
payload=(int)96,ssrc=(uint)1554652380,clock-base=(uint)3761986314,seqnum-base=(uint)61669'

gst-launch -v udpsrc auto-multicast=true uri=udp://<host pc_ip>:5000 ! capsfilter caps=$UDP_CAPS ! rtph264depay ! capsfilter caps='video/x-h264,width=1280,height=720' ! \
ffdec_h264 ! capsfilter caps='video/x-raw-yuv, width=(int)1280, height=(int)720' ! xvimagesink


Note: If you are having trouble with udp, may be firewall will be blocking the port 5000. Please try running :

sudo ufw allow 5000/udp