# Decode and object detection using RTSP stream
Source: [https://docs.qualcomm.com/doc/80-70017-50/topic/rts-decode-ai-detection-yolo-v8-overlay-display.html](https://docs.qualcomm.com/doc/80-70017-50/topic/rts-decode-ai-detection-yolo-v8-overlay-display.html)
The **gst-rtspsrc-detection-display.py** script receives an RTSP stream as a
source, decodes it, uses [YOLOv8](https://github.com/ultralytics/ultralytics) LiteRT model to identify the object in a
scene from the camera stream and overlay the bounding boxes over the detected objects. The
results are shown on the display.
Figure : Pipeline for decode and object detection using RTSP stream – Preview

## Run the application
1. Ensure that you complete the [Prerequisites](https://docs.qualcomm.com/doc/80-70017-50/topic/python-sample-applications.html#python-sample-applications__section_gm5_s5j_bdc).
2. Run the object detection script on the target device:
1. Console 1
- 640×480
stream:
gst-launch-1.0 -e qtiqmmfsrc camera=0 ! v4l2h264enc capture-io-mode=5 output-io-mode=5 ! h264parse config-interval=1 ! qtirtspbinCopy to clipboard
- 1980×1080
stream:
gst-launch-1.0 -e qtiqmmfsrc camera=0 ! video/x-raw\(memory:GBM\),format=NV12,width=1920,height=1080,framerate=30/1,compression=ubwc ! v4l2h264enc capture-io-mode=5 output-io-mode=5 ! h264parse config-interval=1 ! qtirtspbinCopy to clipboard
2. Console
2:
python3 /usr/bin/gst-rtspsrc-detection-display.pyCopy to clipboard
Table : Default directories for model and label files for object
detection using RTSP stream
| Runtime | Models | Labels |
| :--- | :--- | :--- |
| LiteRT | /opt/data/YoloV8N_Detection_Quantized.tflite | /opt/data/yolov8n.labels |
To display the available help options, run the following command:
python3 gst-rtspsrc-detection-display.py --helpCopy to clipboard
## Expected output
Figure : Expected output for object detection and display using RTSP stream –
Preview

## Pipeline flow
The table lists the plugins used in the decode and object detection using RTSP
stream pipeline:| Plugin | Description |
| --- | --- |
| rtspsrc | Receives the RTSP stream from
rtsp://<ip-address>/live. |
| rtph264depay | Extracts the video data from RTSP stream. |
| h264parse | Parses the H.264 video. |
| [v4l2h264dec](https://docs.qualcomm.com/doc/80-70017-50/topic/v4l2h264dec.html) | Decodes the video. Then, tee splits the stream for
inferencing. |
| [qtimlvconverter](https://docs.qualcomm.com/doc/80-70017-50/topic/qtimlvconverter.html) |
In
this use case, qtimlvdetection does the following: