Skip to main content
SDK Version: 2.5.0
DX-STREAM manual (PDF)

DxConvert

DxConvert is an element that converts video frames between different color formats.
DxConvert uses the VideoTransformFactory to automatically select the best available hardware-accelerated backend. The selection priority is: V3 DSP > VNPU > RGA > libyuv (software fallback).

Key Features​

Color Format Conversion

  • Converts video frames between NV12, I420, RGB, and BGR pixel formats.
  • Supports all 4×4 format combinations (e.g., NV12→RGB, I420→BGR, RGB→NV12, etc.).

Same-Format Passthrough

  • When the input and output formats are identical, the element passes frames through without any modification (in-place).

Automatic Backend Selection

  • The VideoTransformFactory selects the best available backend automatically:
    1. V3 DSP – DEEPX V3 device DSP (when the V3 sibling plugin is installed)
    2. VNPU – DEEPX VNPU hardware backend (when the VNPU sibling plugin is installed)
    3. RGA – Rockchip Raster Graphic Accelerator (when the RGA sibling plugin is installed)
    4. libyuv – Software fallback (always available)

Hierarchy​

GObject
+----GInitiallyUnowned
+----GstObject
+----GstElement
+----GstBaseTransform
+----GstDxConvert

Pad Templates​

Sink (input)

PropertyValue
Formatvideo/x-raw, format=(string){ NV12, I420, RGB, BGR }

Src (output)

PropertyValue
Formatvideo/x-raw, format=(string){ NV12, I420, RGB, BGR }

Properties​

DxConvert has no configurable properties. The target format is negotiated automatically through GStreamer caps negotiation.

Usage Example​

Convert an NV12 stream to RGB:

gst-launch-1.0 \
filesrc location=input.mp4 ! decodebin ! \
video/x-raw,format=NV12 ! \
dxconvert ! \
video/x-raw,format=RGB ! \
autovideosink

Convert I420 to RGB before inference:

gst-launch-1.0 \
filesrc location=input.mp4 ! decodebin ! \
video/x-raw,format=I420 ! \
dxconvert ! \
video/x-raw,format=RGB ! \
dxpreprocess preprocess-id=1 ... ! \
dxinfer ...

Combine with DxScale — convert format and resize in a pipeline:

gst-launch-1.0 \
filesrc location=input.mp4 ! decodebin ! \
video/x-raw,format=NV12 ! \
dxconvert ! \
video/x-raw,format=RGB ! \
dxscale width=640 height=480 ! \
autovideosink
NOTE
  • dxconvert does not perform scaling. Input and output resolutions must match.
  • For video scaling, use DxScale.
  • Which conversions are hardware-accelerated depends on the platform and the installed backends. Combinations that no hardware backend supports use the libyuv software backend.
DxInputSelector Placement

dxconvert must not be placed downstream of DxInputSelector. DxInputSelector merges multiple streams with potentially different color formats into a single output, causing caps to change on every buffer. Since dxconvert is a GstBaseTransform element, it requires stable caps for buffer pool allocation and kernel initialization. Placing it after DxInputSelector will cause repeated caps renegotiation, kernel re-creation, and potential caps/buffer mismatch errors. Place dxconvert before DxInputSelector (per-stream) or after DxOutputSelector (per-stream).