我正在尝试打开流式传输mjpeg的摄像头。我可以从浏览器访问它
VideoCapture cap;
string url = "http://192.168.0.121:8080/?action=stream&x.mjpg";
cap.open(url);
if (!cap.isOpened()){
cout << "Failed to Open stream" << endl;
exit(1);
}
此代码适用于我的ubuntu桌面。当我交叉编译并将其放入名为nanopi的覆盆子pi克隆中时,它失败并且无法打开流。
我可以在nanopi中打开USB相机,但不能打开网址。
我尝试做一个strace,我看到了这个
open("http://192.168.0.121:8080/?action=stream&x.mjpeg", O_RDONLY) = -1 ENOENT (No such file or directory)
fstat64(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(249, 0), ...}) = 0
ioctl(1, TCGETS, {B115200 opost isig icanon echo ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f6e000
write(1, "Failed to Open stream\n", 22Failed to Open stream) = 22
exit_group(1) = ?
+++ exited with 1 +++
打开(&#34; http://192.168.0.121:8080/?action=stream&x.mjpeg&#34;,O_RDONLY)= -1 ENOENT(没有这样的文件或目录)
是否将其视为文件路径而非网址?
请让我知道我能做些什么。