Pipeline to tee to display *and* RTSP port

I’m trying to create a pipeline string that will display to the video sink and also send the video out via an rtsp port on the raspberry pi.

How would I modify this pipeline string?

pipeline_string = (
            "hailomuxer name=hmux "
            + source_element
            + "tee name=t ! "
            + QUEUE("bypass_queue", max_size_buffers=20)
            + "hmux.sink_0 "
            + "t. ! "
            + QUEUE("queue_hailonet")
            + "videoconvert n-threads=3 ! "
            f"hailonet hef-path={self.hef_path} batch-size={self.batch_size} {self.thresholds_str} force-writable=true ! "
            + QUEUE("queue_hailofilter")
            + f"hailofilter so-path={self.default_postprocess_so} {self.labels_config} qos=false ! "
            + QUEUE("queue_hmuc")
            + "hmux.sink_1 "
            + "hmux. ! "
            + QUEUE("queue_hailo_python")
            + QUEUE("queue_user_callback")
            + "identity name=identity_callback ! "
            + QUEUE("queue_hailooverlay")
            + "hailooverlay ! "
            + QUEUE("queue_videoconvert")
            + "videoconvert n-threads=3 qos=false ! "
            + QUEUE("queue_hailo_display")
            + f"fpsdisplaysink video-sink={self.video_sink} name=hailo_display sync={self.sync} text-overlay={self.options_menu.show_fps} signal-fps-measurements=true "
        )

Hey @andy.froncioni

You might try something like this:

pipeline_string = (
    "hailomuxer name=hmux "
    + source_element
    + "tee name=t ! "
    + QUEUE("bypass_queue", max_size_buffers=20)
    + "hmux.sink_0 "
    + "t. ! "
    + QUEUE("queue_hailonet")
    + "videoconvert n-threads=3 ! "
    f"hailonet hef-path={self.hef_path} batch-size={self.batch_size} {self.thresholds_str} force-writable=true ! "
    + QUEUE("queue_hailofilter")
    + f"hailofilter so-path={self.default_postprocess_so} {self.labels_config} qos=false ! "
    + QUEUE("queue_hmuc")
    + "hmux.sink_1 "
    + "hmux. ! "
    + QUEUE("queue_hailo_python")
    + QUEUE("queue_user_callback")
    + "identity name=identity_callback ! "
    + QUEUE("queue_hailooverlay")
    + "hailooverlay ! "
    + "tee name=output_tee ! "  # Add a tee after hailooverlay
    + QUEUE("queue_videoconvert")
    + "videoconvert n-threads=3 qos=false ! "
    + QUEUE("queue_hailo_display")
    + f"fpsdisplaysink video-sink={self.video_sink} name=hailo_display sync={self.sync} text-overlay={self.options_menu.show_fps} signal-fps-measurements=true "
    + "output_tee. ! "  # Branch for RTSP stream
    + QUEUE("queue_rtsp")
    + "videoconvert ! video/x-raw,format=I420 ! "
    + "x264enc tune=zerolatency bitrate=500 speed-preset=superfast ! "
    + "rtph264pay config-interval=1 pt=96 ! "
    + "udpsink host=127.0.0.1 port=8554"
)

Key Changes:

  • Added a new tee element named output_tee after the hailooverlay element.
  • The original video sink branch is mostly unchanged and connected to one branch of output_tee.
  • Created a new branch from output_tee for the RTSP stream, which includes:
    • Queue for buffering
    • videoconvert for format compatibility
    • x264enc for H.264 encoding with low-latency settings
    • rtph264pay for RTP packetization
    • udpsink to stream the video to localhost on port 8554.

This setup should help you achieve the dual output to both the video sink and RTSP stream.

1 Like

Thank you for your help.

However, I looked for a difference with your solution, but I think you might’ve copy-pasted the original pipeline string.

1 Like

Yeah you’re correct , Updated it .

Thank you for this! It de-mystified a few things in my understanding.

1 Like