Closed rj-indro closed 4 months ago
Hi @rj-indro, inference
does not deliver such functionality out of the box, however you could pipe annotated frames to ffmpeg which then can stream them back through RTSP.
import os
import cv2
os.mkfifo(path="/path/to/pipe")
pipe = open(file="/path/to/pipe", mode="wb", buffering=0)
# somewhere in your code, i.e. in custom_sink
# assuming frame was already scaled to known resolution, i.e. 1280x720
annotated_frame_bytes = cv2.cvtColor(annotated_frame, cv2.COLOR_BGR2RGB).tobytes()
pipe.write(annotated_frame_bytes)
Then in another terminal:
# assuming 10 fps at source
ffmpeg -f rawvideo -video-size 1280x720 -r 10 -i /path/to/pipe -f flv rtsp://your_destination
hi @rj-indro, I hope example above was helpful. I will close this issue but please feel free to reopen it if you have more questions.
Search before asking
Question
I have a model running that can detect doors. It consumes a RTSP stream for the video source then renders bounding boxes in a popup locally. I was wondering if it is possible to restream also as an RTSP stream to a server I already have set up.
I have looked into gstreamer and ffmpeg but I am not having much luck. Thanks!
Additional
No response