Gst-nvvideo4linux2

DeepStream extends the open source V4L2 codec plugins (here called Gst-v4l2) to support hardware-accelerated codecs.

Gst-nvvideo4linux2

Decoder

The OSS Gst-nvvideo4linux2 plugin leverages the hardware decoding engines on Jetson and DGPU platforms by interfacing with libv4l2 plugins on those platforms. It supports H.264, H.265, JPEG and MJPEG formats. The plugin accepts an encoded bitstream and uses the NVDEC hardware engine to decode the bitstream. The decoded output can be NV12 or YUV444 format which depends on the encoded stream content.

Note

When you use the v4l2 decoder for decoding JPEG images, you must use the open source jpegparse plugin before the decoder to parse encoded JPEG images.

Inputs and Outputs

  • Inputs

    • An encoded bitstream. Supported formats are H.264, H.265, JPEG and MJPEG

    • H264 encoded bitstream in 8bit 4:2:0 format.

    • H265 encoded bitstream in 8/10/12 bit 4:2:0 and 8/10/12 bit 4:4:4 format.

  • Control Parameters

    • gpu-id

    • num-extra-surfaces

    • skip-frames

    • cudadec-memtype

    • drop-frame-interval

    • low-latency-mode

  • Output

    • H264 decoder outputs GstBuffer in 8bit semi-planar(NV12) 4:2:0 format.

    • H265 decoder outputs GstBuffer in 8/10/12 bit semi-planar(NV12) 4:2:0 format, 8/10/12 bit planar(YUV444) 4:4:4 format.

Features

The following table summarizes the features of the Gst-nvvideo4linux2 decoder plugin.

Gst-nvvideo4linux2 plugin decoder features

Feature

Description

Supports H.264 decode

h264 encoded bitstream is decoded into 8bit NV12

Supports H.265 decode

h265 encoded bitstream is decoded into 8/10/12 bit NV12 or 8/10/12 bit YUV444 depending on the stream content

Supports JPEG/MJPEG decode

User-configurable CUDA memory type (Pinned/Device/Unified) for output buffers

Note

  • 10/12bit YUV444 format support is applicable only for x86/dGPU platforms.

  • Also, for 12bit NV12 format, the output caps shows I420_12LE. But the data is handled as semiplanar 12 bit data. This is a workaround since gstreamer v1.16 does not have the particular caps for 12 bit NV12. Downstream component should process it considering as 12bit NV12 only.

Gst Properties

The following table summarizes the Gst properties of the Gst-nvvideo4linux2 decoder plugin.

Gst-nvvideo4linux2 plugin decoder gst properties

Property

Meaning

Type and Range

Example/Notes

Platforms

gpu-id

Device ID of GPU to use for decoding.

Integer, 0 to 4,294,967,295

gpu-id=0

dGPU

num-extra-surfaces

Number of surfaces in addition to min decode surfaces given by the V4L2 driver.

Integer, 1 to 24

num-extra-surfaces=24 Default: 0

dGPU Jetson

skip-frames

Type of frames to skip during decoding. Represented internally by enum SkipFrame.

0 (decode_all): decode all frames

1 (decode_non_ref): skips non-ref frames (Applicable only on Jetson platform)

2 (decode_key): decode key frames

Integer, 0, 1, or 2

skip-frames=0 Default: 0

dGPU Jetson

drop-frame-interval

Interval to drop the frames, e.g. a value of 5 means the decoder outputs every fifth frame, and others are dropped.

Integer, 1 to 30

Default: 0

dGPU Jetson

cudadec-memtype

Memory type for CUDA decoder buffers. Represented internally by enum CudaDecMemType.

0 (memtype_device): Device

1 (memtype_pinned): Host Pinned

2 (memtype_unified): Unified

Integer, 0, 1, or 2

cuda-memory-type=1 Default: 2

dGPU

low-latency-mode

Set low latency mode for bitstreams having I and IPPP frames with no B frames

Boolean

Default: false

dGPU

Encoder

The OSS Gst-nvvideo4linux2 plugin leverages the hardware accelerated encoding engine available on Jetson and dGPU platforms by interfacing with libv4l2 plugins on those platforms. The plugin accepts RAW data in I420/NV12 or YUV444 format. It uses the NVENC hardware engine to encode RAW input. Encoded output is in elementary bitstream supported format. To set appropriate tuning-info-id and preset-id properties please refer to Nvidia Video Codec SDK Documentation at https://docs.nvidia.com/video-technologies/video-codec-sdk/nvenc-preset-migration-guide/index.html

Inputs and Outputs

  • Inputs

    • RAW input in I420/NV12 or YUV444 format

    • 8 bit I420/NV12 and YUV444 raw formats

    • 8/10 bit I420/NV12 and YUV444 raw formats

  • Control parameters

    • gpu-id (dGPU only)

    • profile

    • bitrate

    • control-rate

    • iframeinterval

    • preset-id

    • tuning-info-id

    • copy-meta

  • Output

    • Gst Buffer with encoded output in H264 and H265 format.

Features

The following table summarizes the features of the Gst-nvvideo4linux2 encoder plugin.

Gst-nvvideo4linux2 plugin encoder features

Feature

Description

Supports H.264 encode

8 bit I420/NV12, 8bit YUV444 raw format can be encoded into h264 bitstream

Supports H.265 encode

8/10 bit I420/NV12, 8/10 bit YUV444 raw format can be encoded into h265 bitstream

Note

  • 8/10bit YUV444 format support is applicable only for x86/dGPU platforms.

Gst Properties

The following table summarizes the Gst properties of the Gst-nvvideo4linux2 encoder plugin.

Gst-nvvideo4linux2 plugin encoder gst properties

Property

Meaning

Type and Range

Example/Notes

Platforms

gpu-id

Device ID of GPU to used.

Integer, 0 to 4,294,967,295

gpu-id=0

dGPU

bitrate

Sets bitrate for encoding, in bits/seconds.

Integer, 0 to 4,294,967,295

Default:4000000

dGPU Jetson

iframeinterval

Encoding intra-frame occurrence frequency.

Integer, 0 to 4,294,967,295

Default: 30

dGPU Jetson

force-idr

Force an IDR frame

Boolean

Default: false

dGPU

Profile

H.264/H.265 encoder profile; represented internally by enum GstV4l2VideoEncProfileType. For H.264:

0 (GST_V4L2_H264_VIDENC_BASELINE_PROFILE): Baseline

2 (GST_V4L2_H264_VIDENC_MAIN_PROFILE): Main

4 (GST_V4L2_H264_VIDENC_HIGH_PROFILE): High

For H.265:

0 (GST_V4L2_H265_VIDENC_MAIN_PROFILE): Main

1 (GST_V4L2_H265_VIDENC_MAIN10_PROFILE): Main10

Values of enum GstV4l2VideoEncProfileType

Default Baseline Default: 0

dGPU Jetson

preset-id

Sets CUVID Preset ID for Encoder

Integer, 1 to 7

Default: 1

dGPU

tuning-info-id

Sets Tuning Info Preset for encoder; represented internally by enum GstV4l2VideoEncTuingInfoPreset.

(1): HighQualityPreset - Tuning Preset for High Quality

(2): LowLatencyPreset - Tuning Preset for Low Latency

(3): UltraLowLatencyPreset - Tuning Preset for Low Latency

(4): LosslessPreset - Tuning Preset for Lossless

Values of enum GstV4L2VideoEncTuingInfoPreset

Default LowLatencyPreset Default: 2

dGPU

copy-meta

Copies input metadata on output buffer

Boolean

Default: false

dGPU Jetson

qp-range

Sets quantization paramenter range for P, I and B frame

String, 1 to 51

Default: null

dGPU Jetson