2016-03-28 14 views
1

Ich benutze VLC Media Player, um .MP4 Video mit http zu streamen. Streaming funktioniert gut (ich konnte diesen Stream mit einer anderen Instanz von VLC verbinden). Nun möchte ich mit OpenCV mit Python 2.7 zu diesem Stream verbinden und Video für Bild abrufen.So erhalten Sie Video-Frame für Frame aus Stream mit OpenCV und Python

Dies wird geändert Tutorial-Code (die mit lokalen Datei perfekt funktioniert gut):

<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() 

Bitte helfen.

+0

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

Antwort

Verwandte Themen