VideoStream Class
CameraSettingClass
Description
Constructs a CameraSetting object and set the parameters needed for camera.
Syntax
class CameraSetting
Members
Public Constructors | |
CameraSetting::CameraSetting | Constructs a CameraSetting object and set the parameters needed for camera. |
VideoSettingClass
Description
A class used to configure parameters for video streams.
Syntax
class VideoSetting
Members
Public Constructors | |
VideoSetting::VideoSetting | Constructs a VideoSetting object and set the parameters needed for video streams. |
Public Methods | |
VideoSetting::setBitrate | Configure bitrate for H264 and H265 video encoder. |
VideoSetting::setJpegQuality | Configure quality level for JPEG snapshots. |
VideoSetting::setRotation | Configure orientation for H264, H265 video and JPEG encoders. |
VideoSetting::width | Get current configured video stream width. |
VideoSetting::height | Get current configured video stream height. |
VideoSetting::fps | Get current configured video stream fps (frame per second). |
VideoSetting::VideoSetting
Description
Constructs a VideoSetting object and sets the parameters needed for video streams, such as resolution, frame rate per second (fps), bit rate per second (bps), encoder type.
Syntax
VideoSetting(uint8_t preset);
VideoSetting(uint8_t resolution, uint8_t fps, uint8_t encoder, uint8_t snapshot);
VideoSetting(uint16_t w, uint16_t h, uint8_t fps, uint8_t encoder, uint8_t snapshot);
Parameters
preset: Select one out of 3 preset video stream settings. Default preset: 0.
resolution: Video resolution (Valid value: VIDEO_HD, VIDEO_FHD)
fps: Frame rate in frames per second.
encoder: Video encoder format to use. (Valid value: VIDEO_HEVC, VIDEO_H264, VIDEO_JPEG)
snapshot: Enable or disable snapshot function.
w: Width in pixels.
h: Height in pixels.
Returns
NA
Example Code
VideoOnly
(https://github.com/ambiot/ambpro2_arduino/blob/dev/Arduino_package/hardware/libraries/Video/examples/StreamRTSP/VideoOnly/VideoOnly.ino)
Notes and Warnings
“VideoStream.h” must be included to use the class function.
Preset configurations:
Preset 0:
resolution: VIDEO_FHD
fps: 30
bps: 2*1024*1024
encoder: VIDEO_H264
snapshot: 0
Preset 1:
resolution: VIDEO_HD
fps: 30
bps: 2*1024*1024
encoder: VIDEO_H264
snapshot: 0
Preset 2:
resolution: VIDEO_FHD
fps: 30
bps: 2*1024*1024
encoder: VIDEO_JPEG
snapshot: 0
VideoSetting::setBitrate
Description
Configure bitrate for H264 and H265 video encoder.
Syntax
void setBitrate(uint32_t bitrate);
Parameters
bitrate: desired video encoder bitrate. Valid values range from 1Mbps (1024 * 1024) to 50Mbps (50 * 1024 * 1024). Default value of 4Mbps.
Returns
NA
Example Code
VideoOnly
(https://github.com/ambiot/ambpro2_arduino/blob/dev/Arduino_package/hardware/libraries/Video/examples/StreamRTSP/VideoOnly/VideoOnly.ino)
Notes and Warnings
“VideoStream.h” must be included to use the class function. The default value of 4Mbps is a suitable balance of video quality and file size. For RTSP streaming, it is recommended that the bitrate is lowered to 2Mbps to account for possible network congestion.
VideoSetting::setJpegQuality
Description
Configure quality level for JPEG snapshots.
Syntax
void setJpegQuality(uint8_t quality);
Parameters
quality: desired JPEG image quality level. Valid values range from 1 (worst) to 9 (best). Default value of 5.
Returns
NA
Example Code
NA
Notes and Warnings
“VideoStream.h” must be included to use the class function. A lower quality results in a reduced file size, while a quality level of 9 may result in large file sizes without a significant improvements in image quality.
VideoSetting::setRotation
Description
Configure orientation for H264, H265 video and JPEG encoders.
Syntax
void setRotation(int angle);
Parameters
angle: desired rotation angle represented by numerical values. Valid values: 0, 1, 2, 3. Default value of 0.
0: No rotation
1: 90 degree to right
2. 90 degree to left
3: 180 degree
Returns
NA
Example Code
NA
Notes and Warnings
“VideoStream.h” must be included to use the class function.
VideoSetting::width
Description
Get current configured video stream width.
Syntax
uint16_t width(void);
Parameters
NA
Returns
This function returns the current configured video stream width.
Example Code
LoopPostProcessing
(https://github.com/ambiot/ambpro2_arduino/blob/dev/Arduino_package/hardware/libraries/Video/examples/MotionDetection/LoopPostProcessing/LoopPostProcessing.ino)
Notes and Warnings
“VideoStream.h” must be included to use the class function.
VideoSetting::height
Description
Get current configured video stream height.
Syntax
uint16_t height(void);
Parameters
NA
Returns
This function returns the current configured video stream height.
Example Code
LoopPostProcessing
(https://github.com/ambiot/ambpro2_arduino/blob/dev/Arduino_package/hardware/libraries/Video/examples/MotionDetection/LoopPostProcessing/LoopPostProcessing.ino)
Notes and Warnings
“VideoStream.h” must be included to use the class function.
VideoSetting::fps
Description
Get current configured video stream fps (frame per second).
Syntax
uint16_t fps(void);
Parameters
NA
Returns
This function returns the current configured video stream fps.
Example Code
NA
Notes and Warnings
“VideoStream.h” must be included to use the class function.
VideoClass
Description
A class used to configure and initialize the camera to generate video data streams.
Syntax
class Video
Members
Public Constructors | |
Video::Video | Construct a Video object. |
Public Methods | |
Video::configVideoChannel | Configure video stream channel. |
Video::camInit | Initialization of camera sensor using existing configurations. |
Video::camDeinit | Deinitialization of camera sensor. |
Video::videoInit | Initialization of video streams using existing configurations. |
Video::videoDeinit | Deinitialization of video stream module for a specific channel. |
Video::channelBegin | Start video streaming on a specific channel. |
Video::channelEnd | Stop video streaming on a specific channel. |
Video::getStream | Get video data stream to provide as an input for other data stream consumers. |
Video::getImage | Enable snapshot function. |
Video::setFPS | Set camera video max FPS. |
Video::printInfo | Print out current configuration of video channels. |
Video::configVideoChannel
Description
Configure video stream channel parameters using VideoSetting class object.
Syntax
void configVideoChannel(int ch, VideoSetting& config);
Parameters
ch: Channel to configure (Valid value: 0,1,2)
config: VideoSetting object
Returns
NA
Example Code
VideoOnly
(https://github.com/ambiot/ambpro2_arduino/blob/dev/Arduino_package/hardware/libraries/Video/examples/StreamRTSP/VideoOnly/VideoOnly.ino)
Notes and Warnings
“VideoStream.h” must be included to use the class function.
Video::camInit
Description
Initialize camera sensor using configuration from CameraSetting object.
Syntax
void cameraInit(CameraSetting& config);
Parameters
config: CameraSetting object.
Returns
NA
Example Code
NA
Notes and Warnings
“VideoStream.h” must be included to use the class function.
Video::camDeinit
Description
Deinitialize camera sensor.
Syntax
void cameraDeinit(void);
Parameters
NA
Returns
NA
Example Code
NA
Notes and Warnings
“VideoStream.h” must be included to use the class function.
Video::videoInit
Description
Initialization of video streams from camera using existing configurations.
Syntax
void videoInit(void);
Parameters
NA
Returns
NA
Example Code
VideoOnly
(https://github.com/ambiot/ambpro2_arduino/blob/dev/Arduino_package/hardware/libraries/Video/examples/StreamRTSP/VideoOnly/VideoOnly.ino)
Notes and Warnings
“VideoStream.h” must be included to use the class function.
Video::videoDeinit
Description
Deinitialization of all video streams.
Syntax
void videoDeinit(void);
Parameters
NA
Returns
NA
Example Code
NA
Notes and Warnings
“VideoStream.h” must be included to use the class function.
Video::channelBegin
Description
Start video streaming on a specific channel.
Syntax
void channelBegin(int ch);
Parameters
ch: channel to start streaming. Default channel is 0.
Returns
NA
Example Code
VideoOnly
(https://github.com/ambiot/ambpro2_arduino/blob/dev/Arduino_package/hardware/libraries/Video/examples/StreamRTSP/VideoOnly/VideoOnly.ino)
Notes and Warnings
“VideoStream.h” must be included to use the class function.
Video::channelEnd
Description
Stop video streaming on a specific channel.
Syntax
void channelEnd(int ch);
Parameters
ch: channel to stop streaming. Default channel is 0.
Returns
NA
Example Code
NA
Notes and Warnings
“VideoStream.h” must be included to use the class function.
Video::getStream
Description
Get video data stream to provide as an input for other data stream consumers.
Syntax
MMFModule getStream(int ch);
Parameters
ch: channel to get data stream of. Default channel is 0.
Returns
This function returns the video data stream.
Example Code
VideoOnly
(https://github.com/ambiot/ambpro2_arduino/blob/dev/Arduino_package/hardware/libraries/Video/examples/StreamRTSP/VideoOnly/VideoOnly.ino)
Notes and Warnings
“VideoStream.h” must be included to use the class function.
Video::getImage
Description
Take a snapshot.
Syntax
void getImage(int ch, uint32_t* addr, uint32_t* len);
Parameters
ch: Video stream channel to take a snapshot from.
addr: A pointer to a 32-bit unsigned integer to store the image address.
len: A pointer to a 32-bit unsigned integer to store the image length.
Returns
NA
Example Code
HTTPDisplayJPEG
(https://github.com/ambiot/ambpro2_arduino/blob/dev/Arduino_package/hardware/libraries/Video/examples/CaptureJPEG/HTTPDisplayJPEG/HTTPDisplayJPEG.ino)
Notes and Warnings
“VideoStream.h” must be included to use the class function.
Video::setFPS
Description
Set camera video max FPS.
Syntax
void setFPS(int fps);
Parameters
fps: max frame rate in frames per second for camera.
Returns
NA
Example Code
NA
Notes and Warnings
“VideoStream.h” must be included to use the class function.
Video::printInfo
Description
Print out current configuration of video channels.
Syntax
void printInfo(void);
Parameters
NA
Returns
NA
Example Code
VideoOnly
(https://github.com/ambiot/ambpro2_arduino/blob/dev/Arduino_package/hardware/libraries/Video/examples/StreamRTSP/VideoOnly/VideoOnly.ino)
Notes and Warnings
“VideoStream.h” must be included to use the class function.