如何解决从网络摄像头流式传输适用于 VLC,但不适用于网络浏览器
我正在尝试使用 Bottle 微框架从连接到 RaspBerry Pi 的 USB 网络摄像头流式传输视频。我可以使用 VLC 查看视频流,但不能在浏览器中查看。
gen_frame 函数:
camera = cv2.VideoCapture(0)
def gen_frames():
try:
while True:
success,frame = camera.read() # read the camera frame
if not success:
break
else:
ret,buffer = cv2.imencode('.jpg',frame)
frame = buffer.tobytes()
yield (b'--frame\r\n'
b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n')
except Exception as e:
print(str(e))
视频生成路径如下:
@webcamBot.route('/webcam-test/video_Feed')
def video_Feed():
try:
return Response(gen_frames(),mimetype='multipart/x-mixed-replace; boundary=frame')
except Exception as e:
print(str(e))
<img id="webcam" src="http://192.168.1.12:8024/webcam-test/video_Feed" style="width: 300px; height: $
但是没有视频出现。我在 VLC 中测试了 src 链接,效果很好。
我也没有收到任何错误消息。
感谢建议。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。