Jetson Nano - Gstreamer - Example Pipelines - Transforming

From RidgeRun Developer Wiki


Previous: Gstreamer/Example_Pipelines/Streaming Index Next: Contact_Us






Problems running the pipelines shown on this page? Please see our GStreamer Debugging guide for help.



Video Composition

The following pipeline shows 4 videotestsrc in a 2x2 grid

WIDTH=320
HEIGHT=240
CAPS="video/x-raw, width=$WIDTH, height=$HEIGHT"

gst-launch-1.0 nvcompositor name=comp sink_0::xpos=0 sink_0::ypos=0 sink_0::width=$WIDTH sink_0::height=$HEIGHT sink_1::xpos=$WIDTH sink_1::ypos=0 sink_1::width=$WIDTH sink_1::height=$HEIGHT sink_2::xpos=0 sink_2::ypos=$HEIGHT sink_2::width=$WIDTH sink_2::height=$HEIGHT sink_3::xpos=$WIDTH sink_3::ypos=$HEIGHT sink_3::width=$WIDTH sink_3::height=$HEIGHT ! nvoverlaysink videotestsrc is-live=true ! $CAPS ! comp. videotestsrc is-live=true pattern=ball ! $CAPS ! comp. videotestsrc is-live=true pattern=ball ! $CAPS ! comp. videotestsrc is-live=true ! $CAPS ! comp.

Notice that sink_<n>::xpos and sink_<n>::ypos determine the position of the sink <n>. Also, you can change each stream size if required with sink_<n>::width and sink_<n>::height, on this example we are keeping the resolution unchanged.

Example of a 4x2 grid using one camera:

WIDTH=1280
HEIGHT=720
gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=$WIDTH,height=$HEIGHT,format=UYVY' ! \
nvvidconv ! 'video/x-raw(memory:NVMM), width=(int)$WIDTH, height=(int)$HEIGHT, framerate=(fraction)60/1' ! queue ! tee name=t \
t. ! queue ! comp. \
t. ! queue ! comp. \
t. ! queue ! comp. \
t. ! queue ! comp. \
t. ! queue ! comp. \
t. ! queue ! comp. \
t. ! queue ! comp. \
t. ! queue ! comp. \
nvcompositor name=comp \
sink_0::xpos=0 sink_0::ypos=0 sink_0::width=160 sink_0::height=120 \
sink_1::xpos=160 sink_1::ypos=0 sink_1::width=160 sink_1::height=120 \
sink_2::xpos=320 sink_2::ypos=0 sink_2::width=160 sink_2::height=120 \
sink_3::xpos=480 sink_3::ypos=0 sink_3::width=160 sink_3::height=120 \
sink_4::xpos=0 sink_4::ypos=120 sink_4::width=160 sink_4::height=120 \
sink_5::xpos=160 sink_5::ypos=120 sink_5::width=160 sink_5::height=120 \
sink_6::xpos=320 sink_6::ypos=120 sink_6::width=160 sink_6::height=120 \
sink_7::xpos=480 sink_7::ypos=120 sink_7::width=160 sink_7::height=120 ! nvoverlaysink

Video Conversion

Change Format

Following pipeline changes format from NV12 to RGBA:

gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=1920, height=1080, format=NV12, framerate=30/1' !  nvvidconv ! 'video/x-raw(memory:NVMM),format=RGBA' !  nvoverlaysink


Scale

Following pipeline scales down camera capture from 1080p to 720p

gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=1920, height=1080, format=NV12, framerate=30/1' !  nvvidconv ! 'video/x-raw(memory:NVMM),width=640,height=480' !  nvoverlaysink


Rotation

gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=640, height=480, format=NV12, framerate=30/1' !  nvvidconv flip-method=clockwise !  nvoverlaysink


Previous: Gstreamer/Example_Pipelines/Streaming Index Next: Contact_Us