How to stream from an ip camera?

asked 2018-01-22 01:52:11 -0500

Guys there are a lot of codes and explanation and non of them helped me. I can not get frames from ip cameras. I can stream them with vlc player but I can't stream on my python2+opencv3 code. here is url of video=

and here is my try " import cv2 import numpy as np cap=cv2.VideoCapture()'') while(True): ret, cv2.imshow("",frame) if cv2.waitKey(1) & 0xff==ord('q'): break cap.release() cv2.destroyAllWindows()


edit retag flag offensive close merge delete



that is not a stream, but a single image. lookup the manual of your cam, there must be another url to get a continuous live stream

berak gravatar imageberak ( 2018-01-22 02:39:34 -0500 )edit

I tring to sya that, I can not get that image. I can not connect that camera with this code. It just doesn't connect. Where am I wrong?

student_turkey gravatar imagestudent_turkey ( 2018-01-22 02:49:41 -0500 )edit

again, you need a video url, not an image one, to connect via VideoCapture.

berak gravatar imageberak ( 2018-01-22 04:00:38 -0500 )edit

simply said, I do not think that a camera with a stream allows you to select a single image like you do. You should have something like which is a motionJPEG stream. Like @berak said, dig into your manual.

StevenPuttemans gravatar imageStevenPuttemans ( 2018-01-22 04:02:27 -0500 )edit

VideoCapture cap(""); will connect successfully, but only serve a single image from last year

problem is not with opencv, but with your ipcam / url

berak gravatar imageberak ( 2018-01-22 04:11:02 -0500 )edit

Thank you all guys for helping me. In further part of the project I may add some more comment on this share. Have a nice day...

student_turkey gravatar imagestudent_turkey ( 2018-01-22 14:44:59 -0500 )edit

Guys, I installed python-vlc. There were many problems I faced like 64bit vlc is needed, dll i needed etc. Finally I can stream from rtsp protocol. Now my problem is, how can I take frames from that video. I mean I did:
import vlc

import cv2

p = vlc.MediaPlayer("rtsp://")

I can take video, but I can 't take snapshots, or frames at moments, how can I do that?

student_turkey gravatar imagestudent_turkey ( 2018-01-25 05:46:09 -0500 )edit

anyone knows about it?

student_turkey gravatar imagestudent_turkey ( 2018-01-27 00:48:17 -0500 )edit