GStreamer Video Stabilizer for NVIDIA Jetson Boards - Examples - Nano,TX1,TX2,Xavier Pipelines

From RidgeRun Developer Wiki


Note
GstNVStabilize works for Jetpack versions up to 4.x. For latest Jetpacks please refer to our new Stabilization product:

RidgeRun Video Stabilization Library


Previous: Examples Index Next: Performance





The gst-nvstabilize element can be easily incorporated into any pipeline. Here we present some sample pipelines for different use cases.

Processing buffers from v4l2 device



Controlling ROI with CropMargin

The following pipelines will capture from a camera a 1280x720 video stream, will use a 0.1 crop margin, and produce a stabilized 1280x720 output. Note that the output is scaled to match the input size.

Displaying to NvOverlaySink

gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=1280,height=720' ! nvvidconv ! 'video/x-raw(memory:NVMM)'  ! nvvidconv ! nvstabilize crop-margin=0.1 queue-size=5 ! nvvidconv ! nvoverlaysink sync=false
gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=1280,height=720' ! videoconvert ! nvstabilize crop-margin=0.1 queue-size=5 ! nvvidconv ! nvoverlaysink sync=false

Displaying to NvEglGlesSink

gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=1280,height=720' ! nvvidconv ! 'video/x-raw(memory:NVMM)'  ! nvvidconv ! nvstabilize crop-margin=0.1 queue-size=5 ! nveglglessink sync=false
gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=1280,height=720' ! videoconvert ! nvstabilize crop-margin=0.1 queue-size=5 ! nveglglessink sync=false

Displaying to XvImageSink

gst-launch-1.0  v4l2src device=/dev/video0 ! 'video/x-raw,width=1280,height=720' ! nvvidconv ! 'video/x-raw(memory:NVMM)' ! nvvidconv ! nvstabilize crop-margin=0.1 queue-size=5 ! nvvidconv ! 'video/x-raw(memory:NVMM)' ! nvvidconv ! xvimagesink sync=false
gst-launch-1.0  v4l2src device=/dev/video0 ! 'video/x-raw,width=1280,height=720' ! videoconvert ! nvstabilize crop-margin=0.1 queue-size=5 ! videoconvert ! xvimagesink sync=false

Controlling ROI with Output Caps

The following pipelines will capture from a camera a 1280x720 video stream and produce a stabilized 640x480 output. Note that the output is not scaled to the input size.

Displaying to NvOverlaySink

gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=1280,height=720' ! nvvidconv ! 'video/x-raw(memory:NVMM)'  ! nvvidconv ! 'video/x-raw,width=1280,height=720' ! nvstabilize queue-size=5 ! video/x-raw,width=640,height=480 ! nvvidconv ! nvoverlaysink sync=false
gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=1280,height=720' ! video convert ! nvstabilize queue-size=5 ! 'video/x-raw,width=640,height=480' ! nvvidconv ! nvoverlaysink sync=false

Displaying to NvEglGlesSink

gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=1280,height=720' ! nvvidconv ! 'video/x-raw(memory:NVMM)'  ! nvvidconv ! 'video/x-raw,width=1280,height=720' ! nvstabilize queue-size=5 ! 'video/x-raw,width=640,height=480' ! nveglglessink sync=false
gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=1280,height=720' ! videoconvert ! nvstabilize queue-size=5 ! 'video/x-raw,width=640,height=480' ! nveglglessink sync=false

Displaying to XvImageSink

gst-launch-1.0  v4l2src device=/dev/video0 ! 'video/x-raw,width=1280,height=720' ! nvvidconv ! 'video/x-raw(memory:NVMM)' ! nvvidconv ! 'video/x-raw,width=1280,height=720' ! nvstabilize queue-size=5 ! 'video/x-raw,width=640,height=480' ! nvvidconv ! 'video/x-raw(memory:NVMM)' ! nvvidconv ! xvimagesink sync=false
gst-launch-1.0  v4l2src device=/dev/video0 ! 'video/x-raw,width=1280,height=720' ! videoconvert ! nvstabilize queue-size=5 ! 'video/x-raw,width=640,height=480' ! videoconvert ! xvimagesink sync=false

Processing buffers using nvarguscamerasrc

Controlling ROI with CropMargin

The following pipelines will capture from a camera a 1280x720 video stream, will use a 0.1 crop margin, and produce a stabilized 1280x720 output. Note that the output is scaled to match the input size.

Displaying to NvOverlaySink

 
gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM),width=1280,height=720' ! nvvidconv !  nvstabilize crop-margin=0.1 queue-size=5 ! nvvidconv ! nvoverlaysink sync=false

Displaying to NvEglGlesSink

 
gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM),width=1280,height=720' ! nvvidconv  !  nvstabilize crop-margin=0.1 queue-size=5 ! nveglglessink sync=false

Displaying to XvImageSink

 
gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM),width=1280,height=720' ! nvvidconv ! nvstabilize crop-margin=0.1 queue-size=5 ! nvvidconv ! 'video/x-raw(memory:NVMM)' ! nvvidconv ! xvimagesink sync=false
 
gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM),width=1280,height=720' ! nvvidconv ! nvstabilize crop-margin=0.1 queue-size=5 ! videoconvert ! xvimagesink sync=false

Controlling ROI with Output Caps

The following pipelines will capture from a camera a 1280x720 video stream and produce a stabilized 640x480 output. Note that the output is not scaled to the input size.

Displaying to NvOverlaySink

 
gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM),width=1280,height=720' ! nvvidconv ! 'video/x-raw,width=1280,height=720' ! nvstabilize crop-margin=0.1 queue-size=5 ! 'video/x-raw,width=640,height=480' ! nvvidconv ! nvoverlaysink sync=false

Displaying to NvEglGlesSink

 
gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM),width=1280,height=720' ! nvvidconv  ! 'video/x-raw,width=1280,height=720' ! nvstabilize crop-margin=0.1 queue-size=5 ! 'video/x-raw,width=640,height=480' ! nveglglessink sync=false

Displaying to XvImageSink

 
gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM),width=1280,height=720' ! nvvidconv ! 'video/x-raw,width=1280,height=720' ! nvstabilize crop-margin=0.1 queue-size=5 ! 'video/x-raw,width=640,height=480' ! nvvidconv ! 'video/x-raw(memory:NVMM)' ! nvvidconv ! xvimagesink sync=false
 
gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM),width=1280,height=720' ! nvvidconv ! 'video/x-raw,width=1280,height=720' ! nvstabilize crop-margin=0.1 queue-size=5 ! 'video/x-raw,width=640,height=480' ! videoconvert ! xvimagesink sync=false

Processing buffers from file

Controlling ROI with CropMargin

The following pipelines will capture from a camera a 1280x720 video stream, will use a 0.1 crop margin, and produce a stabilized 1280x720 output. Note that the output is scaled to match the input size.

Displaying to NvOverlaySink

PATH_TO_FILE=/home/nvidia/VisionWorks-1.6-Samples/data/parking.avi
gst-launch-1.0 filesrc location=$PATH_TO_FILE ! avidemux ! h264parse ! omxh264dec ! nvvidconv ! queue ! nvstabilize crop-margin=0.1 queue-size=5 ! nvvidconv ! nvoverlaysink sync=false

Displaying to NvEglGlesSink

PATH_TO_FILE=/home/nvidia/VisionWorks-1.6-Samples/data/parking.avi
gst-launch-1.0 filesrc location=$PATH_TO_FILE ! avidemux ! h264parse ! omxh264dec ! nvvidconv ! queue ! nvstabilize crop-margin=0.1 queue-size=5 ! nveglglessink sync=false

Displaying to XvImageSink

PATH_TO_FILE=/home/nvidia/VisionWorks-1.6-Samples/data/parking.avi
gst-launch-1.0 filesrc location=$PATH_TO_FILE ! avidemux ! h264parse ! omxh264dec ! nvvidconv ! queue ! nvstabilize crop-margin=0.1 queue-size=5 ! nvvidconv ! 'video/x-raw(memory:NVMM)' ! nvvidconv ! xvimagesink sync=false
PATH_TO_FILE=/home/nvidia/VisionWorks-1.6-Samples/data/parking.avi
gst-launch-1.0 filesrc location=$PATH_TO_FILE ! avidemux ! h264parse ! omxh264dec ! nvvidconv ! queue ! nvstabilize crop-margin=0.1 queue-size=5 ! videoconvert !  xvimagesink sync=false

Controlling ROI with Output Caps

The following pipelines will capture from a camera a 1280x720 video stream and produce a stabilized 640x480 output. Note that the output is not scaled to the input size.

Displaying to NvOverlaySink

PATH_TO_FILE=/home/nvidia/VisionWorks-1.6-Samples/data/parking.avi
gst-launch-1.0 filesrc location=$PATH_TO_FILE ! avidemux ! h264parse ! omxh264dec ! nvvidconv ! queue ! 'video/x-raw,width=640,height=480' ! nvstabilize crop-margin=0.1 queue-size=5 ! 'video/x-raw,width=320,height=240' ! nvvidconv ! nvoverlaysink sync=false

Displaying to NvEglGlesSink

PATH_TO_FILE=/home/nvidia/VisionWorks-1.6-Samples/data/parking.avi
gst-launch-1.0 filesrc location=$PATH_TO_FILE ! avidemux ! h264parse ! omxh264dec ! nvvidconv ! queue ! 'video/x-raw,width=640,height=480' ! nvstabilize crop-margin=0.1 queue-size=5 ! 'video/x-raw,width=320,height=240' ! nveglglessink sync=false

Displaying to XvImageSink

PATH_TO_FILE=/home/nvidia/VisionWorks-1.6-Samples/data/parking.avi
gst-launch-1.0 filesrc location=$PATH_TO_FILE ! avidemux ! h264parse ! omxh264dec ! nvvidconv ! queue ! 'video/x-raw,width=640,height=480' ! nvstabilize crop-margin=0.1 queue-size=5 ! 'video/x-raw,width=320,height=240' ! nvvidconv ! 'video/x-raw(memory:NVMM)' ! nvvidconv ! xvimagesink sync=false
PATH_TO_FILE=/home/nvidia/VisionWorks-1.6-Samples/data/parking.avi
gst-launch-1.0 filesrc location=$PATH_TO_FILE ! avidemux ! h264parse ! omxh264dec ! nvvidconv ! queue ! 'video/x-raw,width=640,height=480' ! nvstabilize crop-margin=0.1 queue-size=5 ! 'video/x-raw,width=320,height=240' ! videoconvert !  xvimagesink sync=false

Comparing Original and Stabilized Video for Tuning

gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=640,height=480' ! nvvidconv ! 'video/x-raw(memory:NVMM),format=RGBA' ! queue ! tee name=t  t. ! queue ! nvvidconv ! nvstabilize queue-size=5 ! nveglglessink sync=false t. ! queue ! nvvidconv !  nveglglessink sync=false -e

Disabling Motion Compensation Truncation

gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=640,height=480' ! nvvidconv ! 'video/x-raw(memory:NVMM),format=RGBA' ! queue ! tee name=t  t. ! queue ! nvvidconv ! nvstabilize truncate-motion=false ! nveglglessink sync=false t. ! queue ! nvvidconv !  nveglglessink sync=false -e

Troubleshooting

If you see this error when trying to display directly from the local display, execute the following command on the target before starting the video decode pipeline:

Using winsys: x11 
ERROR: Pipeline doesn't want to pause.
Setting pipeline to NULL ...
Freeing pipeline ...
export DISPLAY=:0


Previous: Examples Index Next: Performance