maix.rtsp

maix.rtsp module

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

Module

No module

Enum

RtspStreamType

The stream type of rtsp

item describe
values RTSP_STREAM_NONE: format invalid
RTSP_STREAM_H264:
RTSP_STREAM_H265:

C++ defination code:

enum RtspStreamType
    {
        RTSP_STREAM_NONE = 0,  // format invalid
        RTSP_STREAM_H264,
        RTSP_STREAM_H265,
    }

Variable

Function

Class

Region

Region class

C++ defination code:

class Region

__init__

def __init__(self, x: int, y: int, width: int, height: int, format: maix.image.Format, camera: maix.camera.Camera) -> None

Construct a new Region object

item description
type func
param x: region coordinate x
y: region coordinate y
width: region width
height: region height
format: region format
camera: bind region to camera
static False

C++ defination code:

Region(int x, int y, int width, int height, image::Format format, camera::Camera *camera)

get_canvas

def get_canvas(self) -> maix.image.Image

Return an image object from region

item description
type func
return image object
static False

C++ defination code:

image::Image *get_canvas()

update_canvas

def update_canvas(self) -> maix.err.Err

Update canvas

item description
type func
return error code
static False

C++ defination code:

err::Err update_canvas()

Rtsp

Rtsp class

C++ defination code:

class Rtsp

__init__

def __init__(self, ip: str = '', port: int = 8554, fps: int = 30, stream_type: RtspStreamType = ..., bitrate: int = 3000000) -> None

Construct a new Video object

item description
type func
param ip: rtsp ip
port: rtsp port
fps: rtsp fps
stream_type: rtsp stream type
bitrate: rtsp bitrate
static False

C++ defination code:

Rtsp(std::string ip = std::string(), int port = 8554, int fps = 30, rtsp::RtspStreamType stream_type = rtsp::RtspStreamType::RTSP_STREAM_H264, int bitrate = 3000 * 1000)

start

def start(self) -> maix.err.Err

start rtsp

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

C++ defination code:

err::Err start()

start (overload 1)

stop rtsp

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

C++ defination code:

err::Err stop()

bind_camera

def bind_camera(self, camera: maix.camera.Camera) -> maix.err.Err

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)

bind_audio_recorder

def bind_audio_recorder(self, recorder: maix.audio.Recorder) -> maix.err.Err

Bind audio recorder

item description
type func
note If the audio_recorder object is bound, the audio_recorder object cannot be used elsewhere.
param recorder: audio_recorder object
return error code, err::ERR_NONE means success, others means failed
static False

C++ defination code:

err::Err bind_audio_recorder(audio::Recorder *recorder)

write

def write(self, frame: ...) -> maix.err.Err

Write data to rtsp(This function will be removed in the future)

item description
type func
param frame: video frame data
return error code, err::ERR_NONE means success, others means failed
static False

C++ defination code:

err::Err write(video::Frame &frame)

get_url

def get_url(self) -> str

Get url of rtsp

item description
type func
return url of rtsp
static False

C++ defination code:

std::string get_url()

get_urls

def get_urls(self) -> list[str]

Get url list of rtsp

item description
type func
return url list of rtsp
static False

C++ defination code:

std::vector<std::string> get_urls()

to_camera

def to_camera(self) -> maix.camera.Camera

Get camera object from rtsp

item description
type func
return camera object
static False

C++ defination code:

camera::Camera *to_camera()

add_region

def add_region(self, x: int, y: int, width: int, height: int, format: maix.image.Format = ...) -> Region

return a region object, you can draw image on the region.(This function will be removed in the future)

item description
type func
param x: region coordinate x
y: region coordinate y
width: region width
height: region height
format: region format, support Format::FMT_BGRA8888 only
return the reigon object
static False

C++ defination code:

rtsp::Region *add_region(int x, int y, int width, int height, image::Format format = image::Format::FMT_BGRA8888)

update_region

def update_region(self, region: Region) -> maix.err.Err

update and show region(This function will be removed in the future)

item description
type func
return error code
static False

C++ defination code:

err::Err update_region(rtsp::Region &region)

del_region

def del_region(self, region: Region) -> maix.err.Err

del region(This function will be removed in the future)

item description
type func
return error code
static False

C++ defination code:

err::Err del_region(rtsp::Region *region)

draw_rect

def draw_rect(self, id: int, x: int, y: int, width: int, height: int, color: maix.image.Color, thickness: int = 1) -> maix.err.Err

Draw a rectangle on the canvas(This function will be removed in the future)

item description
type func
param id: region id
x: rectangle coordinate x
y: rectangle coordinate y
width: rectangle width
height: rectangle height
color: rectangle color
thickness: rectangle thickness. If you set it to -1, the rectangle will be filled.
return error code
static False

C++ defination code:

err::Err draw_rect(int id, int x, int y, int width, int height, image::Color color, int thickness = 1)

draw_string

def draw_string(self, id: int, x: int, y: int, str: str, color: maix.image.Color, size: int = 16, thickness: int = 1) -> maix.err.Err

Draw a string on the canvas(This function will be removed in the future)

item description
type func
param id: region id
x: string coordinate x
y: string coordinate y
str: string
color: string color
size: string size
thickness: string thickness
return error code
static False

C++ defination code:

err::Err draw_string(int id, int x, int y, const char *str, image::Color color, int size = 16, int thickness = 1)