NVIDIA Jetson Orin - GStreamer Pipelines

From RidgeRun Developer Connection
Jump to: navigation, search



Previous: Video Capture and Display/Cameras/IMX477 J20 Index Next: GStreamer Pipelines/Capture and Display


Nvidia-preferred-partner-badge-rgb-for-screen.png




GStreamer is an Open Source pipeline-based framework that enables quick prototyping of multimedia projects. In this section, we provide some example pipelines that capture from USB and MIPI CSI-2 cameras to help you get started.

On Jetson platforms, there are two possible capture paths:

  • Through the ISP: The Image Signal Processor can be used through the libargus API, and among its capabilities, it allows to perform debayering, auto-exposure, and gain control. This path is often used to capture from MIPI CSI-2 cameras that provide Bayer images, because the ISP takes care of the debayering, leaving the CPU and GPU processing power free for other tasks. The element used in GStreamer to capture through this path is nvarguscamerasrc.
  • Bypassing the ISP: If the ISP is not required, it can be bypassed using the GStreamer element v4l2src. This method is useful for USB Cameras or to capture raw Bayer images from MIPI CSI-2 cameras.

You will find the following subsections with examples of both capture paths:

The pipelines presented in the listed subsections provide some performance metrics. You can find information on how the performance metrics were extracted in the following Performance Measurement subsection. Finally, the Remote Development subsection provides tips for running the pipelines from an SSH connection.

Performance Measurement

The performance measurements are extracted using the specified power profile (operation mode) and with the GStreamer pipeline running in the system.

Operation Mode:

CPU usage:

  • For the CPU percentage utilization, the tegrastats utility was used as follows: sudo tegrastats -readall. This command shows the percentage utilization of the 12 cores that the Jetson AGX Orin devkit has. For the measurement, we compute the average over 30 samples of the utilization values for the CPU cores.

GPU Usage:

  • The same procedure described for the CPU usage is done in the case of GPU percentage. As the board has 2 GPUs, 30 samples of each one are taken, and then, the average is obtained.

FPS:

  • For the FPS, RidgeRun's gst-perf plugin is used. This plugin computes the FPS mean. For the measurement, we compute the average over 30 samples of the FPS mean values. The following example shows a pipeline with the perf element incorporated:
 gst-launch-1.0 -v v4l2src device=/dev/video0 ! perf ! video/x-raw,framerate=30/1,width=1280,height=720 ! nvvidconv ! 'video/x-raw(memory:NVMM), format=NV12' ! nv3dsink

Latency:

  • In the case of the Latency metric, the RidgeRun GstShark plugin is used. For this metric, it is important to take into account that it is not a glass-to-glass measurement. GstShark provides the time needed by a buffer to travel from the source pad of the source element to the source pad of the remaining elements of the pipeline. The following pipeline shows an example of the GstShark interlatency tracer execution:
 GST_DEBUG="GST_TRACER:7" GST_TRACERS="interlatency" gst-launch-1.0 -v v4l2src device=/dev/video0 ! video/x-raw,framerate=30/1,width=1280,height=720 ! nvvidconv ! 'video/x-raw(memory:NVMM), format=NV12' ! nv3dsink

Remote Development

Often we want to run tests in a Jetson that is in another physical location. In these cases, you will need to have a display connected to the Jetson and also find out the proper value of the DISPLAY environment variable. For this, before you move to developing remotely or with someone's help at the Jetson location, connect a keyboard to the Jetson, open a terminal and check for the DISPLAY variable by executing the following command:

echo $DISPLAY


This command will print the needed value, usually something like :0. Then you can run the GStreamer Pipeline from an SSH terminal as follows:

 DISPLAY=:0 GST_DEBUG=2 gst-launch-1.0 -v v4l2src device=/dev/video0 ! video/x-raw,framerate=30/1,width=1280,height=720 ! nvvidconv ! xvimagesink sync=true

Make sure to replace the :0 value in the pipeline command according to your $DISPLAY environment variable. More information about accessing the Jetson Orin AGX through SSH can be found in our SSH section.



Previous: Video Capture and Display/Cameras/IMX477 J20 Index Next: GStreamer Pipelines/Capture and Display