Using RTSP stream in Raspberry Pi5

I ran image detection from the sample file cloned from GitHub - hailo-ai/hailo-rpi5-examples. We have three sources at our disposal - RPi camera, camera USB and file. What file modifications must be made to use the RTSP stream from an IP camera for analysis?

Welcome to the Hailo Community!

I would recommend looking at our Tappas examples

GitHub Tappas Multistream Detection

and our Hailo Application Code Examples

GitHub Hailo Application Code Examples Multistream App

The both also support RTSP. I am not sure how much effort it will take to adapt them but the examples should get you started.

Also check out the other examples in both repositories. I do not know them all in and out.

Let me know if you are still looking for it. I managed to get it working

@sanjoyg If you can spare a moment, please share your findings. They may be of assistance to future users. Thank you.

Unfortunately, I couldn’t get it to work, can you share with us the solution to the problem step by step?

Here are the changes to do

go to basic_pipelines directory

  1. Changes to “”

Locate function “get_source_type” and change to following

def get_source_type(input_source):
    # This function will return the source type based on the input source
    # return values can be "file", "mipi" or "usb"
    if input_source.startswith("/dev/video"):
        return 'usb'
        if input_source.startswith("rpi"):
            return 'rpi'
        elif input_source.startswith("rtsp"):
            return 'rtsp'
            return 'file'
  1. Go to

Locate the function get_pipeline_string and add an “elif” after the elif of USB and before the source. The code should look like

 elif self.source_type == "usb":
            source_element = (
                f"v4l2src device={self.video_source} name=src_0 ! "
                "video/x-raw, width=640, height=480, framerate=30/1 ! "
        elif self.source_type == "rtsp":
            source_element = (
                f"rtspsrc location={self.video_source} name=src_0  message-forward=true ! "
                + "rtph264depay !"
                + "queue name=hailo_preprocess_q_0 leaky=no max-size-buffers=5 max-size-bytes=0 max-size-time=0 ! "
                + "decodebin ! queue leaky=downstream max-size-buffers=5 max-size-bytes=0 max-size-time=0 ! "

                " video/x-raw, format=I420 ! "

Now launch --i <>


I update files but if use commamnd:

python basic_pipelines/ --input rtsp://admin:pass123@

In results is error:

Error: gst-resource-error-quark: Resource not found. (3), ../plugins/elements/gstfilesrc.c(553): gst_file_src_start (): /GstPipeline:pipeline0/GstFileSrc:src_0:
No such file "rtsp://admin:"

The URL doest seem right. Hopefully you did include password. Also take the “ out

Thank you! I was also struggling with this but your answer helped me!

I try with " rtsp stream" and have this output:

python basic_pipelines/ --input "rtsp://admin:pass123@"
hailomuxer name=hmux filesrc location=rtsp://admin:altes1906@ name=src_0 ! queue name=queue_dec264 max-size-buffers=3 max-size-bytes=0 max-size-time=0 !  qtdemux ! h264parse ! avdec_h264 max-threads=2 !  video/x-raw,format=I420 ! queue name=queue_scale max-size-buffers=3 max-size-bytes=0 max-size-time=0 !  videoscale n-threads=2 ! queue name=queue_src_convert max-size-buffers=3 max-size-bytes=0 max-size-time=0 !  videoconvert n-threads=3 name=src_convert qos=false ! video/x-raw, format=RGB, width=640, height=640, pixel-aspect-ratio=1/1 ! tee name=t ! queue name=bypass_queue max-size-buffers=20 max-size-bytes=0 max-size-time=0 ! hmux.sink_0 t. ! queue name=queue_hailonet max-size-buffers=3 max-size-bytes=0 max-size-time=0 ! videoconvert n-threads=3 ! hailonet hef-path=/home/cmw/hailo-rpi5-examples/basic_pipelines/../resources/yolov6n.hef batch-size=2 nms-score-threshold=0.3 nms-iou-threshold=0.45 output-format-type=HAILO_FORMAT_TYPE_FLOAT32 force-writable=true ! queue name=queue_hailofilter max-size-buffers=3 max-size-bytes=0 max-size-time=0 ! hailofilter so-path=/usr/lib/aarch64-linux-gnu/hailo/tappas//post-process/ qos=false ! queue name=queue_hmuc max-size-buffers=3 max-size-bytes=0 max-size-time=0 !  hmux.sink_1 hmux. ! queue name=queue_hailo_python max-size-buffers=3 max-size-bytes=0 max-size-time=0 ! queue name=queue_user_callback max-size-buffers=3 max-size-bytes=0 max-size-time=0 ! identity name=identity_callback ! queue name=queue_hailooverlay max-size-buffers=3 max-size-bytes=0 max-size-time=0 ! hailooverlay ! queue name=queue_videoconvert max-size-buffers=3 max-size-bytes=0 max-size-time=0 ! videoconvert n-threads=3 qos=false ! queue name=queue_hailo_display max-size-buffers=3 max-size-bytes=0 max-size-time=0 ! fpsdisplaysink video-sink=xvimagesink name=hailo_display sync=false text-overlay=False signal-fps-measurements=true 
Error: gst-resource-error-quark: Resource not found. (3), ../plugins/elements/gstfilesrc.c(553): gst_file_src_start (): /GstPipeline:pipeline0/GstFileSrc:src_0:
No such file "rtsp://admin:pass123@"

OK it work - Thanks :slight_smile: