What is way correct for capture rtsp stream from IP Camera?

asked 2019-04-30 00:17:45 -0500

zebox gravatar image

updated 2019-04-30 00:20:05 -0500

Hi! Could you advice right way for capture rtsp stream from network (ip) camera? I use OpenCV 4.1.0 on Windows 10 x64. VS 2017, C++. I rebuilt sources with gstreamer support and try capture stream directly in my app. But I not satisfied of results. One rtsp stream (from VLC) open correctly, but after one minute a get increase delay between realtime video and those which show in my app. Another stream from camera not open at all. Demo rtsp stream from Internet openes, but show empty frames ;(

All of above rtsp samples I also tested in VLC player and they played correctly.

I thinking about use ffmpeg separately for capture rtsp and restream to pipe and then capture it in OpenCV from this pipe. But I doubt what it right way.

Could you explain what I do wrong and advice correct way?

edit retag flag offensive close merge delete


Try this and see if it work or not. ffmpeg -rtsp_transport tcp -i rtsp://xx:yy@192.168.1.ee:fd/tcp/av0_0 -f image2 -vf fps=fps=1 images/img%03d.png

supra56 gravatar imagesupra56 ( 2019-04-30 04:12:39 -0500 )edit

Yes, it work. I execute this command and .png files been created in images folder. But what do I to do next with this files?

zebox gravatar imagezebox ( 2019-04-30 05:29:14 -0500 )edit

You can remove them images/img%03d.png

supra56 gravatar imagesupra56 ( 2019-04-30 06:22:51 -0500 )edit

Do you mean read each png file and then delete it? But I get additional workload to filesystem (write, read and delete operation).

zebox gravatar imagezebox ( 2019-04-30 06:32:34 -0500 )edit

No. I thought you wanted to save file or not.

supra56 gravatar imagesupra56 ( 2019-04-30 07:05:43 -0500 )edit

No.I Need capture rtsp stream from camera and then processing it with openCV features.) Anyway, Thanks!

zebox gravatar imagezebox ( 2019-04-30 07:44:23 -0500 )edit

I understood. Fortunately, I'm using python

supra56 gravatar imagesupra56 ( 2019-04-30 08:21:11 -0500 )edit

I detect the issue. I have frame freezing only when I try use analytics features (for example, face detection). If I capturing rtsp and only show it in window all OK.

zebox gravatar imagezebox ( 2019-04-30 08:28:27 -0500 )edit

What is your algorithms are you using? Are you using c++?

supra56 gravatar imagesupra56 ( 2019-04-30 09:00:19 -0500 )edit

I test with example from here: Example

But when I open video from local webcamera (as device 0) app work normally(

zebox gravatar imagezebox ( 2019-04-30 10:10:02 -0500 )edit