maix.video

maix.video module

You can use maix.video to access this module with MaixPy
This module is generated from MaixCDK

Module

No module

Enum

VideoType

item doc
brief Video type
values VIDEO_NONE: format invalid
VIDEO_ENC_H265_CBR:
VIDEO_ENC_MP4_CBR:
VIDEO_DEC_H265_CBR:
VIDEO_DEC_MP4_CBR:

C++ defination code:

enum VideoType
    {
        VIDEO_NONE = 0,  // format invalid
        VIDEO_ENC_H265_CBR,
        VIDEO_ENC_MP4_CBR,
        VIDEO_DEC_H265_CBR,
        VIDEO_DEC_MP4_CBR,
    }

Variable

Function

Class

VideoStream

item doc
brief VideoStream class

C++ defination code:

class VideoStream

Encode

item doc
brief Encode class

C++ defination code:

class Encode

Decode

item doc
brief Decode class

C++ defination code:

class Decode

Video

item doc
brief Video class

C++ defination code:

class Video

__init__

def __init__(self, path: str = '', record: bool = False, interval: int = 33333, width: int = -1, height: int = -1, audio: bool = False, sample_rate: int = 44100, channel: int = 1, open: bool = True) -> None
item doc
type func
brief Construct a new Video object
param path: video path. if record is true, xxx.h265 means video format is H265, xxx.mp4 means video format is MP4
record: If record is true, means record vide. if record is false means play video, default is false.
interval: record interval. unit: us
width: video width, default is -1, means auto, mostly means max width of video support
height: video height, default is -1, means auto, mostly means max height of video support
audio: If audio is true, means record with audio. default is false.
sample_rate: audio sample rate, default is 44100.
channel: audio channel, default is 1.
open: If true, vido will automatically call open() after creation. default is true.
static False

C++ defination code:

Video(std::string path = std::string(), bool record = false, int interval = 33333, int width = -1, int height = -1, bool audio = false, int sample_rate = 44100, int channel = 1, bool open = true)

open

def open(self, path: str = '', record: bool = False, interval: int = 33333, width: int = -1, height: int = -1, audio: bool = False, sample_rate: int = 44100, channel: int = 1) -> maix.err.Err
item doc
type func
brief Open video and run
param path: video path. if record is true, xxx.h265 means video format is H265, xxx.mp4 means video format is MP4
record: If record is true, means record vide. if record is false means play video, default is false.
interval: record interval. unit: us
width: video width, default is -1, means auto, mostly means max width of video support
height: video height, default is -1, means auto, mostly means max height of video support
audio: If audio is true, means record with audio. default is false.
sample_rate: audio sample rate, default is 44100.
channel: audio channel, default is 1.
return error code, err::ERR_NONE means success, others means failed
static False

C++ defination code:

err::Err open(std::string path = std::string(), bool record = false, int interval = 33333, int width = -1, int height = -1, bool audio = false, int sample_rate = 44100, int channel = 1)

close

def close(self) -> None
item doc
type func
brief Close video
static False

C++ defination code:

void close()

bind_camera

def bind_camera(self, camera: maix.camera.Camera) -> maix.err.Err
item doc
type func
brief Bind camera
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)

record_start

def record_start(self, record_time: int = -1) -> maix.err.Err
item doc
type func
brief start record video
param record_time: record video time, unit: ms.
If record_time = -1, mean record will not auto stop until record_finish() is called.
return error code, err::ERR_NONE means success, others means failed
static False

C++ defination code:

err::Err record_start(uint64_t record_time = -1)

record_finish

def record_finish(self) -> maix.err.Err
item doc
type func
brief stop record video
return error code, err::ERR_NONE means success, others means failed
static False

C++ defination code:

err::Err record_finish()

capture

def capture(self) -> maix.image.Image
item doc
type func
brief stop record video
return error code, err::ERR_NONE means success, others means failed
static False

C++ defination code:

image::Image *capture()

encode

def encode(self, img: maix.image.Image) -> VideoStream
item doc
type func
brief Encode image
param img: the image will be encode
return encode result
static False

C++ defination code:

video::VideoStream encode(image::Image &img)

decode

def decode(self, stream: VideoStream) -> maix.image.Image
item doc
type func
brief Decode image
param img: the image will be decode
return decode result
static False

C++ defination code:

image::Image *decode(video::VideoStream &stream)

is_recording

def is_recording(self) -> bool
item doc
type func
brief Check if video is recording
return true if video is recording, false if not
static False

C++ defination code:

bool is_recording()

is_opened

def is_opened(self) -> bool
item doc
type func
brief Check if video is opened
return true if video is opened, false if not
static False

C++ defination code:

bool is_opened()

is_closed

def is_closed(self) -> bool
item doc
type func
brief check video device is closed or not
return closed or not, bool type
static False

C++ defination code:

bool is_closed()

width

def width(self) -> int
item doc
type func
brief Get video width
return video width
static False

C++ defination code:

int width()

height

def height(self) -> int
item doc
type func
brief Get video height
return video height
static False

C++ defination code:

int height()