DM36x GStreamer-1.0 pipelines

From RidgeRun Developer Wiki

Introduction

This page contains a set of GStreamer-1.0 pipelines used on DM36x platforms. The pipelines use custom plugins supporting the Texas Instruments Codec Engine API to access hardware accelerators.

Some of these pipelines have to be run on the target board and other in your computer, they are distinguished by the color used to document them, blue pipelines are for the DM36x board and yellow for pipelines have to be run in your PC.

Live Preview

Display video test pattern

gst-launch-1.0 -e videotestsrc ! 'video/x-raw,format=(string)UYVY,width=640,height=480' ! perf ! v4l2sink device=/dev/video2 max-num-buffers=3

Display video

gst-launch-1.0 -e v4l2src ! 'video/x-raw,format=(string)UYVY,width=640,height=480' ! perf ! v4l2sink device=/dev/video2 max-num-buffers=3

Video Encoding

Video test pattern H-264

gst-launch-1.0 videotestsrc ! 'video/x-raw, format=(string)NV12, width=640, height=480' ! ce_h264enc ! queue ! perf ! qtmux ! filesink location=test.mp4

Video test pattern JPEG

gst-launch-1.0 videotestsrc num-buffers=60 ! 'video/x-raw, format=(string)NV12, width=640, height=480' ! ce_jpegenc ! queue ! perf ! qtmux ! filesink location=test.mov

Video test pattern MPEG-4

gst-launch-1.0 videotestsrc ! 'video/x-raw, format=(string)NV12, width=640, height=480' ! ce_mpeg4enc ! queue ! perf ! qtmux ! filesink location=test.mp4

Video capture H-264

gst-launch-1.0 v4l2src ! 'video/x-raw, format=(string)NV12, width=640, height=480' ! ce_h264enc ! queue ! perf ! qtmux ! filesink location=test.mp4

Video capture JPEG

gst-launch-1.0  -e v4l2src ! "video/x-raw, format=(string)NV12, width=640, height=480" ! ce_jpegenc num-out-buffers=5 ! perf ! queue ! qtmux ! filesink location=test.mov

Video capture MPEG-4

gst-launch-1.0 v4l2src ! 'video/x-raw, format=(string)NV12, width=640, height=480' ! ce_mpeg4enc ! queue ! perf ! qtmux ! filesink location=test.mp4

RTP Video Streaming

These instructions show how to do video streaming over the network, a video will be played on the board and viewed on the host. These pipelines use the default port (5004) to send the packets, if you want to change the port number, you have to add the port capability to the udpsink.(e.g udpsink port=$PORT host=$CLIENT_IP). Also you need to change the $CLIENT_IP with your PC IP address.

Stream H.264 video test pattern over RTP

  • Server: DM36x
CLIENT_IP=10.251.101.15

gst-launch-1.0 videotestsrc ! 'video/x-raw, format=(string)NV12, width=640, height=480' ! ce_h264enc ! queue ! perf ! rtph264pay ! udpsink host=$CLIENT_IP -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:

.
.
.
/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)"Z2QAKK2EBUViuKxUdCAqKxXFYqOhAVFYrisVHQgKisVxWKjoQFRWK4rFR0ICorFcVio6ECSFITk8nyfk/k/J8nm5s00IEkKQnJ5Pk/J/J+T5PNzZprQFAeyA\,aO48sA\=\=", payload=(int)96, ssrc=(uint)4233943575, timestamp-offset=(uint)1898570266, seqnum-offset=(uint)17587
/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)"Z2QAKK2EBUViuKxUdCAqKxXFYqOhAVFYrisVHQgKisVxWKjoQFRWK4rFR0ICorFcVio6ECSFITk8nyfk/k/J8nm5s00IEkKQnJ5Pk/J/J+T5PNzZprQFAeyA\,aO48sA\=\=", payload=(int)96, ssrc=(uint)4233943575, timestamp-offset=(uint)1898570266, seqnum-offset=(uint)17587
/GstPipeline:pipeline0/GstRtpH264Pay:rtph264pay0.GstPad:sink: caps = video/x-h264, framerate=(fraction)30/1, width=(int)640, height=(int)480, stream-format=(string)avc, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, codec_data=(buffer)01640028ffe1005a67640028ad84054562b8ac5474202a2b15c562a3a1015158ae2b151d080a8ac57158a8e84054562b8ac5474202a2b15c562a3a10248521393c9f27e4fe4fc9f279b9b34d081242909c9e4f93f27f27e4f93cdcd9a6b40501ec8001000468ee3cb0
/GstPipeline:pipeline0/GstPerf:perf0.GstPad:sink: caps = video/x-h264, framerate=(fraction)30/1, width=(int)640, height=(int)480, stream-format=(string)avc, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, codec_data=(buffer)01640028ffe1005a67640028ad84054562b8ac5474202a2b15c562a3a1015158ae2b151d080a8ac57158a8e84054562b8ac5474202a2b15c562a3a10248521393c9f27e4fe4fc9f279b9b34d081242909c9e4f93f27f27e4f93cdcd9a6b40501ec8001000468ee3cb0
INFO:
Timestamp: 0:19:26.964064729; Bps: 0; fps: 0.0
.
.
.                                                                       

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

  • Client: Ubuntu PC

Copy the udpsink sink pad 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)"Z2QAKK2EBUViuKxUdCAqKxXFYqOhAVFYrisVHQgKisVxWKjoQFRWK4rFR0ICorFcVio6ECSFITk8nyfk/k/J8nm5s00IEkKQnJ5Pk/J/J+T5PNzZprQFAeyA\,aO48sA\=\=",\
payload=(int)96, ssrc=607079741, timestamp-offset=3082141372, seqnum-offset=(uint)37153'


PORT=5004

gst-launch udpsrc port=$PORT ! $CAPS ! rtph264depay ! queue ! ffdec_h264 ! fpsdisplaysink sync=false

Stream JPEG video test pattern over RTP

  • Server: DM36x
CLIENT_IP=10.251.101.14
gst-launch-1.0 videotestsrc ! 'video/x-raw, format=(string)NV12, width=640, height=480' ! ce_jpegenc num-out-buffers=5 ! perf ! queue ! rtpjpegpay ! host=$CLIENT_IP -v
  • Client: Ubuntu PC
PORT=5004
gst-launch udpsrc port=$PORT ! 'application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)JPEG, payload=(int)96' ! rtpjpegdepay ! decodebin ! fpsdisplaysink sync=false

Stream MPEG-4 video test pattern over RTP

  • Server: DM36x
CLIENT_IP=10.251.101.14
gst-launch-1.0 videotestsrc ! 'video/x-raw, format=(string)NV12, width=640, height=480' ! ce_mpeg4enc ! queue ! perf ! rtpmp4vpay ! udpsink host=$CLIENT_IP
  • Client: Ubuntu PC

Stream H.264 encoded video capture over RTP

  • Server: DM36x
CLIENT_IP=10.251.101.14
gst-launch-1.0 v4l2src ! 'video/x-raw, format=(string)NV12, width=640, height=480' ! ce_h264enc ! queue ! perf ! rtph264pay ! udpsink host=$CLIENT_IP
  • Client: Ubuntu PC
PORT=5004
gst-launch-0.10 udpsrc port=$PORT ! 'application/x-rtp, media=video, clock-rate=90000, encoding-name=H264, \
sprop-parameter-sets="Z2QAKK2EBUViuKxUdCAqKxXFYqOhAVFYrisVHQgKisVxWKjoQFRWK4rFR0ICorFcVio6ECSFITk8nyfk/k/J8nm5s00IEkKQnJ5Pk/J/J+T5PNzZprQFAeyA\,aO48sA\=\=", \
 payload=96' ! rtph264depay ! decodebin ! fpsdisplaysink sync=false

Stream JPEG encoded video capture over RTP

  • Server: DM36x
CLIENT_IP=10.251.101.14
gst-launch-1.0 v4l2src ! 'video/x-raw, format=(string)NV12, width=640, height=480' ! ce_jpegenc num-out-buffers=5 ! perf ! queue ! rtpjpegpay ! udpsink host=$CLIENT_IP -v
  • Client: Ubuntu PC
PORT=5004
gst-launch udpsrc port=$PORT ! 'application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)JPEG, payload=(int)96' ! rtpjpegdepay ! decodebin ! fpsdisplaysink sync=false

Stream MPEG-4 encoded video capture over RTP

  • Server: DM36x
CLIENT_IP=10.251.101.14
gst-launch-1.0 v4l2src ! 'video/x-raw, format=(string)NV12, width=640, height=480' ! ce_mpeg4enc ! queue ! perf ! rtpmp4vpay ! udpsink host=$CLIENT_IP
  • Client: Ubuntu PC

Stream H-264 encoded video and display video with Dual Resizer

gst-launch-1.0 -e v4l2src chain-ipipe=false max-num-buffers=5 ! 'video/x-raw,format=(string)NV12,width=640,height=480' ! queue ! dualresizer name=drs drs.rsza ! perf ! ce_h264enc target-bitrate=
3000000 ! rtph264pay ! udpsink port=5000 host=10.251.101.14 drs.rszb ! queue ! 'video/x-raw,format=(string)UYVY,width=320,height=240' ! perf ! v4l2sink device=/dev/video2 max-num-buffers=3

Display video and record JPEG encoded video with Dual Resizer

gst-launch-1.0 -e v4l2src chain-ipipe=false max-num-buffers=6 ! 'video/x-raw,format=(string)UYVY,width=640,height=480' ! dualresizer name=drs drs.rsza ! perf ! v4l2sink device=/dev/video2 
max-num-buffers=3 drs.rszb ! queue ! 'video/x-raw,format=(string)UYVY,width=320,height=240' ! perf ! ce_jpegenc ! qtmux ! filesink location=testA.mov async=false enable-last-sample=false -v