GStreamer Compositing for Streaming H.264 Video

Gateworks recently featured a blog in which 8 video cameras were connected to a Gateworks Ventana SBC and then displayed on a HDMI monitor. This is useful for localized applications. For remote applications there is another solution.

Remote applications require streaming the multiple video streams over the network (Ethernet or WiFi). For bandwidth efficiency, all camera inputs can be joined together into a single frame and then transmitted across the network.

streamingdiagram3

To join all the streams into a single frame, a software element of GStreamercalled a compositor is used. Older versions of the compositor relied on the CPU and caused choppy video. Gateworks recently started using gstreamer-imx which contains a hardware accelerated compositor which is far superior. With this compositor, each stream can be positioned on the frame and then linked to a RTSP stream in the H.264 format.

An example is shown with two Gateworks Ventana SBCs that are on the same network.

Start the following pipeline on the SBC with the cameras connected:

gst-variable-rtsp-server -u \ "imxv4l2videosrc device=/dev/video2 queue-size=55 ! queue2 ! c.sink_0 \ imxv4l2videosrc device=/dev/video3 queue-size=55 ! queue2 ! c.sink_1 \ imxv4l2videosrc device=/dev/video4 queue-size=55 ! queue2 ! c.sink_2 \ imxv4l2videosrc device=/dev/video5 queue-size=55 ! queue2 ! c.sink_3 \ imxv4l2videosrc device=/dev/video6 queue-size=55 ! queue2 ! c.sink_4 \ imxv4l2videosrc device=/dev/video7 queue-size=55 ! queue2 ! c.sink_5 \ imxv4l2videosrc device=/dev/video8 queue-size=55 ! queue2 ! c.sink_6 \ imxv4l2videosrc device=/dev/video9 queue-size=55 ! queue2 ! c.sink_7 \ imxg2dcompositor name=c background-color=0xffffff \ sink_0::xpos=0 sink_0::ypos=0 sink_0::width=320 sink_0::height=360 sink_0::fill_color=0x00000000 \ sink_1::xpos=320 sink_1::ypos=0 sink_1::width=320 sink_1::height=360 sink_1::fill_color=0x00000000 \ sink_2::xpos=640 sink_2::ypos=0 sink_2::width=320 sink_2::height=360 sink_2::fill_color=0x00000000 \ sink_3::xpos=960 sink_3::ypos=0 sink_3::width=320 sink_3::height=360 sink_3::fill_color=0x00000000 \ sink_4::xpos=0 sink_4::ypos=360 sink_4::width=320 sink_4::height=360 sink_4::fill_color=0x00000000 \ sink_5::xpos=320 sink_5::ypos=360 sink_5::width=320 sink_5::height=360 sink_5::fill_color=0x00000000 \ sink_6::xpos=640 sink_6::ypos=360 sink_6::width=320 sink_6::height=360 sink_6::fill_color=0x00000000 \ sink_7::xpos=960 sink_7::ypos=360 sink_7::width=320 sink_7::height=360 sink_7::fill_color=0x00000000 \ ! queue2 ! video/x-raw, width=1280, height=720 ! imxipuvideotransform \ ! imxvpuenc_h264 bitrate=20000 ! rtph264pay name=pay0 pt=96"

Then, on the receiving board that is connected to an HDMI display, start the following pipeline with the actual IP address (example IP below) of the board with the cameras:

gst-launch-1.0 rtspsrc location=rtsp://172.24.10.210:9099/stream latency=100 ! \queue2 ! decodebin ! autovideosink

For more information andcode examples, please visit the related Gateworks Software Wiki links below:

 

Video & Audio On Gateworks Ventana Single Board Computers with Linux GStreamer

The Ventana Family of Single Board Computers from Gateworks offers a multitude of video and audio interfaces to meet the demands of new multimedia embedded systems. The primary method of accessing these interfaces is through software by the name of GStreamer. GStreamer is an open-source library that makes the handling of multimedia data more simple usingpipelines of elements that operate on multimedia data buffers. GStreamer can be used directly on the command line of a Ventana Single Board computer for quick prototyping and development with the gst-launch test application. For example, to play a video file stored on a USB flash drive connected to a Gateworks single board computer, the following GStreamer command would be used:

gst-launch filesrc location=/media/sda1/big_buck_bunny_720p_surround.avi ! decodebin2 ! mfw_v4lsink device=/dev/video16

Using GStreamer, an application can benefit from a large library of OpenSource elements that use well known algorithms to operate on multimedia data, including the elements provided by the fsl-gstreamer package that take advantage of the i.MX6 hardware acceleration. Customers can create custom applications that utilize GStreamer (above and beyond what gst-launch can provide) through the Gateworks SDK. GStreamer is a very powerful tool with thousands of options and plugins. Gateworks has created a wiki page that provides some simple examples to make getting started quickly easier on the Ventana Single Board Computers. Follow this link to the wiki for more examples and tutorials!

Gateworks GStreamer Software Wiki Page