maix::video

maix.video module

This is maix::video module of MaixCDK.
All of these elements are in namespace maix::video.

For MaixCDK developer: DO NOT edit this doc file manually, this doc is auto generated!

Module

No module

Enum

VideoType

Video type

item describe
values VIDEO_NONE: format invalid
VIDEO_ENC_H265_CBR: Deprecated
VIDEO_ENC_MP4_CBR: Deprecated
VIDEO_DEC_H265_CBR: Deprecated
VIDEO_DEC_MP4_CBR: Deprecated
VIDEO_H264_CBR: Deprecated
VIDEO_H265_CBR: Deprecated
VIDEO_H264_CBR_MP4: Deprecated
VIDEO_H265_CBR_MP4: Deprecated
VIDEO_H264:
VIDEO_H264_MP4:
VIDEO_H264_FLV:
VIDEO_H265:
VIDEO_H265_MP4:

C++ defination code:

enum VideoType
    {
        VIDEO_NONE = 0,  // format invalid
        VIDEO_ENC_H265_CBR,     // Deprecated
        VIDEO_ENC_MP4_CBR,      // Deprecated
        VIDEO_DEC_H265_CBR,     // Deprecated
        VIDEO_DEC_MP4_CBR,      // Deprecated
        VIDEO_H264_CBR,         // Deprecated
        VIDEO_H265_CBR,         // Deprecated
        VIDEO_H264_CBR_MP4,     // Deprecated
        VIDEO_H265_CBR_MP4,     // Deprecated

        VIDEO_H264,
        VIDEO_H264_MP4,
        VIDEO_H264_FLV,
        VIDEO_H265,
        VIDEO_H265_MP4,
    }

MediaType

Video type

item describe
values MEDIA_TYPE_UNKNOWN: Represents an unknown media type, which is usually treated as AVMEDIA_TYPE_DATA.
MEDIA_TYPE_VIDEO: Represents a video stream, such as video content encoded in H.264, MPEG-4, etc.
MEDIA_TYPE_AUDIO: Represents an audio stream, such as audio content encoded in AAC, MP3, etc.
MEDIA_TYPE_DATA: Represents opaque data streams that are usually continuous. This type of stream is not necessarily audio or video and may be used for other data purposes.
MEDIA_TYPE_SUBTITLE: Represents a subtitle stream used for displaying text or subtitle information, such as SRT, ASS, etc.
MEDIA_TYPE_ATTACHMENT: Represents attachment streams that are usually sparse. Attachment streams can include images, fonts, or other files that need to be bundled with the media.
MEDIA_TYPE_NB: Represents the number of media types (count) and indicates the total number of media types defined in this enumeration. It is not a media type itself but is used for counting enumeration items.

C++ defination code:

enum MediaType
    {
        MEDIA_TYPE_UNKNOWN = -1,    // Represents an unknown media type, which is usually treated as AVMEDIA_TYPE_DATA.
        MEDIA_TYPE_VIDEO,           // Represents a video stream, such as video content encoded in H.264, MPEG-4, etc.
        MEDIA_TYPE_AUDIO,           // Represents an audio stream, such as audio content encoded in AAC, MP3, etc.
        MEDIA_TYPE_DATA,            // Represents opaque data streams that are usually continuous. This type of stream is not necessarily audio or video and may be used for other data purposes.
        MEDIA_TYPE_SUBTITLE,        // Represents a subtitle stream used for displaying text or subtitle information, such as SRT, ASS, etc.
        MEDIA_TYPE_ATTACHMENT,      // Represents attachment streams that are usually sparse. Attachment streams can include images, fonts, or other files that need to be bundled with the media.
        MEDIA_TYPE_NB               // Represents the number of media types (count) and indicates the total number of media types defined in this enumeration. It is not a media type itself but is used for counting enumeration items.
    }

Variable

Function

timebase_to_us

Convert a value in timebase units to microseconds. value * 1000000 / (timebase[1] / timebase[0])

item description
param timebse: Time base, used as the unit for calculating playback time. It must be an array containing two parameters,
in the format [num, den], where the first parameter is the numerator of the time base, and the second parameter is the denominator of the time base.
value: Input value
return Return the result in microseconds.

C++ defination code:

double timebase_to_us(std::vector<int> timebase, uint64_t value)

timebase_to_ms

Convert a value in timebase units to milliseconds.

item description
param timebse: Time base, used as the unit for calculating playback time. It must be an array containing two parameters,
in the format [num, den], where the first parameter is the numerator of the time base, and the second parameter is the denominator of the time base.
value: Input value
return Return the result in milliseconds.

C++ defination code:

double timebase_to_ms(std::vector<int> timebase, uint64_t value)

Class

Context

Context class

C++ defination code:

class Context

Context

Construct a new Context object

item description
type func
param media_type: enable capture, if true, you can use capture() function to get an image object
timebase: Time base, used as the unit for calculating playback time. It must be an array containing two parameters,
in the format [num, den], where the first parameter is the numerator of the time base, and the second parameter is the denominator of the time base.
static False

C++ defination code:

Context(video::MediaType media_type, std::vector<int> timebase)

Context (overload 1)

Construct a new Context object

item description
type func
param media_type: enable capture, if true, you can use capture() function to get an image object
timebase: Time base, used as the unit for calculating playback time. It must be an array containing two parameters,
in the format [num, den], where the first parameter is the numerator of the time base, and the second parameter is the denominator of the time base.
sample_rate: sampling rate of audio
format: audio format
channels: number of audio channels
static False

C++ defination code:

Context(video::MediaType media_type, std::vector<int> timebase, int sample_rate, audio::Format format, int channels)

audio_sample_rate

Get sample rate of audio (only valid in the context of audio)

item description
type func
return sample rate
static False

C++ defination code:

int audio_sample_rate()

audio_sample_rate (overload 1)

Get sample rate of audio (only valid in the context of audio)

item description
type func
return sample rate
static False

C++ defination code:

int audio_sample_rate()

audio_channels

Get channels of audio (only valid in the context of audio)

item description
type func
return channels
static False

C++ defination code:

int audio_channels()

audio_channels (overload 1)

Get channels of audio (only valid in the context of audio)

item description
type func
return channels
static False

C++ defination code:

int audio_channels()

audio_format

Get format of audio (only valid in the context of audio)

item description
type func
return audio format. @see audio::Format
static False

C++ defination code:

audio::Format audio_format()

audio_format (overload 1)

Get format of audio (only valid in the context of audio)

item description
type func
return audio format. @see audio::Format
static False

C++ defination code:

audio::Format audio_format()

set_pcm

Set pcm data (only valid in the context of audio)

item description
type func
param duration: Duration of the current pcm. unit: timebase
pts: The start time of this pcm playback. If it is 0, it means this parameter is not supported. unit: timebase
return err::Err
static False

C++ defination code:

err::Err set_pcm(maix::Bytes *data, int duration = 0, uint64_t pts = 0, bool copy = true)

get_pcm

Get pcm data (only valid in the context of audio)

item description
type func
attention Note that if you call this interface, you are responsible for releasing the memory of the data, and this interface cannot be called again.
return Bytes
static False

C++ defination code:

Bytes *get_pcm()

set_image

Set image info

item description
type func
param image: image data
duration: Duration of the current image. unit: timebase
pts: The start time of this image playback. If it is 0, it means this parameter is not supported. unit: timebase
last_pts: The start time of the previous image playback. It can be used to ensure the playback order. If it is 0, it means this parameter is not supported. unit: timebase
static False

C++ defination code:

void set_image(image::Image *image, int duration = 0, uint64_t pts = 0, uint64_t last_pts = 0)

set_raw_data

Set private data

item description
type func
param data: private raw data
data_size: private raw data size
duration: Duration of the current image. unit: timebase
pts: The start time of this image playback. If it is 0, it means this parameter is not supported. unit: timebase
last_pts: The start time of the previous image playback. It can be used to ensure the playback order. If it is 0, it means this parameter is not supported. unit: timebase
static False

C++ defination code:

void set_raw_data(void *data, size_t data_size, int duration = 0, uint64_t pts = 0, uint64_t last_pts = 0, bool copy = false)

get_raw_data

Get private data

item description
type func
static False

C++ defination code:

void *get_raw_data()

image

Retrieve the image data to be played.

item description
type func
attention Note that if you call this interface, you are responsible for releasing the memory of the image, and this interface cannot be called again.
static False

C++ defination code:

image::Image *image()

media_type

Get the media type to determine whether it is video, audio, or another media type.

item description
type func
static False

C++ defination code:

video::MediaType media_type()

pts

Get the start time of the current playback., in units of time base.

item description
type func
static False

C++ defination code:

uint64_t pts()

last_pts

Get the start time of the previous playback, in units of time base.

item description
type func
static False

C++ defination code:

uint64_t last_pts()

timebase

Get the time base.

item description
type func
static False

C++ defination code:

std::vector<int> timebase()

duration

Duration of the current frame. unit: timebase

item description
type func
static False

C++ defination code:

int duration()

duration_us

Duration of the current frame. unit: us

item description
type func
static False

C++ defination code:

uint64_t duration_us()

Frame

Frame class

C++ defination code:

class Frame

Frame

Frame object

item description
type func
param data: src data pointer, use pointers directly without copying.
Note: this object will try to free this memory
len: data len
pts: presentation time stamp. unit: time_base
dts: decoding time stamp. unit: time_base
duration: packet display time. unit: time_base (not used)
auto_detele: if true, will delete data when destruct. When copy is true, this arg will be ignore.
copy: data will be copy to new buffer if true, if false, will use data directly,
default true to ensure memory safety.
static False

C++ defination code:

Frame(uint8_t *data, int len, uint64_t pts = -1, uint64_t dts = -1, int64_t duration = 0, bool auto_detele = false, bool copy = false)

Frame (overload 1)

Frame number (pair of numerator and denominator).

item description
type func
static False

C++ defination code:

Frame()

get

Get raw data of packet

item description
type func
param data: data pointer
len: data length pointer
return raw data
static False

C++ defination code:

err::Err get(void **data, int *len)

to_bytes

Get raw data of packet

item description
type func
param copy: if true, will alloc memory and copy data to new buffer
return raw data
static False

C++ defination code:

Bytes *to_bytes(bool copy = false)

size

Get raw data size of packet

item description
type func
return size of raw data
static False

C++ defination code:

size_t size()

is_valid

Check packet is valid

item description
type func
return true, packet is valid; false, packet is invalid
static False

C++ defination code:

bool is_valid()

set_pts

Set pts

item description
type func
param pts: presentation time stamp. unit: time_base
static False

C++ defination code:

void set_pts(uint64_t pts)

set_dts

Set dts

item description
type func
param dts: decoding time stamp. unit: time_base
static False

C++ defination code:

void set_dts(uint64_t dts)

set_duration

Set duration

item description
type func
param duration: packet display time. unit: time_base
static False

C++ defination code:

void set_duration(uint64_t duration)

get_pts

Set pts

item description
type func
param pts: presentation time stamp. unit: time_base
return pts value
static False

C++ defination code:

uint64_t get_pts()

get_dts

Set dts

item description
type func
param dts: decoding time stamp. unit: time_base
return dts value
static False

C++ defination code:

uint64_t get_dts()

get_duration

Get duration

item description
type func
return duration value
static False

C++ defination code:

uint64_t get_duration()

type

Get frame type

item description
type func
return video type. @see video::VideoType
static False

C++ defination code:

video::VideoType type()

Packet

Packet class

C++ defination code:

class Packet

Packet

Packet number (pair of numerator and denominator).

item description
type func
param data: src data pointer, use pointers directly without copying.
Note: this object will try to free this memory
len: data len
pts: presentation time stamp. unit: time_base
dts: decoding time stamp. unit: time_base
duration: packet display time. unit: time_base
static False

C++ defination code:

Packet(uint8_t *data, int len, uint64_t pts = -1, uint64_t dts = -1, int64_t duration = 0)

Packet (overload 1)

Packet number (pair of numerator and denominator).

item description
type func
static False

C++ defination code:

Packet()

get

Get raw data of packet

item description
type func
return raw data
static False

C++ defination code:

std::vector<uint8_t> get()

data

Get raw data of packet

item description
type func
return raw data
static False

C++ defination code:

uint8_t *data()

data_size

Get raw data size of packet

item description
type func
return size of raw data
static False

C++ defination code:

size_t data_size()

is_valid

Check packet is valid

item description
type func
return true, packet is valid; false, packet is invalid
static False

C++ defination code:

bool is_valid()

set_pts

Set pts

item description
type func
param pts: presentation time stamp. unit: time_base
return true, packet is valid; false, packet is invalid
static False

C++ defination code:

void set_pts(uint64_t pts)

set_dts

Set dts

item description
type func
param dts: decoding time stamp. unit: time_base
return true, packet is valid; false, packet is invalid
static False

C++ defination code:

void set_dts(uint64_t dts)

set_duration

Set duration

item description
type func
param duration: packet display time. unit: time_base
return true, packet is valid; false, packet is invalid
static False

C++ defination code:

void set_duration(uint64_t duration)

Encoder

Encode class

C++ defination code:

class Encoder

Encoder

Construct a new Video object

item description
type func
param width: picture width. this value may be set automatically. default is 2560.
height: picture height. this value may be set automatically. default is 1440.
format: picture format. default is image::Format::FMT_YVU420SP. @see image::Format
type: video encode/decode type. default is ENC_H265_CBR. @see EncodeType
framerate: frame rate. framerate default is 30, means 30 frames per second
for video. 1/time_base is not the average frame rate if the frame rate is not constant.
gop: for h264/h265 encoding, the interval between two I-frames, default is 50.
bitrate: for h264/h265 encoding, used to limit the bandwidth used by compressed data, default is 3000kbps
time_base: frame time base. time_base default is 1000, means 1/1000 ms (not used)
capture: enable capture, if true, you can use capture() function to get an image object
block: This parameter determines whether encoding should block until it is complete.
If set to true, it will wait until encoding is finished before returning.
If set to false, it will return the current encoding result on the next call.
static False

C++ defination code:

Encoder(std::string path = "", int width = 2560, int height = 1440, image::Format format = image::Format::FMT_YVU420SP, video::VideoType type = video::VideoType::VIDEO_H264, int framerate = 30, int gop = 50, int bitrate = 3000 * 1000, int time_base = 1000, bool capture = false, bool block = true)

bind_camera

Bind camera

item description
type func
param camera: camera object
return error code, err::ERR_NONE means success, others means failed
static False

C++ defination code:

err::Err bind_camera(camera::Camera *camera)

encode

Encode image.

item description
type func
param img: the image will be encode.
if the img is NULL, this function will try to get image from camera, you must use bind_camera() function to bind the camera.
pcm: the pcm data will be encode.
return encode result
static False

C++ defination code:

video::Frame *encode(image::Image *img = maix::video::Encoder::NoneImage, Bytes *pcm = maix::video::Encoder::NoneBytes)

capture

Capture image

item description
type func
attention Each time encode is called, the last captured image will be released.
return error code
static False

C++ defination code:

image::Image *capture()

width

Get video width

item description
type func
return video width
static False

C++ defination code:

int width()

height

Get video height

item description
type func
return video height
static False

C++ defination code:

int height()

format

Get video format

item description
type func
return video format
static False

C++ defination code:

image::Format format()

type

Get video encode type

item description
type func
return VideoType
static False

C++ defination code:

video::VideoType type()

framerate

Get video encode framerate

item description
type func
return frame rate
static False

C++ defination code:

int framerate()

gop

Get video encode gop

item description
type func
return gop value
static False

C++ defination code:

int gop()

bitrate

Get video encode bitrate

item description
type func
return bitrate value
static False

C++ defination code:

int bitrate()

time_base

Get video encode time base

item description
type func
return time base value
static False

C++ defination code:

int time_base()

get_pts

Get current pts, unit: time_base\nNote: The current default is to assume that there is no B-frame implementation, so pts and bts are always the same

item description
type func
param time_ms: start time from the first frame. unit: ms
return time base value
static False

C++ defination code:

uint64_t get_pts(uint64_t time_ms)

get_dts

Get current dts, unit: time_base\nNote: The current default is to assume that there is no B-frame implementation, so pts and bts are always the same

item description
type func
param time_ms: start time from the first frame. unit: ms
return time base value
static False

C++ defination code:

uint64_t get_dts(uint64_t time_ms)

Decoder

Decoder class

C++ defination code:

class Decoder

Decoder

Construct a new decoder object

item description
type func
param path: Path to the file to be decoded. Supports files with .264 and .mp4 extensions. Note that only mp4 files containing h.264 streams are supported.
format: Decoded output format, currently only support GRAYSCALE and YUV420SP
static False

C++ defination code:

Decoder(std::string path, image::Format format = image::Format::FMT_YVU420SP)

decode_video

Decode the video stream, returning the image of the next frame each time.

item description
type func
param block: Whether it blocks or not. If true, it will wait for the decoding to complete and return the current frame.
If false, it will return the result of the previous frame's decoding. If the previous frame's decoding result is empty,
it will return an unknown Context, and you can use the media_type method of the Context to determine if a valid result exists.
default is true.
return Decoded context information.
static False

C++ defination code:

video::Context * decode_video(bool block = true)

decode_audio

Decode the video stream, returning the image of the next frame each time.

item description
type func
return Decoded context information.
static False

C++ defination code:

video::Context * decode_audio()

decode

Decode the video and audio stream

item description
type func
param block: Whether it blocks or not. If true, it will wait for the decoding to complete and return the current frame.
If false, it will return the result of the previous frame's decoding. If the previous frame's decoding result is empty,
it will return an unknown Context, and you can use the media_type method of the Context to determine if a valid result exists.
default is true.
return Decoded context information.
static False

C++ defination code:

video::Context * decode(bool block = true)

unpack

Unpacking the video and audio stream

item description
type func
return Unpacking context information.
static False

C++ defination code:

video::Context * unpack()

width

Get the video width

item description
type func
return video width
static False

C++ defination code:

int width()

height

Get the video height

item description
type func
return video height
static False

C++ defination code:

int height()

bitrate

Get the video bitrate

item description
type func
return bitrate value
static False

C++ defination code:

int bitrate()

fps

Get the video fps

item description
type func
return fps value
static False

C++ defination code:

int fps()

seek

Seek to the required playback position

item description
type func
param time: timestamp value, unit: s
return return the current position, unit: s
static False

C++ defination code:

double seek(double time = -1)

duration

Get the maximum duration of the video. If it returns 0, it means it cannot be predicted.

item description
type func
return duration value, unit: s
static False

C++ defination code:

double duration()

timebase

Get the time base.

item description
type func
static False

C++ defination code:

std::vector<int> timebase()

has_audio

If find audio data, return true

item description
type func
static False

C++ defination code:

bool has_audio()

has_video

If find video data, return true

item description
type func
static False

C++ defination code:

bool has_video()

Video

Video class

C++ defination code:

class Video

Video

Construct a new Video object

item description
type func
param path: video path. the path determines the location where you load or save the file, if path is none, the video module will not save or load file.
xxx.h265 means video format is H265, xxx.mp4 means video format is MP4
width: picture width. this value may be set automatically. default is 2560.
height: picture height. this value may be set automatically. default is 1440.
format: picture pixel format. this value may be set automatically. default is FMT_YVU420SP.
time_base: frame time base. time_base default is 30, means 1/30 ms
framerate: frame rate. framerate default is 30, means 30 frames per second
for video. 1/time_base is not the average frame rate if the frame rate is not constant.
capture: enable capture, if true, you can use capture() function to get an image object
open: If true, video will automatically call open() after creation. default is true.
static False

C++ defination code:

Video(std::string path = std::string(), int width = 2560, int height = 1440, image::Format format = image::Format::FMT_YVU420SP, int time_base = 30, int framerate = 30, bool capture = false, bool open = true)

open

Open video and run

item description
type func
param path: video path. the path determines the location where you load or save the file, if path is none, the video module will not save or load file.
xxx.h265 means video format is H265, xxx.mp4 means video format is MP4
fps: video fps
return error code, err::ERR_NONE means success, others means failed
static False

C++ defination code:

err::Err open(std::string path = std::string(), double fps = 30.0)

close

Close video

item description
type func
static False

C++ defination code:

void close()

bind_camera

Bind camera

item description
type func
param camera: camera object
return error code, err::ERR_NONE means success, others means failed
static False

C++ defination code:

err::Err bind_camera(camera::Camera *camera)

encode

Encode image.

item description
type func
param img: the image will be encode.
if the img is NULL, this function will try to get image from camera, you must use bind_camera() function to bind the camera.
return encode result
static False

C++ defination code:

video::Packet *encode(image::Image *img = maix::video::Video::NoneImage)

decode

Decode frame

item description
type func
param frame: the frame will be decode
return decode result
static False

C++ defination code:

image::Image *decode(video::Frame *frame = nullptr)

finish

Encode or decode finish

item description
type func
return error code
static False

C++ defination code:

err::Err finish()

capture

Capture image

item description
type func
attention Each time encode is called, the last captured image will be released.
return error code
static False

C++ defination code:

image::Image *capture()

is_recording

Check if video is recording

item description
type func
return true if video is recording, false if not
static False

C++ defination code:

bool is_recording()

is_opened

Check if video is opened

item description
type func
return true if video is opened, false if not
static False

C++ defination code:

bool is_opened()

is_closed

check video device is closed or not

item description
type func
return closed or not, bool type
static False

C++ defination code:

bool is_closed()

width

Get video width

item description
type func
return video width
static False

C++ defination code:

int width()

height

Get video height

item description
type func
return video height
static False

C++ defination code:

int height()

VideoRecorder

Video Recorder class. This module is not fully supported and may be deprecated in the future.

C++ defination code:

class VideoRecorder

VideoRecorder

Construct a new VideoRecorder object. This is an object that integrates recording, video capturing, and display functions, which can be used to achieve high-resolution video input when needed.

item description
type func
param open: If true, video will automatically call open() after creation. default is true.
static False

C++ defination code:

VideoRecorder(bool open = true)

lock

lock video

item description
type func
param timeout: timeout in ms. unit:ms
return error code
static False

C++ defination code:

err::Err lock(int64_t timeout = -1)

unlock

unlock video

item description
type func
return error code
static False

C++ defination code:

err::Err unlock()

open

Start a thread to handle the input function.

item description
type func
return error code
static False

C++ defination code:

err::Err open()

close

Stop the thread, and reset the object.

item description
type func
return error code
static False

C++ defination code:

err::Err close()

is_opened

Check whether the object is opened.

item description
type func
static False

C++ defination code:

bool is_opened()

bind_display

Bind a Display object. if this object is not bound, it will not be displayed.

item description
type func
param display: display object
fit: fit mode. It is recommended to fill in FIT_COVER or FIT_FILL. For maixcam, using FIT_CONTAIN may affect the
functionality of the second layer created by add_channel() in the Display. default is FIT_COVER.
return error code
static False

C++ defination code:

err::Err bind_display(display::Display *display, image::Fit fit = image::FIT_COVER)

bind_camera

Bind a Camera object. if this object is not bound, images cannot be captured.

item description
type func
param camera: camera object
return error code
static False

C++ defination code:

err::Err bind_camera(camera::Camera *camera)

bind_audio

Bind a AudioRecorder object. if this object is not bound, audio cannot be captured.

item description
type func
param audio: audio recorder object
return error code
static False

C++ defination code:

err::Err bind_audio(audio::Recorder *audio)

bind_imu

Bind a IMU object. if this object is not bound, imu data cannot be captured.

item description
type func
param imu: imu object
return error code
static False

C++ defination code:

err::Err bind_imu(void *imu)

reset

Reset the video recorder.

item description
type func
note It will not reset the bound object; if you have already bound the display using bind_display(), there is no need to rebind the display after calling reset().
return error code
static False

C++ defination code:

err::Err reset()

config_path

The recorded video will be saved to this path, and this API cannot be called during runtime.

item description
type func
param path: The path of the video file to be saved
return error code
static False

C++ defination code:

err::Err config_path(std::string path)

get_path

Get the path of the video file to be saved

item description
type func
return path
static False

C++ defination code:

std::string get_path()

config_snapshot

Set the snapshot parameters

item description
type func
note Enabling snapshot functionality may result in some performance loss.
param enable: enable or disable snapshot
resolution: image resolution of snapshot
format: image format of snapshot
return error code
static False

C++ defination code:

err::Err config_snapshot(bool enable, std::vector<int> resolution = std::vector<int>(), image::Format format = image::Format::FMT_YVU420SP)

config_resolution

Set the resolution of the video, and this API cannot be called during runtime.

item description
type func
note You must bind the camera first, and this interface will modify the camera's resolution. The width must be divisible by 32.
param resolution: The resolution of the video
return error code
static False

C++ defination code:

err::Err config_resolution(std::vector<int> resolution)

get_resolution

Get the resolution of the video

item description
type func
return the resolution of the video
static False

C++ defination code:

std::vector<int> get_resolution()

config_fps

Set the fps of the video, and this API cannot be called during runtime.

item description
type func
note This interface only affect the fps of the encoded file.
return error code
static False

C++ defination code:

err::Err config_fps(int fps)

get_fps

Get the fps of the video.

item description
type func
return fps value
static False

C++ defination code:

int get_fps()

config_bitrate

Set the bitrate of the video, and this API cannot be called during runtime.

item description
type func
return error code
static False

C++ defination code:

err::Err config_bitrate(int bitrate)

get_bitrate

Get the bitrate of the video.

item description
type func
return bitrate value
static False

C++ defination code:

int get_bitrate()

mute

Set/Get the mute of the video

item description
type func
param data: If the parameter is true, mute; if false, unmute; if no parameter is provided, return the mute status.
return error code
static False

C++ defination code:

int mute(int data = -1)

volume

Set/Get the volume of the video

item description
type func
param data: The volume of the video, the range is 0-100. if no parameter is provided, return the volume.
return error code
static False

C++ defination code:

int volume(int data = -1)

seek

Get the current position of the video

item description
type func
return current position, unit: ms
static False

C++ defination code:

int64_t seek()

record_start

Start recording

item description
type func
note You must bind the camera at a minimum during input. Additionally,
if you bind a display, the input image will be shown,
if you bind a audio, audio will be recorded,
if you bind a IMU, IMU data will be logged.
return error code
static False

C++ defination code:

err::Err record_start()

snapshot

Take a snapshot

item description
type func
return image::Image
static False

C++ defination code:

image::Image *snapshot()

record_finish

Stop recording and save the video

item description
type func
return error code
static False

C++ defination code:

err::Err record_finish()

draw_rect

Draw a rect on the video

item description
type func
param id: id of the rect, range is [0, 15]
x: x coordinate
y: y coordinate
w: width
h: height
color: color
tickness: The line width of the rectangular box; if set to -1, it indicates that the rectangular box will be filled.
hidden: Hide or show the rectangular box
return error code
static False

C++ defination code:

err::Err draw_rect(int id, int x, int y, int w, int h, image::Color color = image::COLOR_WHITE, int thickness = -1, bool hidden = false)