StreamingParameters Struct Reference

Structure containing the options used to stream with the ZED SDK. More...

Functions

 StreamingParameters (STREAMING_CODEC codec_=STREAMING_CODEC::H265, unsigned short port_=30000, unsigned int bitrate_=0, int gop_size_=-1, bool adaptative_bitrate_=false, unsigned short chunk_size_=16084, unsigned int target_framerate_=0)
 Default constructor. More...
 
bool save (String filename, SERIALIZATION_FORMAT format=SERIALIZATION_FORMAT::JSON) const
 Saves the current set of parameters into a file to be reloaded with the load() method. More...
 
bool load (String filename, SERIALIZATION_FORMAT format=SERIALIZATION_FORMAT::JSON)
 Loads a set of parameters from the values contained in a previously saved file. More...
 
bool encode (String &serialized_content, SERIALIZATION_FORMAT format=SERIALIZATION_FORMAT::JSON) const
 Generate a JSON Object (with the struct type as a key) containing the serialized struct, converted into a string. More...
 
bool decode (const String &serialized_content, SERIALIZATION_FORMAT format=SERIALIZATION_FORMAT::JSON)
 Fill the structure from the serialized json object contained in the input string. More...
 
bool operator== (const StreamingParameters &param1) const
 
bool operator!= (const StreamingParameters &param1) const
 

Attributes

STREAMING_CODEC codec = STREAMING_CODEC::H265
 Encoding used for streaming. More...
 
unsigned short port = 30000
 Port used for streaming. More...
 
unsigned int bitrate = 0
 Streaming bitrate (in Kbits/s) used for streaming. More...
 
int gop_size = -1
 GOP size in number of frames. More...
 
bool adaptative_bitrate = false
 Defines whether the adaptive bitrate is enable. More...
 
unsigned short chunk_size = 16084
 Size of a single chunk. More...
 
unsigned int target_framerate = 0
 Framerate for the streaming output. More...
 

Detailed Description

Structure containing the options used to stream with the ZED SDK.

The default constructor sets all parameters to their default settings.

Note
Parameters can be adjusted by the user.

Constructor and Destructor

◆ StreamingParameters()

StreamingParameters ( STREAMING_CODEC  codec_ = STREAMING_CODEC::H265,
unsigned short  port_ = 30000,
unsigned int  bitrate_ = 0,
int  gop_size_ = -1,
bool  adaptative_bitrate_ = false,
unsigned short  chunk_size_ = 16084,
unsigned int  target_framerate_ = 0 
)

Default constructor.

All the parameters are set to their default values.

Functions

◆ save()

bool save ( String  filename,
SERIALIZATION_FORMAT  format = SERIALIZATION_FORMAT::JSON 
) const

Saves the current set of parameters into a file to be reloaded with the load() method.

Parameters
filename: Name of the file which will be created to store the parameters (extension '.yml' will be added if not set).
Returns
True if the file was successfully saved, otherwise false.
Warning
For security reasons, the file must not already exist.
In case a file already exists, the method will return false and existing file will not be updated.

◆ load()

bool load ( String  filename,
SERIALIZATION_FORMAT  format = SERIALIZATION_FORMAT::JSON 
)

Loads a set of parameters from the values contained in a previously saved file.

Parameters
filename: Path to the file from which the parameters will be loaded (extension '.yml' will be added at the end of the filename if not detected).
Returns
True if the file was successfully loaded, otherwise false.

◆ encode()

bool encode ( String serialized_content,
SERIALIZATION_FORMAT  format = SERIALIZATION_FORMAT::JSON 
) const

Generate a JSON Object (with the struct type as a key) containing the serialized struct, converted into a string.

Parameters
serialized_contentoutput string containing the JSON Object
formatserialization format, default is JSON
Returns
True if file was successfully saved, otherwise false.

◆ decode()

bool decode ( const String serialized_content,
SERIALIZATION_FORMAT  format = SERIALIZATION_FORMAT::JSON 
)

Fill the structure from the serialized json object contained in the input string.

Parameters
serialized_contentinput string containing the JSON Object
formatserialization format, default is JSON
Returns
True if the decoding was successful, otherwise false.

◆ operator==()

bool operator== ( const StreamingParameters param1) const

Comparison operator ==

Parameters
StreamingParametersto compare
Returns
true if the two struct are identical

◆ operator!=()

bool operator!= ( const StreamingParameters param1) const

Comparison operator !=

Parameters
StreamingParametersto compare
Returns
true if the two struct are different

Variables

◆ codec

Encoding used for streaming.

◆ port

unsigned short port = 30000

Port used for streaming.

Warning
Port must be an even number. Any odd number will be rejected.
Port must be opened.

◆ bitrate

unsigned int bitrate = 0

Streaming bitrate (in Kbits/s) used for streaming.

sl::STREAMING_CODEC sl::RESOLUTION FPS Bitrate (kbps)
H264 HD2K 15 8500
H264 HD1080 30 12500
H264 HD720 60 7000
H265 HD2K 15 7000
H265 HD1080 30 11000
H265 HD720 60 6000

Default: 0 (it will be set to the best value depending on your resolution/FPS)

Note
Available range: [1000 - 60000]

◆ gop_size

int gop_size = -1

GOP size in number of frames.

Default: -1 (the GOP size will last at maximum 2 seconds, depending on camera FPS)

Note
The GOP size determines the maximum distance between IDR/I-frames. Very high GOP size will result in slightly more efficient compression, especially on static scenes. But latency will increase.
Maximum value: 256

◆ adaptative_bitrate

bool adaptative_bitrate = false

Defines whether the adaptive bitrate is enable.

Default: false

Note
Bitrate will be adjusted depending the number of packet dropped during streaming.
If activated, the bitrate can vary between [bitrate/4, bitrate].
Warning
Currently, the adaptive bitrate only works when "sending" device is a NVIDIA Jetson (X1, X2, Xavier, Nano).

◆ chunk_size

unsigned short chunk_size = 16084

Size of a single chunk.

Default: 16084

Note
Stream buffers are divided into X number of chunks where each chunk is chunk_size bytes long.
You can lower chunk_size value if network generates a lot of packet lost: this will generates more chunk for a single image, but each chunk sent will be lighter to avoid inside-chunk corruption.
Increasing this value can decrease latency.


Note
Available range: [1024 - 65000]

◆ target_framerate

unsigned int target_framerate = 0

Framerate for the streaming output.

Default: 0 (camera framerate will be taken)

Warning
This framerate must be below or equal to the camera framerate.
Allowed framerates are 15, 30, 60 or 100 if possible.
Any other values will be discarded and camera FPS will be taken.