How to stream from an ip camera?
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= http://178.124.174.130:8080/cam_3.jpg
and here is my try " import cv2 import numpy as np cap=cv2.VideoCapture() cap.open('http://178.124.174.130:8080/cam_3.jpg') while(True): ret,frame=cap.read() cv2.imshow("",frame) if cv2.waitKey(1) & 0xff==ord('q'): break cap.release() cv2.destroyAllWindows()
"
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
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?
again, you need a video url, not an image one, to connect via VideoCapture.
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
http://178.124.174.130:8080/cam.mpjg
which is a motionJPEG stream. Like @berak said, dig into your manual.VideoCapture cap("http://178.124.174.130:8080/cam_3.mjpeg");
will connect successfully, but only serve a single image from last yearproblem is not with opencv, but with your ipcam / url
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...
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://192.168.1.152:8554/test")
p.play()
I can take video, but I can 't take snapshots, or frames at moments, how can I do that?
anyone knows about it?