I want to process mms video stream with OpenCV using Python. The stream comes from an IP camera I have no control over (traffic monitor). The stream is available as mms or mmst schemes -
mms://194.90.203.111/cam2
plays on both VLC and Windows Media Player.
mmst://194.90.203.111/cam2
works only on VLC. I've tried to change the scheme to HTTP by re-streaming with FFmpeg and VLC but it didn't work.
As far as I understand, mms is using Windows Media Video to encode the stream. No luck adding '.mjpeg' at the end of the URI. I've yet to find what types of streaming are accepted by OpenCV.
Here's my code -
import cv2, platform
#import numpy as np
cam = "mms://194.90.203.111/cam2"
#cam = 0 # Use local webcam.
cap = cv2.VideoCapture(cam)
if not cap:
print("!!! Failed VideoCapture: invalid parameter!")
while(True):
# Capture frame-by-frame
ret, current_frame = cap.read()
if type(current_frame) == type(None):
print("!!! Couldn't read frame!")
break
# Display the resulting frame
cv2.imshow('frame',current_frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# release the capture
cap.release()
cv2.destroyAllWindows()
The What am I missing? What type of video streams can OpenCV capture? Is there an elegant solution without scheme change or transcoding?
Thanks!
Python ver 2.7.8, OpenCV's ver 2.4.9, Both x86. Win7 x64