跳转到主要内容
SDK Version: 2.3.3

DxScale

DxScale is an element that scales video frames to a specified target resolution.
DxScale uses the VideoTransformFactory to automatically select the best available hardware-accelerated backend (RGA on RK3588) or falls back to the libyuv software backend.

Key Features

Resolution Scaling

  • Scales input video frames to the resolution specified by width and height properties.
  • Supports NV12, I420, RGB, and BGR pixel formats (same format on input and output — scale only, no conversion).

Passthrough Mode

  • When width and height are both set to 0 (default), the element passes frames through without any modification.

Automatic Backend Selection

  • On RK3588 platforms with RGA hardware: attempts RGA-accelerated scaling first.
  • Falls back to libyuv software scaling if the hardware backend does not support the source format.

Hierarchy

GObject
+----GInitiallyUnowned
+----GstObject
+----GstElement
+----GstBaseTransform
+----GstDxScale

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

NameDescriptionTypeDefault ValueRange
widthTarget output width. Set to 0 for passthrough.Unsigned Integer00 – 8192
heightTarget output height. Set to 0 for passthrough.Unsigned Integer00 – 8192

Usage Example

Scale an I420 video stream from 1920×1080 to 640×480:

gst-launch-1.0 \
filesrc location=input.mp4 ! decodebin ! \
dxscale width=640 height=480 ! \
videoconvert ! autovideosink

Scale NV12 decoder output before inference:

gst-launch-1.0 \
filesrc location=input.mp4 ! decodebin ! \
dxscale width=640 height=640 ! \
dxpreprocess preprocess-id=1 ... ! \
dxinfer ...
NOTE
  • dxscale does not perform color conversion. Input and output must be the same format.
  • For color conversion, use DxConvert.
  • Both width and height must be set together. Setting only one is not supported.
DxInputSelector Placement

dxscale must not be placed downstream of DxInputSelector. DxInputSelector merges multiple streams with potentially different resolutions into a single output, causing caps to change on every buffer. Since dxscale 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 dxscale before DxInputSelector (per-stream) or after DxOutputSelector (per-stream).