Streaming the output of openCV real-time as an RTSP stream with ffmpeg

asked 2015-03-09 17:13:14 -0500

ourChariot gravatar image

I receive an RTSP video stream from an IP camera into my OpenCV program, which I then process for pedestrian detection; I now want to send the video comprising of bounding boxes around people detected as an rtsp stream over the network.

I am trying to use ffmpeg to do this; I can write the video using OpenCV video writer and also stream video file using ffmpeg as an rtsp stream, but I am unable to do both of this simultaneously so that it is real-time.

Most search results talk about how to receive an RTSP stream into OpenCV and I have not found much help in this regard.

edit retag flag offensive close merge delete

Comments

Well basically this is because when writing away frames, OpenCV treats your output as an object and locks it. So the RTSP stream cannot read from it before OpenCV releases its lock on it. Maybe using seperate threads could be the solution here?

StevenPuttemans gravatar imageStevenPuttemans ( 2015-03-10 05:33:18 -0500 )edit

Hi sir! How can you stream the video out by using VideoWriter, I cannot open the output stream, error in while open. Thanks

BAHRAMUDIN ADIL gravatar imageBAHRAMUDIN ADIL ( 2017-10-30 04:49:34 -0500 )edit

I would suggest you to open your own question, since reviving old ones will not help you get your answer faster :)

StevenPuttemans gravatar imageStevenPuttemans ( 2017-10-31 04:46:31 -0500 )edit