Files
autopilot/misc/rtsp_ai_player/README.md
T
2024-07-14 19:54:46 +02:00

43 lines
1.2 KiB
Markdown

# 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 ONNX format.
## How to convert PT file to ONNX format
```bash
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 ffmpeg and mediamtx RTSP server:
```bash
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
tar xf -C mediamtx mediamtx_v1.8.4_linux_amd64.tar.gz
```
### Launch mediamtx RTSP server:
```bash
cd mediamtx
./mediamtx
```
### Play mp4 video file from RTSP server:
```bash
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:
```bash
ffplay -rtsp_transport tcp rtsp://localhost:8554/live.stream
```
### Compile and run rtsp_ai_player:
```bash
cd autopilot/misc/rtsp_ai_player
qmake6 && make
./rtsp_ai_player ~/azaion/models/azaion/azaion-2024-06-28.onnx
```