mirror of
https://github.com/azaion/autopilot.git
synced 2026-04-22 22:26:35 +00:00
1.4 KiB
1.4 KiB
rtsp_ai_player
rtsp_ai_player is an application that listens to an RTSP stream, analyzes images with an AI model, and shows the results visually. It also controls a gimbal camera to zoom in on the recognized objects. Application uses YOLOv8 AI models converted to the ONNX format.
How to convert PT file to ONNX format
yolo export model=azaion-2024-06-28.pt dynamic=False format=onnx imgsz=640,640
How to use application locally on a Linux PC.
Install ONNX runtime
wget https://github.com/microsoft/onnxruntime/releases/download/v1.18.0/onnxruntime-linux-x64-1.18.0.tgz
sudo tar xf onnxruntime-linux-x64-1.18.0.tgz -C /opt
Install ffmpeg and mediamtx RTSP server:
sudo apt update
sudo apt install ffmpeg
wget https://github.com/bluenviron/mediamtx/releases/download/v1.8.4/mediamtx_v1.8.4_linux_amd64.tar.gz
mkdir mediamtx
tar xf mediamtx_v1.8.4_linux_amd64.tar.gz -C mediamtx
Launch mediamtx RTSP server:
cd mediamtx
./mediamtx
Play mp4 video file from RTSP server:
ffmpeg -re -stream_loop -1 -i $HOME/azaion/models/videos/for_ai_short.mp4 -c copy -f rtsp rtsp://localhost:8554/live.stream
Test RTSP streaming with ffplay:
ffplay -rtsp_transport tcp rtsp://localhost:8554/live.stream
Compile and run rtsp_ai_player:
cd autopilot/misc/rtsp_ai_player
qmake6 && make
./rtsp_ai_player ~/azaion/models/azaion/azaion-2024-06-28.onnx