![](/img/trans.png)
[英]Why can't I reading stream from frontal tablet camera using OPENCV VideoCapture?
[英]OpenCV VideoCapture can't read from stream
我可以在VLC中打开流,但是在OpenCV中我无法捕获帧。 (Python 2.7,OpenCV 3.4.3二进制发行版x86,Windows 10)。 我一直在遵循此指南: https : //medium.com/@tomgrek/hackers-guide-to-the-aws-deeplens-1b8281bc6e24,但是我似乎无法从在线随机流中读取内容(不确定是否应该到这个问题,我看到opencv videocapture无法打开有关使用ffmpeg进行编译的MJPEG流 ,但我只是下载了Sourceforge中提供的二进制文件)。
我正在使用更新到最新版本的AWS Deeplens。
已安装ffmpeg,最新版本。
然后,在/etc/ffserver.conf中添加:
<Stream camera.h264>
File "/opt/awscam/out/ch1_out.h264"
VideoFrameRate 6
VideoSize 320x240
NoAudio
</Stream>
<Stream camera.mjpeg>
File "/opt/awscam/out/ch2_out.mjpeg"
VideoFrameRate 3
VideoSize 640x480
Format mjpeg
NoAudio
</Stream>
ffserver -f /etc/ffserver.conf
ssh -L 8090:localhost:8090 aws_cam@192.168.0.10
的SSH隧道 http://localhost:8090/camera.mjpeg
,则可以看到来自摄像机的流。 但是,如果我运行以下代码:
cam = cv2.VideoCapture("http://localhost:8090/camera.mjpeg")
success, frame = cam.read()
opened = cam.isOpened()
success, frame, opened
我得到:
False, None, False
如果浏览到http://localhost:8090/stat.html
, http://localhost:8090/stat.html
看到:
Available Streams
Path Served Conns bytes Format Bit rate kbits/s Video kbits/s Codec Audio kbits/s Codec Feed
test1.mpg 0 0 mpeg 96 64 mpeg1video 32 mp2 feed1.ffm
test.asf 0 0 asf_stream 320 256 msmpeg4 64 wmav2 feed1.ffm
stat.html 17 42150 - - - -
index.html 0 0 - - - -
camera.h264 3 6805k h264 0 0 libx264 0 /opt/awscam/out/ch1_out.h264
camera.mjpeg 12 41073k mjpeg 0 0 mjpeg 0 /opt/awscam/out/ch2_out.mjpeg
每次我调用VideoCapture()
,都会看到camera.mjpeg
流的Served
数量如何增加2或3, bytes
增加了几兆字节,但是在OpenCV中什么都看不到。 我没有在Windows 10中尝试任何其他视频设备,但是我可以读取图像没有问题。 我还尝试了在线随机流,也可以在VLC中打开,但不能在OpenCV中打开,请尝试以下操作: http : //136.176.70.200/mjpg/video.mjpg
有任何想法吗?
看起来我需要使用ffmpeg支持自己编译OpenCV。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.