- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
这是我的 HTTP 流链接格式(用户、密码和地址已更改为虚拟):
http://username:password@192.168.0.104:8093/axis-cgi/mjpg/video.cgi
此流在 VLC 中完美运行。但是,我无法使用 OpenCV 库打开它。
这是我的代码:
#include <iostream>
#include "opencv2/opencv.hpp"
using namespace std;
using namespace cv;
int main()
{
VideoCapture cap;
const string videoStreamAddress = "http://username:password@192.168.0.104:8093/axis-cgi/mjpg/video.cgi";
cap.open(videoStreamAddress);
if (!cap.isOpened())
{
cout << endl << "Videostream not found !" << endl;
system("pause");
return 0;
}
Mat frame;
while(1)
{
cap >> frame;
if (frame.empty())
break;
imshow("IPcamera", frame);
int c = waitKey(1);
if (c == 27)
{
break;
}
}
waitKey(0);
return 0;
}
这给了我一个错误:
warning: Error opening file (../../modules/highgui/src/cap_ffmpeg_impl.hpp:529)
指向:
bool CvCapture_FFMPEG::open( const char* _filename )
{
unsigned i;
bool valid = false;
close();
#if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(52, 111, 0)
int err = avformat_open_input(&ic, _filename, NULL, NULL);
#else
int err = av_open_input_file(&ic, _filename, NULL, 0, NULL);
#endif
if (err < 0)
{
CV_WARN("Error opening file");
goto exit_func;
}
...
可能是什么问题?
最佳答案
您是否尝试过使用 Videocapture 在您的机器中打开视频文件? (只需将视频文件的路径添加到您放置 URL 的位置)我假设它以同样的方式失败。所以这是ffmpeg的问题。您需要使用 ffmpeg 支持自行构建 OpenCV。 (也可以在 gstreamer 上搜索一下。我对此不太熟悉)。
您也可以尝试使用其他软件,例如 ManyCam在中间。它使您能够像从网络摄像头阅读一样轻松地阅读流。
关于c++ - 无法打开 HTTP 流 : Error opening file (. ./cap_ffmpeg_impl.hpp:529),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19834202/
这是我的 HTTP 流链接格式(用户、密码和地址已更改为虚拟): http://username:password@192.168.0.104:8093/axis-cgi/mjpg/video.cgi
我正在尝试显示来自 IP 摄像机的视频源,但出现以下错误 warning: Could not find codec parameters (../../modules/highgui/src/cap
我正在使用 OpenCV 显示视频我的代码是 #include #include #include #include #include #include #include #include #incl
我无法在 opencv 上访问 ipcamera,我正在使用 ipcctrl 应用程序查看相机预览并且它工作正常,但是当我尝试将 URL 粘贴到我的代码中时它显示 警告:打开文件时出错(/build/
我是一名优秀的程序员,十分优秀!