【问题标题】:unable to http stream from ip android cam无法从 ip android cam http 流
【发布时间】:2016-02-16 20:23:03
【问题描述】:

我已经通过 wifi 连接了我的电脑和我的安卓设备,并在我的安卓设备上启动了 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')

不工作。为什么??

【问题讨论】:

    标签: android python opencv webcam http-streaming


    【解决方案1】:

    我刚刚重启了电脑,它开始工作了!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-12-19
      • 2018-04-24
      • 2011-05-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多