Main Content

Network Video Receive

R2026b

Receive video from network RTP or IP camera RTSP stream on NVIDIA Jetson hardware

  • NVIDIA video stream block

Libraries:
NVIDIA Jetson and NVIDIA DRIVE / Audio and Video

Description

Add-On Required: This feature requires the MATLAB Coder Support Package for NVIDIA Jetson and NVIDIA DRIVE Platforms add-on.

The Network Video Receive block receives video from a network RTP or an IP camera RTSP stream. When you run a Simulink® model that contains this block on NVIDIA® Jetson™ hardware, the block outputs video from the network or IP camera.

Examples

Ports

Output

expand all

Image signal, returned as a matrix.

Dependencies

To enable this port, follow one of these actions:

  • Set the Format parameter to RGB and set the Image signal parameter to One multidimensional signal.

  • Set the Format parameter to Grayscale.

Data Types: uint8 | uint16

Red component of the output video stream, returned as a matrix.

Dependencies

To enable this port, set the Format parameter to RGB and set the Image signal parameter to Separate color signal.

Data Types: uint8

Green component of the output video stream, returned as a matrix.

Dependencies

To enable this port, set the Format parameter to RGB and set the Image signal parameter to Separate color signal.

Data Types: uint8

Blue component of the output video stream, returned as a matrix.

Dependencies

To enable this port, set the Format parameter to RGB and set the Image signal parameter to Separate color signal.

Data Types: uint8

Parameters

expand all

Video Parameters

Source of the video stream.

Programmatic Use

To set the block parameter value programmatically, use the set_param (Simulink) function.

To get the block parameter value programmatically, use the get_param (Simulink) function.

Parameter: VideoSource
Values: "Network stream" (default) | "Network device"

Example: set_param(gcb,VideoSource="Network device")

Resolution of the image to be captured, in pixels. Specify the resolution as a two-element vector in the format [width, height].

Programmatic Use

To set the block parameter value programmatically, use the set_param (Simulink) function.

To get the block parameter value programmatically, use the get_param (Simulink) function.

Parameter: ImageSize
Values: "[320, 240]" (default) | two-element vector in quotes

Example: set_param(gcb,ImageSize="[640 480]")

Format of the video stream. The format options depend on the value of the Video source parameter. This table shows the available formats:

 Network streamNetwork device

Available stream formats

"Grayscale (16-bit)" (Default)"Grayscale"
"Grayscale""RGB" (Default)
"RGB"-

Block parameter name

"ImageFormat""DeviceImageFormat"

Programmatic Use

To set the block parameter value programmatically, use the set_param (Simulink) function.

To get the block parameter value programmatically, use the get_param (Simulink) function.

Parameter: ImageFormat
Values: "Grayscale (16-bit)" (default) | "Grayscale" | "RGB"

Example: set_param(gcb,ImageFormat="Grayscale")

Parameter: DeviceImageFormat
Values: "RGB" (default) | "Grayscale"

Example: set_param(gcb,DeviceImageFormat="Grayscale")

Format of the output of the RGB video signal. If you set this parameter to One multidimensional signal, the block outputs an M-by-N-by-P color video signal, where P is the number of color planes, at the Image port. If you select Separate color signal, the R, G, and B ports output each color signal. Each port outputs one M-by-N plane of an RGB video stream.

Dependencies

To enable this parameter, set Format to RGB.

Programmatic Use

To set the block parameter value programmatically, use the set_param (Simulink) function.

To get the block parameter value programmatically, use the get_param (Simulink) function.

Parameter: ImageSignal
Values: "One multidimensional signal" (default) | "Separate color signal"

Example: set_param(gcb,ImageSignal="Separate color signal")

Type of compression algorithm to use to decode the RTP video stream. The compression options depend on the value of the Video source parameter.

 Network streamNetwork device

Available compression algorithms

"JPEG" (Default)"H264" (Default)
"VP8""H265"
"VP9"-
"H264"-
"H265"-
"None (uncompressed)"-

Block parameter name

"Decoder""VideoDeviceDecoder"

Note

If you set the Compression parameter to H265, you must start the receiver before the sender starts the video stream. The sender sends metadata required to decode the data at the start of the stream. Alternatively, you can configure the sender to insert this metadata at intervals during the stream. For example, enter this command:

gst-launch-1.0 -v videotestsrc is-live=true ! video/x-raw,
framerate=100/1,width=320,height=240 ! videoconvert 
! x265enc tune=zerolatency ! h265parse config-interval=2 
! rtph265pay ! udpsink host=127.0.0.1 port=3000

Programmatic Use

To set the block parameter value programmatically, use the set_param (Simulink) function.

To get the block parameter value programmatically, use the get_param (Simulink) function.

Parameter: Decoder
Values: "JPEG" (default) | "VP8" | "VP9" | "H264" | "H265" | "None (uncompressed)"

Example: set_param(gcb,Decoder="H265")

Parameter: VideoDeviceDecoder
Values: "H264" (default) | "H265"

Example: set_param(gcb,VideoDeviceDecoder="H265")

Select this parameter to use the graphics hardware on the NVIDIA target for decoding.

Note

If you enable this parameter and set the Format parameter to a value other than RGB, the generated application generates an error.

When you enable hardware acceleration, the block scales the received image:

  • If the resolution for the sender and receiver differ, the hardware accelerator scales the received image. If you disable hardware acceleration, the image resolution specification at the sender and receiver must be the same.

  • If the video frame size is not a multiple of 16, the hardware accelerator libraries pads the borders of the received video frame to output the requested size.

Programmatic Use

To set the block parameter value programmatically, use the set_param (Simulink) function.

To get the block parameter value programmatically, use the get_param (Simulink) function.

Parameter: UseHWAcceleration
Values: "on" (default) | "off"

Example: get_param(gcb,"UseHWAcceleration")

Connection Parameters

Port number from which to receive the video packets. Set the port number to the remote port number of the host machine that sends the video.

Dependencies

To enable this parameter, set Video source to Network stream.

Programmatic Use

To set the block parameter value programmatically, use the set_param (Simulink) function.

To get the block parameter value programmatically, use the get_param (Simulink) function.

Parameter: Port
Values: "3000" (default) | numeric scalar in quotes

Example: set_param(gcb,Port="3000")

RTSP URL of the IP camera.

Dependencies

To enable this parameter, set Video source to Network device.

Programmatic Use

To set the block parameter value programmatically, use the set_param (Simulink) function.

To get the block parameter value programmatically, use the get_param (Simulink) function.

Parameter: URI
Values: "rtsp://" (default) | string | character vector

Example: get_param(gcb,"URI")

Sample time, in seconds, at which the block reads the video from the network. The value determines the frequency at which the block captures new images.

Smaller values require the processor to complete the same number of instructions in less time, which can cause task overruns.

Programmatic Use

To set the block parameter value programmatically, use the set_param (Simulink) function.

To get the block parameter value programmatically, use the get_param (Simulink) function.

Parameter: SampleTime
Values: "0.1" (default) | numeric scalar in quotes | numeric vector in quotes

Example: set_param(gcb,SampleTime="0.2")

Version History

Introduced in R2021b