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
Frame
item | doc |
---|---|
brief | Frame class |
C++ defination code:
class Frame
Packet
item | doc |
---|---|
brief | Packet class |
C++ defination code:
class Packet
__init__
item | doc |
---|---|
type | func |
brief | Packet number (pair of numerator and denominator). |
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)
get
item | doc |
---|---|
type | func |
brief | Get raw data of packet |
return | raw data |
static | False |
C++ defination code:
std::vector<uint8_t> get()
data
item | doc |
---|---|
type | func |
brief | Get raw data of packet |
return | raw data |
static | False |
C++ defination code:
uint8_t *data()
data_size
item | doc |
---|---|
type | func |
brief | Get raw data size of packet |
return | size of raw data |
static | False |
C++ defination code:
size_t data_size()
is_valid
item | doc |
---|---|
type | func |
brief | Check packet is valid |
return | true, packet is valid; false, packet is invalid |
static | False |
C++ defination code:
bool is_valid()
set_pts
item | doc |
---|---|
type | func |
brief | Set pts |
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
item | doc |
---|---|
type | func |
brief | Set dts |
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
item | doc |
---|---|
type | func |
brief | Set duration |
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)
Video
item | doc |
---|---|
brief | Video class |
C++ defination code:
class Video
__init__
def __init__(self, path: str = '', width: int = 2560, height: int = 1440, format: maix.image.Format = ..., time_base: int = 30, framerate: int = 30, capture: bool = False, open: bool = True) -> None
item | doc |
---|---|
type | func |
brief | Construct a new Video object |
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
def open(self, path: str = '', fps: float = 30.0) -> maix.err.Err
item | doc |
---|---|
type | func |
brief | Open video and run |
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
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)
encode
def encode(self, img: maix.image.Image = ...) -> Packet
item | doc |
---|---|
type | func |
brief | Encode image. |
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
def decode(self, frame: Frame = None) -> maix.image.Image
item | doc |
---|---|
type | func |
brief | Decode frame |
param | frame: the frame will be decode |
return | decode result |
static | False |
C++ defination code:
image::Image *decode(video::Frame *frame = nullptr)
finish
def finish(self) -> maix.err.Err
item | doc |
---|---|
type | func |
brief | Encode or decode finish |
return | error code |
static | False |
C++ defination code:
err::Err finish()
capture
def capture(self) -> maix.image.Image
item | doc |
---|---|
type | func |
brief | Capture image |
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
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()