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()
請幫助。
http://answers.opencv.org/question/3664/ip-network-camera-access/ – udit043