IMX6 GStreamer-1.0 Pipelines

From RidgeRun Developer Connection
Jump to: navigation, search

Introduction

The following examples show the usage of GStreamer-1.0 with the RidgeRun SDK Irazu SDK for all the supported iMX6 based boards.

At the moment of this writing, the RidgeRun SDK is supports the latest Freescale GStreamer 1.0 plugins. There are two available video sinks, imxipuvideosink (using the IPU) and imxg2dvideosink (using the GPU).

Some of these pipelines have to be run on the target board and other in your computer, they are distinguished by the colour used to document them, blue pipelines are for the Boundary Devices iMX6 Nitrogen board, iMX6 Sabrelite board, Varscite iMX6 board and green pipelines have to be run in your PC

Pipelines

Display videotest pattern

Tested on
Boundary Devices iMX6 Nitrogen board
Boundary Devices iMX6 Sabrelite board

gst-launch-1.0 -v videotestsrc ! imxv4l2sink
gst-launch-1.0 -v videotestsrc ! imxeglvivsink force-aspect-ratio=false
  • using the IPU based video sink
gst-launch-1.0 -v videotestsrc ! imxipuvideosink force-aspect-ratio=false
  • Using the GPU based video sink
gst-launch-1.0 -v videotestsrc ! imxg2dvideosink force-aspect-ratio=false

Video playback

Tested on
Boundary Devices iMX6 Nitrogen board
Boundary Devices iMX6 Sabrelite board

gst-launch-1.0 -v filesrc location=test.mp4 typefind=true ! qtdemux ! queue ! vpudec ! imxv4l2sink
gst-launch-1.0 -v filesrc location=test.mp4 typefind=true ! qtdemux ! queue ! vpudec ! overlaysink

Capture and Display

USB camera

Tested on Boundary Devices iMX6 Nitrogen board

gst-launch-1.0 -v imxfslv4l2src device=/dev/video4 ! imxv4l2sink
  • with IPU based video sink
gst-launch-1.0 -v imxfslv4l2src device=/dev/video4 ! imxipuvideosink force-aspect-ratio=false
  • with GPU based video sink
gst-launch-1.0 -v imxfslv4l2src device=/dev/video4 ! imxg2dvideosink force-aspect-ratio=false

OV5640 MIPI camera

Tested on Boundary Devices iMX6 Nitrogen board

gst-launch-1.0 -v imxfslv4l2src device=/dev/video1 ! imxv4l2sink
  • 720p60 loopback
CAPS="video/x-raw, width=1280, height=720, framerate=30/1"

gst-launch-1.0 -v imxfslv4l2src device=/dev/video1 ! capsfilter caps="$CAPS" ! queue ! imxv4l2sink
  • 1080p60 loopback
CAPS="video/x-raw, width=1920, height=1080, framerate=60/1"

gst-launch-1.0 -v imxfslv4l2src device=/dev/video1 ! capsfilter caps="$CAPS" ! queue ! imxv4l2sink

Video H264 Encoding

Tested on
Boundary Devices iMX6 Nitrogen board
Boundary Devices iMX6 Sabrelite board

Videotestsrc H-264 codec in avi container

gst-launch-1.0 -e videotestsrc ! queue ! vpuenc ! avimux ! filesink location=test.avi

Videotestsrc H-264 codec in matroska container

gst-launch-1.0 -e videotestsrc ! queue ! vpuenc ! matroskamux ! filesink location=test.mkv

Video Capture Encoding

imxfslv4l2src H-264 codec in matroska container

CAPS="video/x-h264"

gst-launch-1.0 -e imxfslv4l2src device=/dev/video4 ! videoconvert ! queue ! vpuenc ! \
                  capsfilter caps="$CAPS" ! matroskamux ! filesink location=test.mkv 

Video Overlay

with video 1

Tested on
Boundary Devices iMX6 Nitrogen board
Boundary Devices iMX6 Sabrelite board

WINDOW="window-x-coord=0 window-y-coord=0 window-width=320 window-height=240"

gst-launch-1.0 filesrc location=video1.mp4 typefind=true ! qtdemux ! queue ! vpudec ! \
               imxg2dvideosink $WINDOW

with video 2

Tested on
Boundary Devices iMX6 Nitrogen board
Boundary Devices iMX6 Sabrelite board

WINDOW="window-x-coord=0 window-y-coord=340 window-width=320 window-height=240"

gst-launch-1.0 filesrc location=Video2.mp4 typefind=true ! qtdemux ! queue ! vpudec ! \
               imxg2dvideosink $WINDOW

Tested on
Boundary Devices iMX6 Nitrogen board
Boundary Devices iMX6 Sabrelite board

with v5640 MIPI camera

CAPS="video/x-raw, width=1280, height=720, framerate=30/1"
WINDOW="window-x-coord=0 window-y-coord=340 window-width=320 window-height=240"

gst-launch-1.0 -v imxfslv4l2src device=/dev/video1 ! capsfilter caps="$CAPS" ! queue ! \
                  imxg2dvideosink $WINDOW

Streaming User Datagram Protocol (UDP)

Server

RECEIVER_IP=localhost
gst-launch-1.0 v4l2src ! queue ! x264enc ! mpegtsmux ! rndbuffersize min=1316 max=1316 ! udpsink host=$RECEIVER_IP 

Client

RECEIVER_IP=localhost
gst-launch-1.0 udpsrc address=$RECEIVER_IP ! tsdemux ! queue ! "video/x-h2 64" ! vpudec ! imxv4l2sink 

Audio capture and play

Tested on
Boundary Devices iMX6 Nitrogen board
Boundary Devices iMX6 Sabrelite board

gst-launch-1.0 audiotestsrc ! alsasink device=hw:1,0

Audio encoding

WAV to mp3 (WAV rate 32000, 44100, 48000)

gst-launch-1.0  filesrc location=test.wav ! wavparse ! imxmp3enc ! filesink location= test1.mp3

Compositing test

Tested on
Boundary Devices iMX6 Nitrogen board
Boundary Devices iMX6 Sabrelite board


gst-launch-1.0 imxg2dcompositor name=c background-color=0x223344 \
sink_0::xpos=0 sink_0::ypos=90 sink_0::width=160 sink_0::height=110 sink_0::zorder=55 sink_0::fill_color=0xff00ff00 sink_0::alpha=0.39 sink_0::rotation=0 \
sink_1::xpos=0 sink_1::ypos=20 sink_1::width=620 sink_1::height=380 sink_1::fill_color=0x44441133 ! \
queue2 ! "video/x-raw, width=800, height=600" ! imxg2dvideosink \
videotestsrc pattern=0 ! "video/x-raw, framerate=30/1" ! c.sink_0 \
videotestsrc pattern=18 ! "video/x-raw, framerate=30/1" ! c.sink_1
 

This creates the following frame:

Figure 2. Example compositing

Usefull Links

Gstreamer-imx