Main Content

Video Send

R2026b

Send video streams to a remote device

  • Simulation 3D Video Send

Libraries:
UAV Toolbox / Simulation 3D

Description

The Video Send block sends video streams from Simulink® to a specified remote device through a UDP connection. Use this block in hardware‑in‑the‑loop simulation to transmit grayscale and RGB images, as well as depth and lidar point cloud data generated from Unreal Engine®.

Examples

Limitations

  • To use this block, you must install a stable GStreamer 1.x release with these plugins:

    • app

    • rtp

    • rtpmanager

    • videoconvertscale

    • coreelements

    • coretracers

    • udp

    • jpeg

    • vpx

    For instructions on installing GStreamer, see Install and Configure GStreamer to Send Video Streams.

  • To send video streams, this block uses the first available local port regardless of the remote port specified in the Remote port parameter.

  • This block is supported on only Windows® and macOS systems.

Ports

Input

expand all

Input video stream, specified as an M-by-N matrix or M-by-N-by-3 array, representing a grayscale or RGB image, respectively. The format of this input depends on the value of the Format parameter:

  • RGB — Specify the input as an M-by-N-by-3 array. The third dimension consists of the red, green, and blue color channels. Each element of the matrix must be an integer in the range [0, 255].

  • Grayscale — Specify the input as an M-by-N matrix. Each element of the matrix must be an integer in the range [0, 255].

  • Grayscale (16-bit) — Specify the input as an M-by-N matrix. Each element of the matrix must be an integer in the range [0, 65535].

M and N are the image height and width, respectively, in pixels.

Dependencies

To enable this port, set the Image signal parameter to One multidimensional signal.

Data Types: uint8 | uint16

Red channel of the input video stream, specified as an M-by-N matrix. M and N are the image height and width, respectively, in pixels. Each element of the matrix must be an integer in the range [0, 255].

Dependencies

To enable this port, set the Image signal parameter to Separate color signals.

Data Types: uint8

Green channel of the input video stream, specified as an M-by-N matrix. M and N are the image height and width, respectively, in pixels. Each element of the matrix must be an integer in the range [0, 255].

Dependencies

To enable this port, set the Image signal parameter to Separate color signals.

Data Types: uint8

Blue channel of the input video stream, specified as an M-by-N matrix. M and N are the image height and width, respectively, in pixels. Each element of the matrix must be an integer in the range [0, 255].

Dependencies

To enable this port, set the Image signal parameter to Separate color signals.

Data Types: uint8

Parameters

expand all

Video parameters

Specify the signal format for the input video stream:

  • RGB — RGB image (8-bit with three color channels)

  • Grayscale — Grayscale image (8-bit)

  • Grayscale (16-bit) — Grayscale image (16-bit)

Specify the RGB image input signal structure:

  • One multidimensional signal — The block uses the Image input port, which accepts an M-by-N-by-3 array containing the red, green, and blue channels of an RGB image.

  • Separate color signals — The block uses the R, G, and B input ports, each of which accepts a single M-by-N matrix that represents a color channel.

Dependencies

To enable this parameter, set the Format parameter to RGB

Specify the compression format for the video stream:

  • JPEG — Uses the jpeg GStreamer plugin with this pipeline:

    video/x-raw,format=I420 ! jpegenc quality=<Quality> idct-method=1 ! rtpjpegpay ! udpsink sync=false host=<Remote address> port=<Remote port>

  • VP8 — Uses the vpx GStreamer plugin with this pipeline:

    vp8enc deadline=<Max frame time*1000> bits-per-pixel=0.0434 target-bitrate=0 threads=8 lag-in-frames=0 ! rtpvp8pay ! udpsink sync=false host=<Remote address> port=<Remote port>

  • VP9 — Uses the vpx GStreamer plugin with this pipeline:

    vp9enc deadline=<Max frame time*1000> bits-per-pixel=0.0434 target-bitrate=0 threads=8 lag-in-frames=0 ! rtpvp9pay ! udpsink sync=false host=<Remote address> port=<Remote port>

Specify the quality of the JPEG video stream as a scalar in the range [0, 100]. This parameter controls the encoding speed and the compression ratio. Higher values improve image quality but require more network bandwidth. Lower values reduce bandwidth usage and are suitable for low‑bandwidth connections.

Dependencies

To enable this parameter, set the Compression parameter to JPEG.

Specify the maximum frame time of the VP8 or VP9 video stream as a positive integer, in milliseconds. This parameter controls the maximum amount of time the codec spends encoding each image. Set this parameter based on the frame rate of the input image. A good starting point is 1000/fps, where fps is the sample rate of the input video signal. Setting this parameter to 0 enables the encoder to take as long as required for each frame, increasing image quality at the expense of additional encoding time.

Dependencies

To enable this parameter, set the Compression parameter to VP8 or VP9.

Connection parameters

Specify the IP address or host name of the remote device that the block streams the video to as a character vector.

Specify the port of the remote device that the block sends the message to as an integer in the range [0, 65535]. If you specify this parameter as 0, this block streams the video to the first open UDP port.

Tips

  • VP8 and VP9 compression formats are bandwidth‑efficient, but computationally expensive. Choose the JPEG compression format when running on machines with limited CPU resources.

  • To receive the video stream on the remote device, in a separate model, use the Network Video Receive (MATLAB Coder) block. Alternatively, you can use your custom GStreamer-based receiver.

Version History

Introduced in R2021b

expand all