NVIDIA Jetson AGX Thor - H264 GStreamer Pipelines

From RidgeRun Developer Wiki

Follow Us On Twitter LinkedIn Email Share this page





Previous: GStreamer_Pipelines/Capture_and_Display Index Next: GStreamer_Pipelines/H265









GStreamer Pipelines using H264

This section presents GStreamer pipelines to capture from MIPI CSI-2 and USB cameras and encoding/decoding of video using the H.264 hardware codec of the AGX Thor. Key performance indicators are measured using two power profiles (operation modes). Check our GStreamer Pipelines section to find more information about how we extracted the performance metrics presented in this section.

H264 Encoding

The following table compare the utility and describes each available encoder in the Jetson AGX Thor for H.264 encoding.

Table 1: H.264 Encoders comparison
Feature GStreamer plugin
nvh264enc nvcudah264enc nvautogpuh264enc nvv4l2h264enc
Backend NVENC API NVCODEC API CUDA Mode NVCODEC API auto GPU select Mode V4L2 API
GPU Handling Fixed to GPU0 (read-only) Manual (cuda-device-id) Auto GPU (override possible) gpu-id property (writable)
Memory types CUDA, GLMemory, system CUDA, GLMemory, system CUDA, GLMemory, system NVMM only
Input formats NV12, YV12, I420, BGRA, RGBA, Y444, VUYA (widest) NV12, Y444 only NV12, Y444 only I420, NV12, P010_10LE, Y444, Y444_10LE, NV24
Output caps H.264 (byte-stream, AU aligned) H.264 (avc/byte-stream, AU aligned) H.264 (avc/byte-stream, AU aligned) H.264 (byte-stream, AU or NAL aligned)
B-frames 0–4 0–4 0–4 0–2 (num-B-Frames)
Special features zerolatency, strict-gop multi-pass, repeat-sequence-header, cc-insert, zero-reorder-delay multi-pass, repeat-sequence-header, cc-insert, zero-reorder-delay Intra-refresh, CABAC toggle, SEI UUID, per-frame latency measure

MIPI CSI-2 Camera

The pipelines in this section used the Framos IMX676 Sensor . For reference the testing used the following variables.

FILE=/tmp/filename.mp4
WIDTH=3552
HEIGHT=3556
FRAMERATE=64/1
FORMAT=NV12

Encoding with nvv4l2h264enc and saving to file

The pipeline below can be used to capture, encode using the H.264 hardware codec, and store the video to file as an mp4 in the /tmp/filename.mp4 location. Table 1 shows the performance information for this pipeline.

gst-launch-1.0 nvarguscamerasrc video/x-raw, width=$WIDTH, height=$HEIGHT, framerate=$FRAMERATE ! nvvidconv ! 'video/x-raw(memory:NVMM), format=$FORMAT' ! nvv4l2h264enc ! h264parse ! qtmux ! filesink location=$FILE -e
Table 1: Performance of pipeline with nvv4l2h264enc
Operation Mode CPU (%) GPU 1 (%) GPU 2 (%) FPS latency (ms)
0 (max performance)
1 (Default Mode)

Encoding with nvautogpuh264enc and saving to file

The pipeline below can be used to capture, encode using the H.264 hardware codec, and store the video to file as an mp4 in the /tmp/filename.mp4 location. Table 2 shows the performance information for this pipeline.

gst-launch-1.0 nvarguscamerasrc video/x-raw, width=$WIDTH, height=$HEIGHT, framerate=$FRAMERATE ! nvvidconv ! 'video/x-raw(memory:NVMM), format=$FORMAT' ! nvv4l2h264enc ! h264parse ! qtmux ! filesink location=$FILE -e
Table 2: Performance of pipeline with nvv4l2h264enc
Operation Mode CPU (%) GPU 1 (%) GPU 2 (%) FPS latency (ms)
0 (max performance)
1 (Default Mode)

Encoding with nvh264enc and saving to file

The pipeline below can be used to capture, encode using the H.264 hardware codec, and store the video to file as an mp4 in the /tmp/filename.mp4 location. Table 3 shows the performance information for this pipeline.

gst-launch-1.0 nvarguscamerasrc video/x-raw, width=$WIDTH, height=$HEIGHT, framerate=$FRAMERATE ! nvvidconv ! 'video/x-raw(memory:NVMM), format=$FORMAT' ! nvv4l2h264enc ! h264parse ! qtmux ! filesink location=$FILE -e
Table 3: Performance of pipeline with nvv4l2h264enc
Operation Mode CPU (%) GPU 1 (%) GPU 2 (%) FPS latency (ms)
0 (max performance)
1 (Default Mode)

USB Camera

The pipelines in this section used the LI-10635 USB camera.

For reference the testing used the following variables.

FILE=/tmp/filename.mp4
WIDTH=1920
HEIGHT=1080
FRAMERATE=30/1

Encoding nvv4l2h264enc and saving to file

The pipeline below can be used to capture, encode using the h.264 hardware codec, and store the video to file as an mp4 in the /tmp/filename.mp4 location. Table 4 shows the performance information for this pipeline.

gst-launch-1.0 v4l2src device=/dev/video2 ! video/x-h264, width=$WIDTH, height=$HEIGHT, framerate=$FRAMERATE ! h264parse ! video/x-h264, stream-format=avc ! h264parse ! video/x-h264, stream-format=byte-stream ! nvv4l2decoder ! queue ! nvvidconv ! 'video/x-raw(memory:NVMM)' ! nvv4l2h264enc bitrate=8000000 ! video/x-h264, stream-format=byte-stream ! h264parse ! qtmux ! filesink location=$FILE -e
Table 4: Performance of pipeline with nvv4l2h264enc
Operation Mode CPU% GPU1% GPU2% FPS
0 (max performance)
1 (Default Mode)

Encoding nvautogpuh264enc/nvcudah264enc and saving to file

The pipeline below can be used to capture, encode using the h.264 hardware codec, and store the video to file as an mp4 in the /tmp/filename.mp4 location. Table 5 shows the performance information for this pipeline.

gst-launch-1.0 v4l2src device=/dev/video2 ! video/x-h264, width=$WIDTH, height=$HEIGHT, framerate=$FRAMERATE  ! h264parse ! video/x-h264, stream-format=avc ! h264parse ! video/x-h264, stream-format=byte-stream ! queue max-size-buffers=2 leaky=2 ! nvh264dec ! queue max-size-buffers=2 leaky=2 ! nvautogpuh264enc ! video/x-h264, stream-format=byte-stream ! h264parse ! qtmux ! filesink location=/tmp/filename.mp4 -e
Table 5: Performance of pipeline with nvv4l2h264enc
Operation Mode CPU% GPU1% GPU2% FPS
0 (max performance)
1 (Default Mode)

Encoding nvh264enc and saving to file

The pipeline below can be used to capture, encode using the h.264 hardware codec, and store the video to file as an mp4 in the /tmp/filename.mp4 location. Table 6 shows the performance information for this pipeline.

gst-launch-1.0 v4l2src device=/dev/video2 ! video/x-h264, width=$WIDTH, height=$HEIGHT, framerate=$FRAMERATE  ! h264parse ! video/x-h264, stream-format=avc ! h264parse ! video/x-h264, stream-format=byte-stream ! queue max-size-buffers=2 leaky=2 ! nvh264dec ! queue max-size-buffers=2 leaky=2 ! nvh264enc ! video/x-h264, stream-format=byte-stream ! h264parse ! qtmux ! filesink location=/tmp/filename.mp4
Table 6: Performance of pipeline with nvv4l2h264enc
Operation Mode CPU% GPU1% GPU2% FPS
0 (max performance)
1 (Default Mode)

H264 Decoding

The pipeline below can be used to decode the videos recorded with both the MIPI CSI-2 and the USB cameras.

FILE=/tmp/filename.mp4
gst-launch-1.0 filesrc location=$FILE ! qtdemux ! queue ! h264parse ! nvv4l2decoder ! nv3dsink -e
Table 7: Performance of the pipeline decoding video
Operation Mode CPU% GPU1% GPU2% FPS
0 (max performance)
1 (Default Mode)


Table 8: Performance of the pipeline decoding video at 1920x1080@30
Operation Mode CPU (%) GPU 1 (%) GPU 2 (%) FPS latency (ms)
0 (max performance)
1 (min power)



Previous: GStreamer_Pipelines/Capture_and_Display Index Next: GStreamer_Pipelines/H265