MaixCAM MaixPy Video Streaming RTSP Push Streaming
2024-05-20
Update history
Date | Version | Author | Update content |
---|---|---|---|
2024-05-20 | 1.0.0 | lxowalle | Initial documentation |
Introduction
This document provides methods for pushing streaming camera image via RTSP
How to use
from maix import time, rtsp, camera, image
server = rtsp.Rtsp()
cam = camera.Camera(2560, 1440, image.Format.FMT_YVU420SP)
server.bind_camera(cam)
server.start()
print(server.get_url())
while True:
time.sleep(1)
Steps:
Import the image、camera、image and rtsp modules:
from maix import time, rtsp, camera, image
Initialize the camera:
cam = camera.Camera(2560, 1440, image.Format.FMT_YVU420SP) # Initialise camera, output resolution 2560x1440 NV21 format
- Note that the RTSP module currently only supports the NV21 format, so the camera needs to be configured to output in NV21 format.
Initialise and start the Rtsp object
server = rtsp.Rtsp() server.bind_camera(cam) server.start()
server = rtsp.Rtsp()
used to create anRtsp
objectserver.bind_camera(cam)
is used to bind aCamera
object, after which the originalCamera
object can no longer be used.server.start()
is used to start thertsp
push stream.
Print the URL of the current RTSP stream
python print(server.get_url())
server.get_url()
is used to get theplayback address
ofRTSP
.
Finished, after running the above code, you can play the video stream through VLC software, the tested version of
VLC
is3.0.20
. The default playback address isrtsp://device ip:8554/live
.
OSD
Drawing lines and frames via OSD
TODO