Skip to navigation

Gst-nvvideo4linux2

View as Markdown

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, AV1, 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.

  • 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.
  • Also, note that JPEG and MJPEG decoding is not supported on Thor platform.

Inputs and Outputs

  • Inputs

    • An encoded bitstream. Supported formats are H.264, H.265, AV1, 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.
    • AV1 encoded bitstream in 8bit 4:2:0 format.
  • 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.
    • AV1 decoder outputs GstBuffer in 8bit semi-planar(NV12) 4:2:0 format.

Features

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

Gst-nvvideo4linux2 plugin decoder features

FeatureDescription
Supports H.264 decodeh264 encoded bitstream is decoded into 8bit NV12
Supports H.265 decodeh265 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—
  • 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

PropertyMeaningType and RangeExample/NotesPlatforms
capture-io-modeCapture I/O mode (matches src pad)
(0): auto - GST_V4L2_IO_AUTO
(2): mmap - GST_V4L2_IO_MMAP
On dGPU:
Enum “GstNvV4l2IOMode
On Jetson:
Enum “GstNvV4l2DecCaptureIOMode
Default: 0dGPU
Jetson
capture-buffer-dynamic-allocationSet to enable capture buffer dynamic allocation
(0): cap_buf_dyn_alloc_disabled - Capture buffer dynamic allocation disabled
(1): fw_cap_buf_dyn_alloc_enabled - Capture buffer dynamic allocation enabled for forward playback
(2): rw_cap_buf_dyn_alloc_enabled - Capture buffer dynamic allocation enabled for reverse playback
(3): fw_rw_cap_buf_dyn_alloc_enabled - Capture buffer dynamic allocation enabled for forward and reverse playback
Enum “CaptureBufferDynamicAllocationModesDefault: 0Jetson
cudadec-memtypeMemory type for CUDA decoder buffers.
(0): memtype_device - Memory type Device
(1): memtype_pinned - Memory type Host Pinned
(2): memtype_unified - Memory type Unified
Enum “CudaDecMemTypeDefault: 2dGPU
disable-dpbSet to disable DPB buffer for low latencyBooleanDefault: falseJetson
drop-frame-intervalInterval 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: 0dGPU
Jetson
extract-sei-type5-dataSet to extract and attach SEI type5 unregistered data on output buffer (not supported on Thor)BooleanDefault: falsedGPU
enable-error-checkSet to enable error check (not supported on Thor)BooleanDefault: falseJetson
enable-frame-type-reportingSet to enable frame type reporting (not supported on Thor)BooleanDefault: falseJetson
enable-full-frameWhether or not the data is full framed (not supported on Thor)BooleanDefault: falseJetson
enable-max-performanceSet to enable max performance (not supported on Thor)BooleanDefault: falseJetson
gpu-idDevice ID of GPU to use for decoding.IntegerDefault:0dGPU
low-latency-modeSet low latency mode for bitstreams having I and IPPP frames with no B framesBooleanDefault: falsedGPU
Jetson
mjpegSet to open MJPEG block (not supported on Thor)BooleanDefault: falseJetson
num-extra-surfacesNumber of surfaces in addition to min decode surfaces given by the V4L2 driver.Integer, 1 to 24Default: 0dGPU
Jetson
output-io-modeOutput side I/O mode (matches sink pad)
On dGPU:
(0): auto - GST_V4L2_IO_AUTO
(2): mmap - GST_V4L2_IO_MMAP
(5): dmabuf-import - GST_V4L2_IO_DMABUF_IMPORT
On Jetson:
(0): auto - GST_V4L2_IO_AUTO
(2): mmap - GST_V4L2_IO_MMAP
(3): userptr - GST_V4L2_IO_USERPTR
On dGPU:
Enum “GstNvV4l2IOMode
On Jetson:
Enum “GstNvV4l2DecOutputIOMode
Default: 0, “autodGPU
Jetson
sei-uuidSet 16 bytes UUID string for SEI Parsing, extract-sei-type5-data should be TRUEStringDefault: nulldGPU
skip-framesType of frames to skip during decoding.
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
Enum “SkipFrameDefault: 0dGPU
Jetson

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/13.0/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
  • Output

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

Features

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

Gst-nvvideo4linux2 plugin encoder features

FeatureDescription
Supports H.264 encode8 bit I420/NV12, 8bit YUV444 raw format can be encoded into h264 bitstream
Supports H.265 encode8/10 bit I420/NV12, 8/10 bit YUV444 raw format can be encoded into h265 bitstream
  • 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

PropertyMeaningType and RangeExample/NotesPlatforms
aqEnable spatial AQ and set its strengthUnsigned Integer, 0-15Default: 0, “autodGPU
bit-packetizationWhether or not Packet size is based upon Number Of bitsBooleanDefault: falseJetson
bitrateSets bitrate for encoding, in bits/seconds.Unsigned IntegerDefault: 4000000dGPU
Jetson
capture-io-modeCapture I/O mode (matches src pad)
(0): auto - GST_V4L2_IO_AUTO
(2): mmap - GST_V4L2_IO_MMAP
(5): dmabuf-import - GST_V4L2_IO_DMABUF_IMPORT
Enum “GstNvV4l2IOModeDefault: 0, “autodGPU
Jetson
constqpSets constant QP values for I:P:B framesString, 1 to 51Default: nulldGPU
copy-metaCopies input metadata on output bufferBooleanDefault: falsedGPU
copy-timestampEnabling the flag allows to copy the timestamps from input to the capture stream.BooleanDefault: falseJetson
control-rateSets rate control mode for v4l2 encoding
(0): variable_bitrate - GST_V4L2_VIDENC_VARIABLE_BITRATE
(1): constant_bitrate - GST_V4L2_VIDENC_CONSTANT_BITRATE
(2): constantQP - GST_V4L2_VIDENC_CONSTANT_QP
Enum “GstV4l2VideoEncRateControlTypeDefault: 1, “constant_bitratedGPU
Jetson
cqSets targetQuality (Constant Quality) level for VBR modeInteger, 0-51Default: 0, “autodGPU
disable-cabacSet Entropy Coding Type CAVLC(TRUE) or CABAC(FALSE)BooleanDefault: falseJetson
enable-losslessEnable lossless encoding for YUV444BooleanDefault: falseJetson
EnableMVBufferMetaEnable Motion Vector Meta data for encodingBooleanDefault: falseJetson
EnableTwopassCBREnable two pass CBR while encodingBooleanDefault: falseJetson
extended-colorformatSets extended colorformat pixel values 0 to 255 in VUI InfoBooleanDefault: falsedGPU
force-idrForce an IDR frameBooleanDefault: falsedGPU
force-intraForces an INTRA frameBooleanDefault: falsedGPU
gpu-idDevice ID of GPU to used.Unsigned IntegerDefault:0dGPU
idrintervalSets IDR Frame occurrence frequency in encoded streamUnsigned IntegerDefault: 256dGPU
Jetson
iframeintervalSets encoding intra-frame occurrence frequency.Unsigned IntegerDefault: 30dGPU
Jetson
initqpSet values of initQP in I:P:B order.
This provides rough hint to encoder to influence the qp difference between I, P and B
StringDefault: nulldGPU
insert-audInsert H.264 Access Unit Delimiter(AUD)BooleanDefault: falseJetson
insert-sps-ppsInsert H.264 SPS, PPS at every IDR frameBooleanDefault: falseJetson
insert-vuiInsert H.264 VUI(Video Usability Information) in SPSBooleanDefault: falseJetson
intra-refreshIntra Refresh Parameters. Use string with unsigned integer values of Intra Refresh in enableIntraRefresh,intraRefreshPeriod,intraRefreshCnt in same order to set the property. e.g. 1,30,5StringDefault: nulldGPU
maxbitrateSet maxbitrate for v4l2 encoder. This mode is specified by setting rateControlMode to VBRUnsigned IntegerDefault: 0dGPU
maxperf-enableEnable or Disable Max Performance modeBooleanDefault: falseJetson
MeasureEncoderLatencyEnable Measure Encoder latency Per FrameBooleanDefault: falseJetson
num-B-FramesNumber of B Frames between two reference frames (not recommended)Unsigned Integer, 0-2Default: 0Jetson
num-Ref-FramesNumber of Reference Frames for encoderUnsigned Integer, 0-8Default: 1Jetson
output-io-modeSets output side I/O mode (matches sink pad)
(0): auto - GST_V4L2_IO_AUTO
(2): mmap - GST_V4L2_IO_MMAP
(5): dmabuf-import - GST_V4L2_IO_DMABUF_IMPORT
Enum “GstNvV4l2IOModeDefault: 0, “autodGPU
Jetson
peak-bitratePeak bitrate in variable control-rate. The value must be >= bitrate (1.2*bitrate) is set by default (Default: 0)Unsigned IntegerDefault: 0Jetson
poc-typeSet Picture Order Count type valueUnsigned Integer, 0-2Default: 1Jetson
preset-idSets CUVID Preset ID for EncoderUnsigned Integer,
1 to 7
Default: 1dGPU
preset-levelHW preset level for encoder.
(0): DisablePreset - Disable HW-Preset
(1): UltraFastPreset - UltraFastPreset for high perf
(2): FastPreset - FastPreset
(3): MediumPreset - MediumPreset
(4): SlowPreset - SlowPreset
Enum “GstV4L2VideoEncHwPresetDefault: 1, “UltraFastPresetJetson
ProfileH.264/H.265 encoder profile.
For H.264:
(0): Baseline - GST_V4L2_H264_VIDENC_BASELINE_PROFILE
(2): Main - GST_V4L2_H264_VIDENC_MAIN_PROFILE
(4): High - GST_V4L2_H264_VIDENC_HIGH_PROFILE
(7): High444 - GST_V4L2_H264_VIDENC_HIGH_444_PREDICTIVE
For H.265:
(0): Main - GST_V4L2_H265_VIDENC_MAIN_PROFILE
(1): Main10 - GST_V4L2_H265_VIDENC_MAIN10_PROFILE
(3): FREXT - GST_V4L2_H265_VIDENC_FREXT_PROFILE
Enum “GstV4l2VideoEncProfileTypeFor H.264:
Default: 0 (Baseline)
For H.265:
Default: 0 (Main)
dGPU
Jetson
PropertyMeaningType and RangeExample/NotesPlatforms
qp-rangeSets quantization parameter range for P, I and B frameString, 1 to 51Default: nulldGPU
Jetson
quant-b-framesQuantization parameter for B-frames (0xffffffff=component default), use with ratecontrol-enable = 0 and preset-level = 0Unsigned Integer, 0 - 4294967295Default: 4294967295Jetson
quant-i-framesQuantization parameter for I-frames (0xffffffff=component default), use with ratecontrol-enable = 0Unsigned Integer, 0 - 4294967295Default: 4294967295Jetson
quant-p-framesQuantization parameter for P-frames (0xffffffff=component default), use with ratecontrol-enable = 0 and preset-level = 0Unsigned Integer, 0 - 4294967295Default: 4294967295Jetson
ratecontrol-enableEnable or Disable rate control modeBooleanDefault: trueJetson
slice-header-spacingSlice Header Spacing number of macroblocks/bits in one packetUnsigned Integer64Default: 0Jetson
SliceIntraRefreshIntervalSet SliceIntraRefreshIntervalUnsigned IntegerDefault: 0Jetson
temporalaqSet this to enable adaptive quantization (Temporal).BooleanDefault: falsedGPU
tuning-info-idSets Tuning Info Preset for encoder.
(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
Enum “GstV4L2VideoEncTuingInfoPresetDefault: 2 (LowLatencyPreset)dGPU
vbvbufsizeSet VBV buffer size in bits.Unsigned IntegerDefault: 0 (default value by encoder)dGPU
vbvinitSet VBV initial delay in bitsUnsigned IntegerDefault: 0 (default value by encoder)dGPU
vbv-sizevirtual buffer sizeUnsigned IntegerDefault: 4000000Jetson