Main Content

Network Video Receive

Receive video from a network RTP or IP camera RTSP stream

Since R2021b

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

  • NVIDIA video stream block

Libraries:
NVIDIA Jetson and NVIDIA DRIVE / Audio and Video

Description

Receives video from a network RTP or an IP camera RTSP stream. When running on hardware, the block outputs video from the network or IP camera.

Ports

Output

expand all

This port outputs the image signal of each pixel.

Dependencies

This port appears when you select RGB for Format and One multidimensional signal for Image signal or when you select Grayscale for Format in the block parameters window.

Data Types: uint8 | uint16

This port outputs the red component of each pixel.

Dependencies

This port appears only when you select RGB for Format and Separate color signal for Image signal in the block parameters window.

Data Types: uint8

This port outputs the green component of each pixel.

Dependencies

This port appears only when you select RGB for Format and Separate color signal for Image signal in the block parameters window.

Data Types: uint8

This port outputs the blue component of each pixel.

Dependencies

This port appears only when you select RGB for Format and Separate color signal for Image signal in the block parameters window.

Data Types: uint8

Parameters

expand all

Video Parameters

Specify the source of the video stream.

Programmatic Use

Block Parameter: VideoSource
Type: character vector
Values: 'Network stream'|'Network device'
Default: 'Network stream'

Specify the resolution of the image to be captured, in pixels.

Programmatic Use

Block Parameter: ImageSize
Type: character vector
Values: [width, height]|
Default: '[320, 240]'

Specify the format of the video stream. The format options are based on the value set for Video source.

 Network streamNetwork device

Available stream formats

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

Block parameter name

'ImageFormat''DeviceImageFormat'

Programmatic Use

Block Parameter: ImageFormat|DeviceImageFormat
Type: character vector
Values: 'RGB'|'Grayscale'|'Grayscale (16-bit)'

Specify how to output RGB color video signal. If you select 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, additional ports appear on the block. Each port outputs one M-by-N plane of an RGB video stream.

Dependencies

To enable this parameter, set Format to RGB.

Programmatic Use

Block Parameter: ImageSignal
Type: character vector
Values: 'One multidimensional signal'|'Separate color signal'|
Default: 'One multidimensional signal'

Select the type of compression algorithm to use for decoding the RTP video stream. The compression options are based on the value set for Video source.

 Network streamNetwork device

Available compression algorithms

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

Block parameter name

'Decoder''VideoDeviceDecoder'

Note

When selecting H265 decoder, the receiver must be started before the sender starts the video stream. This is because metadata required to decode the data is emitted at the start of the stream. Alternatively, you can configure the sender to insert this metadata at intervals within the stream. For example, when using GStreamer, use the following 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

Block Parameter: Decoder | VideoDeviceDecoder
Type: character vector
Values: 'JPEG'|'VP8'|'VP9'|'H264'|'H265'|'None (uncompressed)'

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

Note

When hardware acceleration is enabled, the image resolution is automatically scaled if the sender and receiver specifications for resolution are different. If you disable hardware acceleration, the automatic scaling is also disabled. In such cases, 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. If this behavior is not desired, disable hardware acceleration.

Connection Parameters

Specify the port number from which you want to receive the video packets. Match the local port number with the remote port number of the sending host.

Dependencies

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

RTSP URL of the IP camera, specified as a character vector.

Dependencies

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

Select the sample time of the video device.

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

Programmatic Use

Block Parameter: SampleTime
Type: character vector
Values: scalar | vector
Default: '0.1'

Version History

Introduced in R2021b