2016-03-28 5 views
1

私はVLCメディアプレーヤーを使用してhttpを使用して.mp4ビデオをストリーミングしています。ストリーミングはうまくいきます(VLCの別のインスタンスを使用してこのストリームにアタッチすることができました)。 今、私はこのストリームにPython 2.7でOpenCVを使用して接続し、フレームごとにビデオを取得したいと考えています。openCVとpythonを使用してストリームからビデオをフレームで取得する方法

(ローカルファイルと完全に正常に動作します)この変更されたチュートリアルコード:

<code> 
import numpy as np 
import cv2  
address = '10.0.0.71' # this is my stream ip address 
port = 8080 # this is stream port 

# should I use socket somehow? 
# found this somewhere, no idea what this do 
# import socket 
# msocket = socket.socket(socket.AF_INET,socket.SOCK_STREAM) 
# msocket.connect((address, port)) 

cap = cv2.VideoCapture('file.mp4') # how to use VideoCapture with online stream?  

# just showing video to screen 
while(cap.isOpened()): 
    ret, frame = cap.read() 
    cv2.imshow('frame', frame) 

    if cv2.waitKey(1) & 0xFF == ord('q'): 
     break 

cap.release() 
cv2.destroyAllWindows() 

を助けてください。

+0

http://answers.opencv.org/question/3664/ip-network-camera-access/ – udit043

答えて

1

http://answers.opencv.org/question/24154/how-to-using-opencv-api-get-web-video-stream/

あなたは、たとえば、ストリームにユーザ名と127.0.0.1で、いくつかのストリームログインする必要がある場合は、ちょうどcap = cv2.VideoCapture('yourStreamURIHere')

ことができるはずです:こんにちは、パスワード:さようなら:

cap = cv2.VideoCapture('http://hello:[email protected]/?action=stream?otherparamshere) 
関連する問題