VideoEncoderExtension

NVIDIA GXF component for H.264 video encode. The video encoder GXF extension is based on V4L2 APIs. It uses the hardware video encode engine on the platform by interfacing with V4L2 APIs. It gives out elimetary H.264 bit stream.

This extension is supported on Tegra and dGPU platforms.

For x86+dGPU, the extension has a dependency on DeepStream. Please install nvidia DeepStream SDK (version 6.3) before running pipelines for x86+dGPU.

  • UUID: ea5c44e4-15db-4448-a3a6-f32004303338

  • Version: 1.0.0

  • Author: NVIDIA

  • License: Proprietary

Components

This extension is implemented using three components: VideoEncoderRequest, VideoEncoderResponse and VideoEncoderContext

nvidia::gxf::VideoEncoderRequest

This codelet starts H.264 video encoding process by queueing the input buffer.

  • Component ID: 48251354-3a91-4033-9a0f-8ac2230f1c9c

  • Base Type: nvidia::gxf::Codelet

Parameters

input_frame

Receiver to get the input video Buffer(input frame data)

  • Flags: GXF_PARAMETER_FLAGS_NONE

  • Type: GXF_PARAMETER_TYPE_HANDLE

  • Handle Type: nvidia::gxf::Receiver


inbuf_storage_type

Input buffer storage type

Valid values:

0: Host memory

1: Device memory

  • Flags: GXF_PARAMETER_FLAGS_NONE

  • Type: GXF_PARAMETER_TYPE_UINT32

  • Default: 1


scheduling_term

Handle to async scheduling term to get/set event state for VideoEncoderResponse codelet.

  • Flags: GXF_PARAMETER_FLAGS_NONE

  • Type: GXF_PARAMETER_TYPE_HANDLE

  • Handle Type: gxf::Handle<gxf::AsynchronousSchedulingTerm>


videoencoder_context

Handle to video encoder context component

  • Flags: GXF_PARAMETER_FLAGS_NONE

  • Type: GXF_PARAMETER_TYPE_HANDLE

  • Handle Type: gxf::Handle<VideoEncoderContext>


codec

Video codec to be used. Only H.264 supported.

Valid values:

0: H.264 codec

  • Flags: GXF_PARAMETER_FLAGS_NONE

  • Type: GXF_PARAMETER_TYPE_INT32

  • Default: 0


input_height

Input frame height

  • Flags: GXF_PARAMETER_FLAGS_NONE

  • Type: GXF_PARAMETER_TYPE_UINT32


input_width

Input frame width

  • Flags: GXF_PARAMETER_FLAGS_NONE

  • Type: GXF_PARAMETER_TYPE_UINT32


input_format

Input frame color format

  • Flags: GXF_PARAMETER_FLAGS_NONE

  • Type: GXF_PARAMETER_TYPE_STRING

Valid values:

nv12: NV12(YUV420, 2 planes: Y, UV interleaved) pitch linear format

yuv420planar: YUV420 planar(3 planes:Y,U,V) pitch linear format


profile

Encode profile

Valid values:

0: Baseline Profile

1: MainProfile

2: High Profile

  • Flags: GXF_PARAMETER_FLAGS_NONE

  • Type: GXF_PARAMETER_TYPE_INT32

  • Default: 2


bitrate

Bitrate of the encoded stream, in bits per second. This parmaeter is used when rate_control_mode != 0.

  • Flags: GXF_PARAMETER_FLAGS_NONE

  • Type: GXF_PARAMETER_TYPE_INT32

  • Default: 20000000


framerate

Frame rate (frames per second)

  • Flags: GXF_PARAMETER_FLAGS_NONE

  • Type: GXF_PARAMETER_TYPE_INT32

  • Default: 30


level

H.264 level parameter(Maximum data rate and resolution). This parameter is supported on Tegra only. For dGPU, the level parameter is automatically set based on input resolution and data rate.

Valid values: 0 - 14

0: Level 1.0

14: Level 5.1

  • Flags: GXF_PARAMETER_FLAGS_NONE

  • Type: GXF_PARAMETER_TYPE_INT32

  • Default: 14


hw_preset_type

Encode hw preset type

Valid values:

Tegra Presets: 0-4

0: V4L2_ENC_HW_PRESET_ULTRAFAST

1: V4L2_ENC_HW_PRESET_FAST

2: V4L2_ENC_HW_PRESET_MEDIUM

3: V4L2_ENC_HW_PRESET_SLOW

dGPU Presets: 0-7

0: p0

7: p7

  • Flags: GXF_PARAMETER_FLAGS_NONE

  • Type: GXF_PARAMETER_TYPE_INT32

  • Default: 1


iframe_interval

Interval between two IDR frames. This parameter is supported on Tegra only.

  • Flags: GXF_PARAMETER_FLAGS_NONE

  • Type: GXF_PARAMETER_TYPE_INT32

  • Default: 30


rate_control_mode

Rate control mode. This parameter is supported on Tegra only.

Valid values:

0:Constant QP mode(Rate control off)

1:CBR (Constant Bit Rate mode)

2:VBR (variable Bit Rate mode)

  • Flags: GXF_PARAMETER_FLAGS_NONE

  • Type: GXF_PARAMETER_TYPE_INT32

  • Default: 1


qp

H.264 Quantization Parameter(QP). This QP value is used in constant QP mode. This parameter is supported on Tegra only.

Valid values: 0-51

  • Flags: GXF_PARAMETER_FLAGS_NONE

  • Type: GXF_PARAMETER_TYPE_UINT32

  • Default: 20


config

Preset of encoder config parameters

Valid values:

pframe_cqp: This config uses P frames, rate_control_mode = 0(Constant QP), QP=20, iframe_interval = 5, Main profile, hw_preset_type = 0

iframe_cqp: This config uses all IDR frames(iframe_interval=1), rate_control_mode = 0(Constant QP), QP=20, Main profile, hw_preset_type = 0

custom: Use the parmaters set by the user

Note: pframe_cqp,iframe_cqp configs are supported on Tegra only. For dGPU, use ‘custom’ config.

  • Flags: GXF_PARAMETER_FLAGS_NONE

  • Type: GXF_PARAMETER_TYPE_STRING

  • Default: custom


nvidia::gxf::VideoEncoderResponse

This codelet completes the video encoding process by publishing encoded bit stream(H.264 elementary bit stream).

  • Component ID: c88585c4-bce0-48d1-9680-2309e63c1ff8

  • Base Type: nvidia::gxf::Codelet

Parameters

output_transmitter

Transmitter to publish the compressed data(output tensor)

  • Flags: GXF_PARAMETER_FLAGS_NONE

  • Type: GXF_PARAMETER_TYPE_HANDLE

  • Handle Type: nvidia::gxf::Transmitter


pool

Memory pool for allocating output data(tensor).

  • Flags: GXF_PARAMETER_FLAGS_NONE

  • Type: GXF_PARAMETER_TYPE_HANDLE

  • Handle Type: nvidia::gxf::Allocator


outbuf_storage_type

Output buffer storage type

Valid values:

0: Host memory

1: Device memory

  • Flags: GXF_PARAMETER_FLAGS_NONE

  • Type: GXF_PARAMETER_TYPE_INT32

  • Default: 1


videoencoder_context

Handle to video encoder context component

  • Flags: GXF_PARAMETER_FLAGS_NONE

  • Type: GXF_PARAMETER_TYPE_HANDLE

  • Handle Type: gxf::Handle<VideoEncoderContext>

nvidia::gxf::VideoEncoderContext

Component that implements the Video Encoder Context

  • Component ID: c5bdaa9f4b15-43c7-8066-20195122a5b5

  • Base Type: nvidia::gxf::Component

Parameters

None