无法从 ip android cam 访问 http 流

unable to http stream from ip android cam

我已经通过 wifi 连接了我的电脑和我的 android 设备,并在我的 android 设备上启动了 DroidCam 应用程序。
现在,如果我尝试在网络浏览器中打开 url http://192.168.100.4:8080/mjpegfeed?640x480 ,我可以从我的 android 手机上看到实时视频
但是如果我尝试使用 python 代码流式传输视频:

import cv2
import urllib 
import numpy as np

stream=urllib.urlopen('http://192.168.100.4:8080/mjpegfeed?640x480')
bytes=''
while True:
    bytes+=stream.read(1024)
    a = bytes.find('\xff\xd8')
    b = bytes.find('\xff\xd9')

    print a,b

    if a!=-1 and b!=-1:
        jpg = bytes[a:b+2]
        bytes= bytes[b+2:]
        i = cv2.imdecode(np.fromstring(jpg, dtype=np.uint8),cv2.CV_LOAD_IMAGE_COLOR)
        cv2.imshow('i',i)
    if cv2.waitKey(1) ==27:
        exit(0)   

代码需要一段时间,然后在控制台中打印 a=-1,b=-1。
所以基本上是:

stream=urllib.urlopen('http://192.168.100.4:8080/mjpegfeed?640x480')

不工作。为什么??

好吧,我刚刚重新启动了计算机,它开始工作了!