Difference between revisions of "GStreamer Pan Tilt Zoom and Rotate Element - iMX6 Pipelines"

From RidgeRun Developer Connection
Jump to: navigation, search
m
 
(9 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{GStreamer Pan Tilt Zoom and Rotate Element Page|  
+
{{GStreamer Pan Tilt Zoom and Rotate Element/Head |previous=PC Pipelines|next=Tegra Pipelines|metakeywords=GstPTZR iMX6 Pipelines, iMX6 Pipelines, iMX6 GStreamer Pipelines, GstPTZR iMX6 GStreamer Pipelines}}
[[GStreamer Pan Tilt Zoom and Rotate Element - Examples|Examples]]|
 
[[GStreamer Pan Tilt Zoom and Rotate Element - Demo Tool|Demo Tool]]|
 
  
__TOC__
+
<br>
 
+
<br>
=== Important Considerations ===
+
<table>
 
+
<tr>
* Its important to have a constant internet connection, without internet the tests won't work.
+
<td><div class="clear; float:right">__TOC__</div></td>
* If you are facing issues with any pipeline or configuration please contact [mailto:support@ridgerun.com '''support@ridgerun.com'''] with the output of the GStreamer debug and any additional information you consider useful.
+
<td valign=top>
* To get the necessary elements to test the pipelines please refer to [[GStreamer Pan Tilt Zoom and Rotate Element - Building GstPTZR]].
+
{{GStreamer debug}}
 +
</td>
 +
</table>
  
=== Gstreamer piplines ===
+
== GStreamer pipelines ==
 
The following pipelines will send the resulting video stream via UDP to another computer where it can be displayed.
 
The following pipelines will send the resulting video stream via UDP to another computer where it can be displayed.
  
====On receiver computer====
+
===On receiver computer===
 
<syntaxhighlight lang=bash>
 
<syntaxhighlight lang=bash>
IPADDR='xx.xxx.xx.x'
+
HOST='xx.xxx.xx.x'
 
PORT=5004
 
PORT=5004
gst-launch-1.0 udpsrc address=$IPADDR port=$PORT ! tsparse ! tsdemux ! h264parse ! avdec_h264 ! videoconvert ! identity silent=false ! autovideosink -v
+
gst-launch-1.0 udpsrc address=$HOST port=$PORT ! tsparse ! tsdemux ! h264parse ! avdec_h264 ! videoconvert ! identity silent=false ! autovideosink -v
 
</syntaxhighlight>
 
</syntaxhighlight>
  
====On board====
+
===On board===
 
Same input and output resolution with zoom level 1:
 
Same input and output resolution with zoom level 1:
  
 
<syntaxhighlight lang=bash>
 
<syntaxhighlight lang=bash>
IN_CAPS='video/x-raw,format=RGBA,width=640,height=480,framerate=30/1'  
+
CAPTURE_CAPS='video/x-raw,width=640,height=480,framerate=30/1'
OUT_CAPS='video/x-raw,format=RGBA,width=640,height=480,framerate=30/1'
+
IN_CAPS='video/x-raw,format=RGBA,width=640,height=480,framerate=30/1'
gst-launch-1.0 videotestsrc pattern=circular is-live=true num-buffers=-1 ! capsfilter caps="$IN_CAPS" ! ptzr ! capsfilter caps="$OUT_CAPS" ! videoconvert ! xvimagesink
+
OUT_CAPS='video/x-raw,width=640,height=480'
 +
PORT=5004
 +
HOST=<IP address>
 +
gst-launch-1.0 videotestsrc is-live=true num-buffers=-1 ! $IN_CAPS ! imxg2dvideotransform ! $IN_CAPS ! ptzr ! $OUT_CAPS ! imxipuvideotransform input-crop=false ! $OUT_CAPS ! imxvpuenc_h264 bitrate=4000 gop-size=15 idr-interval=15 ! mpegtsmux alignment=7 ! udpsink port=$PORT host=$HOST
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Line 34: Line 37:
 
Magnification (zoom level > 1):
 
Magnification (zoom level > 1):
 
<syntaxhighlight lang=bash>
 
<syntaxhighlight lang=bash>
IN_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1'  
+
CAPTURE_CAPS='video/x-raw,width=640,height=480,framerate=30/1'
OUT_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1'
+
IN_CAPS='video/x-raw,format=RGBA,width=640,height=480,framerate=30/1'
gst-launch-1.0 videotestsrc pattern=circular is-live=true num-buffers=-1 ! capsfilter caps="$IN_CAPS" ! ptzr zoom-level=2 ! capsfilter caps="$OUT_CAPS" ! videoconvert ! xvimagesink
+
OUT_CAPS='video/x-raw,width=640,height=480'
</syntaxhighlight>
+
PORT=5004
 +
HOST=<IP address>
  
Reduction (zoom level < 1)
+
gst-launch-1.0 videotestsrc is-live=true num-buffers=-1 ! $IN_CAPS ! imxg2dvideotransform ! $IN_CAPS ! ptzr zoom-level=2 ! $OUT_CAPS ! imxipuvideotransform input-crop=false ! $OUT_CAPS ! imxvpuenc_h264 bitrate=4000 gop-size=15 idr-interval=15 ! mpegtsmux alignment=7 ! udpsink port=$PORT host=$HOST
<syntaxhighlight lang=bash>
 
IN_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1'
 
OUT_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1'
 
gst-launch-1.0 videotestsrc pattern=circular is-live=true num-buffers=-1 ! capsfilter caps="$IN_CAPS" ! ptzr zoom-level=0 ! capsfilter caps="$OUT_CAPS" ! videoconvert ! xvimagesink
 
 
</syntaxhighlight>
 
</syntaxhighlight>
  
You can perform translations relative to the center of the input image by setting the "pan-level" and "tilt-level" properties or perform translations relative to the current position with "pan-delta" and "tilt-delta".
+
You can perform translations relative to the center of the input image by setting the "pan-level" and "tilt-level" properties or perform translations relative to the current position with "pan-delta" and "tilt-delta". The element supports input and output of any resolution and aspect ratio.
  
 
Translate right (-1 < pan level < 0):
 
Translate right (-1 < pan level < 0):
 
<syntaxhighlight lang=bash>
 
<syntaxhighlight lang=bash>
IN_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1'  
+
CAPTURE_CAPS='video/x-raw,width=640,height=480,framerate=30/1'
OUT_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1'
+
IN_CAPS='video/x-raw,format=RGBA,width=640,height=480,framerate=30/1'
gst-launch-1.0 videotestsrc pattern=circular is-live=true num-buffers=-1 ! capsfilter caps="$IN_CAPS" ! ptzr pan-level=-1 ! capsfilter caps="$OUT_CAPS" ! videoconvert ! xvimagesink
+
OUT_CAPS='video/x-raw,width=320,height=240'
 +
PORT=5004
 +
HOST=<IP address>
 +
 
 +
gst-launch-1.0 videotestsrc is-live=true num-buffers=-1 ! $IN_CAPS ! imxg2dvideotransform ! $IN_CAPS ! ptzr pan-level=-1 ! $OUT_CAPS ! imxipuvideotransform input-crop=false ! $OUT_CAPS ! imxvpuenc_h264 bitrate=4000 gop-size=15 idr-interval=15 ! mpegtsmux alignment=7 ! udpsink port=$PORT host=$HOST
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
Translate left (0 < pan level < 1):
 
Translate left (0 < pan level < 1):
 
<syntaxhighlight lang=bash>
 
<syntaxhighlight lang=bash>
IN_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1'  
+
CAPTURE_CAPS='video/x-raw,width=640,height=480,framerate=30/1'
OUT_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1'
+
IN_CAPS='video/x-raw,format=RGBA,width=640,height=480,framerate=30/1'
gst-launch-1.0 videotestsrc pattern=circular is-live=true num-buffers=-1 ! capsfilter caps="$IN_CAPS" ! ptzr pan-level=1 ! capsfilter caps="$OUT_CAPS" ! videoconvert ! xvimagesink
+
OUT_CAPS='video/x-raw,width=320,height=240'
 +
PORT=5004
 +
HOST=<IP address>
 +
 
 +
gst-launch-1.0 videotestsrc is-live=true num-buffers=-1 ! $IN_CAPS ! imxg2dvideotransform ! $IN_CAPS ! ptzr pan-level=1 ! $OUT_CAPS ! imxipuvideotransform input-crop=false ! $OUT_CAPS ! imxvpuenc_h264 bitrate=4000 gop-size=15 idr-interval=15 ! mpegtsmux alignment=7 ! udpsink port=$PORT host=$HOST
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
Translate down (-1 < tilt level < 0):
 
Translate down (-1 < tilt level < 0):
 
<syntaxhighlight lang=bash>
 
<syntaxhighlight lang=bash>
IN_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1'  
+
CAPTURE_CAPS='video/x-raw,width=640,height=480,framerate=30/1'
OUT_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1'
+
IN_CAPS='video/x-raw,format=RGBA,width=640,height=480,framerate=30/1'
gst-launch-1.0 videotestsrc pattern=circular is-live=true num-buffers=-1 ! capsfilter caps="$IN_CAPS" ! ptzr tilt-level=-1 ! capsfilter caps="$OUT_CAPS" ! videoconvert ! xvimagesink
+
OUT_CAPS='video/x-raw,width=320,height=240'
 +
PORT=5004
 +
HOST=<IP address>
 +
 
 +
gst-launch-1.0 videotestsrc is-live=true num-buffers=-1 ! $IN_CAPS ! imxg2dvideotransform ! $IN_CAPS ! ptzr tilt-level=-1 ! $OUT_CAPS ! imxipuvideotransform input-crop=false ! $OUT_CAPS ! imxvpuenc_h264 bitrate=4000 gop-size=15 idr-interval=15 ! mpegtsmux alignment=7 ! udpsink port=$PORT host=$HOST
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
Translate up (0 < tilt level < 1):
 
Translate up (0 < tilt level < 1):
 
<syntaxhighlight lang=bash>
 
<syntaxhighlight lang=bash>
IN_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1'  
+
CAPTURE_CAPS='video/x-raw,width=640,height=480,framerate=30/1'
OUT_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1'
+
IN_CAPS='video/x-raw,format=RGBA,width=640,height=480,framerate=30/1'
gst-launch-1.0 videotestsrc pattern=circular is-live=true num-buffers=-1 ! capsfilter caps="$IN_CAPS" ! ptzr tilt-level=100 ! capsfilter caps="$OUT_CAPS" ! videoconvert ! xvimagesink
+
OUT_CAPS='video/x-raw,width=320,height=240'
 +
PORT=5004
 +
HOST=<IP address>
 +
 
 +
gst-launch-1.0 videotestsrc is-live=true num-buffers=-1 ! $IN_CAPS ! imxg2dvideotransform ! $IN_CAPS ! ptzr tilt-level=1 ! $OUT_CAPS ! imxipuvideotransform input-crop=false ! $OUT_CAPS ! imxvpuenc_h264 bitrate=4000 gop-size=15 idr-interval=15 ! mpegtsmux alignment=7 ! udpsink port=$PORT host=$HOST
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Line 80: Line 96:
 
Turn off translation normalization:
 
Turn off translation normalization:
 
<syntaxhighlight lang=bash>
 
<syntaxhighlight lang=bash>
IN_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1'  
+
CAPTURE_CAPS='video/x-raw,width=640,height=480,framerate=30/1'
OUT_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1'
+
IN_CAPS='video/x-raw,format=RGBA,width=640,height=480,framerate=30/1'
gst-launch-1.0 videotestsrc pattern=circular is-live=true num-buffers=-1 ! capsfilter caps="$IN_CAPS" ! ptzr normalize-translation=false ! capsfilter caps="$OUT_CAPS" ! videoconvert ! xvimagesink
+
OUT_CAPS='video/x-raw,width=320,height=240'
 +
PORT=5004
 +
HOST=<IP address>
 +
 
 +
gst-launch-1.0 videotestsrc is-live=true num-buffers=-1 ! $IN_CAPS ! imxg2dvideotransform ! $IN_CAPS ! ptzr normalize-translation=false ! $OUT_CAPS ! imxipuvideotransform input-crop=false ! $OUT_CAPS ! imxvpuenc_h264 bitrate=4000 gop-size=15 idr-interval=15 ! mpegtsmux alignment=7 ! udpsink port=$PORT host=$HOST
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Line 89: Line 109:
 
Set input coordinate system as reference for translations:
 
Set input coordinate system as reference for translations:
 
<syntaxhighlight lang=bash>
 
<syntaxhighlight lang=bash>
IN_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1'  
+
CAPTURE_CAPS='video/x-raw,width=640,height=480,framerate=30/1'
OUT_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1'
+
IN_CAPS='video/x-raw,format=RGBA,width=640,height=480,framerate=30/1'
gst-launch-1.0 videotestsrc pattern=circular is-live=true num-buffers=-1 ! capsfilter caps="$IN_CAPS" ! ptzr output-reference=false ! capsfilter caps="$OUT_CAPS" ! videoconvert ! xvimagesink
+
OUT_CAPS='video/x-raw,width=320,height=240'
 +
PORT=5004
 +
HOST=<IP address>
 +
 
 +
gst-launch-1.0 videotestsrc is-live=true num-buffers=-1 ! $IN_CAPS ! imxg2dvideotransform ! $IN_CAPS ! ptzr output-reference=false ! $OUT_CAPS ! imxipuvideotransform input-crop=false ! $OUT_CAPS ! imxvpuenc_h264 bitrate=4000 gop-size=15 idr-interval=15 ! mpegtsmux alignment=7 ! udpsink port=$PORT host=$HOST
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Line 98: Line 122:
 
Rotate counter-clockwise (rotate level < 0):
 
Rotate counter-clockwise (rotate level < 0):
 
<syntaxhighlight lang=bash>
 
<syntaxhighlight lang=bash>
IN_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1'  
+
CAPTURE_CAPS='video/x-raw,width=640,height=480,framerate=30/1'
OUT_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1'
+
IN_CAPS='video/x-raw,format=RGBA,width=640,height=480,framerate=30/1'
gst-launch-1.0 videotestsrc pattern=circular is-live=true num-buffers=-1 ! capsfilter caps="$IN_CAPS" ! ptzr rotate-level=-100 ! capsfilter caps="$OUT_CAPS" ! videoconvert ! xvimagesink
+
OUT_CAPS='video/x-raw,width=320,height=240'
 +
PORT=5004
 +
HOST=<IP address>
 +
 
 +
gst-launch-1.0 videotestsrc is-live=true num-buffers=-1 ! $IN_CAPS ! imxg2dvideotransform ! $IN_CAPS ! ptzr rotate-level=-100 ! $OUT_CAPS ! imxipuvideotransform input-crop=false ! $OUT_CAPS ! imxvpuenc_h264 bitrate=4000 gop-size=15 idr-interval=15 ! mpegtsmux alignment=7 ! udpsink port=$PORT host=$HOST
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
Rotate clockwise (rotate level > 0):
 
Rotate clockwise (rotate level > 0):
 
<syntaxhighlight lang=bash>
 
<syntaxhighlight lang=bash>
IN_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1'  
+
CAPTURE_CAPS='video/x-raw,width=640,height=480,framerate=30/1'
OUT_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1'
+
IN_CAPS='video/x-raw,format=RGBA,width=640,height=480,framerate=30/1'
gst-launch-1.0 videotestsrc pattern=circular is-live=true num-buffers=-1 ! capsfilter caps="$IN_CAPS" ! ptzr rotate-level=100 ! capsfilter caps="$OUT_CAPS" ! videoconvert ! xvimagesink
+
OUT_CAPS='video/x-raw,width=320,height=240'
</syntaxhighlight>
+
PORT=5004
 
+
HOST=<IP address>
The element supports input and output of any resolution and aspect ratio
 
  
Smaller input image, different aspect ratio:
+
gst-launch-1.0 videotestsrc is-live=true num-buffers=-1 ! $IN_CAPS ! imxg2dvideotransform ! $IN_CAPS ! ptzr rotate-level=100 ! $OUT_CAPS ! imxipuvideotransform input-crop=false ! $OUT_CAPS ! imxvpuenc_h264 bitrate=4000 gop-size=15 idr-interval=15 ! mpegtsmux alignment=7 ! udpsink port=$PORT host=$HOST
<syntaxhighlight lang=bash>
 
IN_CAPS='video/x-raw,format=RGBA,width=1024,height=768,framerate=30/1'
 
OUT_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1'
 
gst-launch-1.0 videotestsrc pattern=circular is-live=true num-buffers=-1 ! capsfilter caps="$IN_CAPS" ! ptzr zoom-level=1 ! capsfilter caps="$OUT_CAPS" ! videoconvert ! xvimagesink
 
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Bigger input image, different aspect ratio:
+
== Gstd pipelines ==
<syntaxhighlight lang=bash>
 
IN_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1'
 
OUT_CAPS='video/x-raw,format=RGBA,width=1280,height=1024,framerate=30/1'
 
gst-launch-1.0 videotestsrc pattern=circular is-live=true num-buffers=-1 ! capsfilter caps="$IN_CAPS" ! ptzr zoom-level=1 ! capsfilter caps="$OUT_CAPS" ! videoconvert ! xvimagesink
 
</syntaxhighlight>
 
You can use ranges for input and output caps or leave them unspecified
 
 
 
Resolution range:
 
<syntaxhighlight lang=bash>
 
IN_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1'
 
OUT_CAPS='video/x-raw,format=RGBA,width=[480,1280],height=[680,1024],framerate=30/1'
 
gst-launch-1.0 videotestsrc pattern=circular is-live=true num-buffers=-1 ! capsfilter caps="$IN_CAPS" ! ptzr zoom-level=1 ! capsfilter caps="$OUT_CAPS" ! videoconvert ! xvimagesink
 
</syntaxhighlight>
 
 
 
Unspecified caps:
 
<syntaxhighlight lang=bash>
 
IN_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1'
 
gst-launch-1.0 videotestsrc pattern=circular is-live=true num-buffers=-1 ! capsfilter caps="$IN_CAPS" ! ptzr zoom-level=1 ! videoconvert ! xvimagesink
 
</syntaxhighlight>
 
  
=== Gstd pipelines ===
 
For testing this pipeline you need to install the Gstd daemon at host. Please refer [[GStreamer Daemon - Building GStreamer Daemon]] guide for Getting the Code,Setup,Build and Install the daemon at host. <br>
 
Also make it ensure GST_PLUGIN_PATH is set properly from where you run the Gstd daemon using the command <br>
 
'''echo $GST_PLUGIN_PATH''' <br> <br>
 
 
Run the element with gstd to change parameters dynamically:  
 
Run the element with gstd to change parameters dynamically:  
 
<br>
 
<br>
 
<syntaxhighlight lang=bash>
 
<syntaxhighlight lang=bash>
IN_CAPS='video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1'  
+
CAPTURE_CAPS='video/x-raw,width=640,height=480,framerate=30/1'
OUT_CAPS='video/x-raw,format=RGBA,width=1600,height=900,framerate=30/1'
+
IN_CAPS='video/x-raw,format=RGBA,width=640,height=480,framerate=30/1'
 +
OUT_CAPS='video/x-raw,width=320,height=240'
 +
PORT=5004
 +
HOST=<IP address>
 
gstd&
 
gstd&
gstd-client pipeline_create p0 videotestsrc pattern=circular is-live=true num-buffers=-1 ! capsfilter caps="$IN_CAPS" ! ptzr name=ptzr0 ! capsfilter caps="$OUT_CAPS" ! videoconvert ! xvimagesink
+
gstd-client pipeline_create p0 videotestsrc is-live=true num-buffers=-1 ! $IN_CAPS ! imxg2dvideotransform ! $IN_CAPS ! ptzr name=ptzr0 ! $OUT_CAPS ! imxipuvideotransform input-crop=false ! $OUT_CAPS ! imxvpuenc_h264 bitrate=4000 gop-size=15 idr-interval=15 ! mpegtsmux alignment=7 ! udpsink port=$PORT host=$HOST
 
gstd-client pipeline_play p0
 
gstd-client pipeline_play p0
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 189: Line 192:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
== iMX6 pipelines ==
+
{{GStreamer Pan Tilt Zoom and Rotate Element/Foot |previous=PC Pipelines|next=Tegra Pipelines}}
 
 
At target:
 
 
 
<syntaxhighlight lang=bash>
 
IN_CAPS='video/x-raw,width=640,height=480,framerate=30/1'
 
OUT_CAPS='video/x-raw,format=RGBA,width=200,height=200,framerate=30/1'
 
ZOOM_LEVEL=2
 
IPADDR='10.251.101.43'
 
 
 
LD_PRELOAD=/usr/lib/libGLESv2.so gst-launch-1.0 videotestsrc is-live=true num-buffers=-1 ! capsfilter caps="$IN_CAPS" ! imxg2dvideotransform ! capsfilter caps="${IN_CAPS},format=RGBA" ! queue ! ptzr zoom-level=$ZOOM_LEVEL ! capsfilter caps="$OUT_CAPS" ! perf ! imxipuvideotransform input-crop=false ! capsfilter caps="$OUT_CAPS" ! perf ! imxvpuenc_h264 name=encoder bitrate=4000 gop-size=15 idr-interval=15 ! mpegtsmux alignment=7 ! udpsink port=5004 host=$IPADDR --gst-debug=*ptzr*:4
 
</syntaxhighlight>
 
 
 
At host:
 
 
 
 
 
 
 
}}
 

Latest revision as of 03:55, 4 March 2023


Previous: PC Pipelines Index Next: Tegra Pipelines






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

GStreamer pipelines

The following pipelines will send the resulting video stream via UDP to another computer where it can be displayed.

On receiver computer

HOST='xx.xxx.xx.x'
PORT=5004
gst-launch-1.0 udpsrc address=$HOST port=$PORT ! tsparse ! tsdemux ! h264parse ! avdec_h264 ! videoconvert ! identity silent=false ! autovideosink -v

On board

Same input and output resolution with zoom level 1:

CAPTURE_CAPS='video/x-raw,width=640,height=480,framerate=30/1'
IN_CAPS='video/x-raw,format=RGBA,width=640,height=480,framerate=30/1'
OUT_CAPS='video/x-raw,width=640,height=480'
PORT=5004
HOST=<IP address>
gst-launch-1.0 videotestsrc is-live=true num-buffers=-1 ! $IN_CAPS ! imxg2dvideotransform ! $IN_CAPS ! ptzr ! $OUT_CAPS ! imxipuvideotransform input-crop=false ! $OUT_CAPS ! imxvpuenc_h264 bitrate=4000 gop-size=15 idr-interval=15 ! mpegtsmux alignment=7 ! udpsink port=$PORT host=$HOST

You can change the zoom level by changing "zoom-level".

Magnification (zoom level > 1):

CAPTURE_CAPS='video/x-raw,width=640,height=480,framerate=30/1'
IN_CAPS='video/x-raw,format=RGBA,width=640,height=480,framerate=30/1'
OUT_CAPS='video/x-raw,width=640,height=480'
PORT=5004
HOST=<IP address>

gst-launch-1.0 videotestsrc is-live=true num-buffers=-1 ! $IN_CAPS ! imxg2dvideotransform ! $IN_CAPS ! ptzr zoom-level=2 ! $OUT_CAPS ! imxipuvideotransform input-crop=false ! $OUT_CAPS ! imxvpuenc_h264 bitrate=4000 gop-size=15 idr-interval=15 ! mpegtsmux alignment=7 ! udpsink port=$PORT host=$HOST

You can perform translations relative to the center of the input image by setting the "pan-level" and "tilt-level" properties or perform translations relative to the current position with "pan-delta" and "tilt-delta". The element supports input and output of any resolution and aspect ratio.

Translate right (-1 < pan level < 0):

CAPTURE_CAPS='video/x-raw,width=640,height=480,framerate=30/1'
IN_CAPS='video/x-raw,format=RGBA,width=640,height=480,framerate=30/1'
OUT_CAPS='video/x-raw,width=320,height=240'
PORT=5004
HOST=<IP address>

gst-launch-1.0 videotestsrc is-live=true num-buffers=-1 ! $IN_CAPS ! imxg2dvideotransform ! $IN_CAPS ! ptzr pan-level=-1 ! $OUT_CAPS ! imxipuvideotransform input-crop=false ! $OUT_CAPS ! imxvpuenc_h264 bitrate=4000 gop-size=15 idr-interval=15 ! mpegtsmux alignment=7 ! udpsink port=$PORT host=$HOST

Translate left (0 < pan level < 1):

CAPTURE_CAPS='video/x-raw,width=640,height=480,framerate=30/1'
IN_CAPS='video/x-raw,format=RGBA,width=640,height=480,framerate=30/1'
OUT_CAPS='video/x-raw,width=320,height=240'
PORT=5004
HOST=<IP address>

gst-launch-1.0 videotestsrc is-live=true num-buffers=-1 ! $IN_CAPS ! imxg2dvideotransform ! $IN_CAPS ! ptzr pan-level=1 ! $OUT_CAPS ! imxipuvideotransform input-crop=false ! $OUT_CAPS ! imxvpuenc_h264 bitrate=4000 gop-size=15 idr-interval=15 ! mpegtsmux alignment=7 ! udpsink port=$PORT host=$HOST

Translate down (-1 < tilt level < 0):

CAPTURE_CAPS='video/x-raw,width=640,height=480,framerate=30/1'
IN_CAPS='video/x-raw,format=RGBA,width=640,height=480,framerate=30/1'
OUT_CAPS='video/x-raw,width=320,height=240'
PORT=5004
HOST=<IP address>

gst-launch-1.0 videotestsrc is-live=true num-buffers=-1 ! $IN_CAPS ! imxg2dvideotransform ! $IN_CAPS ! ptzr tilt-level=-1 ! $OUT_CAPS ! imxipuvideotransform input-crop=false ! $OUT_CAPS ! imxvpuenc_h264 bitrate=4000 gop-size=15 idr-interval=15 ! mpegtsmux alignment=7 ! udpsink port=$PORT host=$HOST

Translate up (0 < tilt level < 1):

CAPTURE_CAPS='video/x-raw,width=640,height=480,framerate=30/1'
IN_CAPS='video/x-raw,format=RGBA,width=640,height=480,framerate=30/1'
OUT_CAPS='video/x-raw,width=320,height=240'
PORT=5004
HOST=<IP address>

gst-launch-1.0 videotestsrc is-live=true num-buffers=-1 ! $IN_CAPS ! imxg2dvideotransform ! $IN_CAPS ! ptzr tilt-level=1 ! $OUT_CAPS ! imxipuvideotransform input-crop=false ! $OUT_CAPS ! imxvpuenc_h264 bitrate=4000 gop-size=15 idr-interval=15 ! mpegtsmux alignment=7 ! udpsink port=$PORT host=$HOST

The property "normalize-translation" (true by default) lets you switch the translation normalization ON and OFF. When translation normalization is true the minimum and maximum translation values are mapped to -1 and 1. On the other hand, when it is set to false, the pan and tilt levels reflect pixels on the input image.

Turn off translation normalization:

CAPTURE_CAPS='video/x-raw,width=640,height=480,framerate=30/1'
IN_CAPS='video/x-raw,format=RGBA,width=640,height=480,framerate=30/1'
OUT_CAPS='video/x-raw,width=320,height=240'
PORT=5004
HOST=<IP address>

gst-launch-1.0 videotestsrc is-live=true num-buffers=-1 ! $IN_CAPS ! imxg2dvideotransform ! $IN_CAPS ! ptzr normalize-translation=false ! $OUT_CAPS ! imxipuvideotransform input-crop=false ! $OUT_CAPS ! imxvpuenc_h264 bitrate=4000 gop-size=15 idr-interval=15 ! mpegtsmux alignment=7 ! udpsink port=$PORT host=$HOST

The property "output-reference" (true by default) lets you change the coordinate system used as reference for translations. This is specially useful after performing a rotation. If you want to move over the input image axis, it must be changed to false.

Set input coordinate system as reference for translations:

CAPTURE_CAPS='video/x-raw,width=640,height=480,framerate=30/1'
IN_CAPS='video/x-raw,format=RGBA,width=640,height=480,framerate=30/1'
OUT_CAPS='video/x-raw,width=320,height=240'
PORT=5004
HOST=<IP address>

gst-launch-1.0 videotestsrc is-live=true num-buffers=-1 ! $IN_CAPS ! imxg2dvideotransform ! $IN_CAPS ! ptzr output-reference=false ! $OUT_CAPS ! imxipuvideotransform input-crop=false ! $OUT_CAPS ! imxvpuenc_h264 bitrate=4000 gop-size=15 idr-interval=15 ! mpegtsmux alignment=7 ! udpsink port=$PORT host=$HOST

To rotate the input modify the "rotate-level" property (degrees). You can also perform rotation relative to the current angle with "rotate-delta":

Rotate counter-clockwise (rotate level < 0):

CAPTURE_CAPS='video/x-raw,width=640,height=480,framerate=30/1'
IN_CAPS='video/x-raw,format=RGBA,width=640,height=480,framerate=30/1'
OUT_CAPS='video/x-raw,width=320,height=240'
PORT=5004
HOST=<IP address>

gst-launch-1.0 videotestsrc is-live=true num-buffers=-1 ! $IN_CAPS ! imxg2dvideotransform ! $IN_CAPS ! ptzr rotate-level=-100 ! $OUT_CAPS ! imxipuvideotransform input-crop=false ! $OUT_CAPS ! imxvpuenc_h264 bitrate=4000 gop-size=15 idr-interval=15 ! mpegtsmux alignment=7 ! udpsink port=$PORT host=$HOST

Rotate clockwise (rotate level > 0):

CAPTURE_CAPS='video/x-raw,width=640,height=480,framerate=30/1'
IN_CAPS='video/x-raw,format=RGBA,width=640,height=480,framerate=30/1'
OUT_CAPS='video/x-raw,width=320,height=240'
PORT=5004
HOST=<IP address>

gst-launch-1.0 videotestsrc is-live=true num-buffers=-1 ! $IN_CAPS ! imxg2dvideotransform ! $IN_CAPS ! ptzr rotate-level=100 ! $OUT_CAPS ! imxipuvideotransform input-crop=false ! $OUT_CAPS ! imxvpuenc_h264 bitrate=4000 gop-size=15 idr-interval=15 ! mpegtsmux alignment=7 ! udpsink port=$PORT host=$HOST

Gstd pipelines

Run the element with gstd to change parameters dynamically:

CAPTURE_CAPS='video/x-raw,width=640,height=480,framerate=30/1'
IN_CAPS='video/x-raw,format=RGBA,width=640,height=480,framerate=30/1'
OUT_CAPS='video/x-raw,width=320,height=240'
PORT=5004
HOST=<IP address>
gstd&
gstd-client pipeline_create p0 videotestsrc is-live=true num-buffers=-1 ! $IN_CAPS ! imxg2dvideotransform ! $IN_CAPS ! ptzr name=ptzr0 ! $OUT_CAPS ! imxipuvideotransform input-crop=false ! $OUT_CAPS ! imxvpuenc_h264 bitrate=4000 gop-size=15 idr-interval=15 ! mpegtsmux alignment=7 ! udpsink port=$PORT host=$HOST
gstd-client pipeline_play p0

Change propierties:

gstd-client element_set p0 "ptzr0 zoom-level 0.0" 
gstd-client element_set p0 "ptzr0 zoom-level 2.0" 
gstd-client element_set p0 "ptzr0 zoom-level 1.0" 
gstd-client element_set p0 "ptzr0 tilt-level -1.0" 
gstd-client element_set p0 "ptzr0 tilt-level 1.0" 
gstd-client element_set p0 "ptzr0 tilt-level 0.0" 
gstd-client element_set p0 "ptzr0 pan-level -1.0" 
gstd-client element_set p0 "ptzr0 pan-level 1.0" 
gstd-client element_set p0 "ptzr0 pan-level 0.0" 
gstd-client element_set p0 "ptzr0 tilt-delta -1.0" 
gstd-client element_set p0 "ptzr0 tilt-delta 1.0" 
gstd-client element_set p0 "ptzr0 tilt-delta 0.0" 
gstd-client element_set p0 "ptzr0 pan-delta -1.0" 
gstd-client element_set p0 "ptzr0 pan-delta 1.0" 
gstd-client element_set p0 "ptzr0 pan-delta 0.0" 
gstd-client element_set p0 "ptzr0 rotate-level -90.0" 
gstd-client element_set p0 "ptzr0 rotate-level 90.0" 
gstd-client element_set p0 "ptzr0 rotate-level 0.0" 
gstd-client element_set p0 "ptzr0 rotate-delta -90.0" 
gstd-client element_set p0 "ptzr0 rotate-delta 90.0" 
gstd-client element_set p0 "ptzr0 rotate-delta 0.0" 
gstd-client element_set p0 "ptzr0 normalize-translation false" 
gstd-client element_set p0 "ptzr0 normalize-translation true" 
gstd-client element_set p0 "ptzr0 output-reference false" 
gstd-client element_set p0 "ptzr0 output-reference true"

Stop the pipeline:

gstd-client pipeline_stop p0
gstd-client pipeline_delete p0


Previous: PC Pipelines Index Next: Tegra Pipelines