警告:找不到编解码器参数(././modules/higgui/src/cap_ffmpeg_impl.hpp:540)
warning: Could not find codec parameters (../../modules/highgui/src/cap_ffmpeg_impl.hpp:540)
我正在尝试显示来自IP摄像机的视频馈送,得到以下错误
warning: Could not find codec parameters
(../../modules/highgui/src/cap_ffmpeg_impl.hpp:540)
这是相同的代码。
#include <stdio.h>
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main(int, char**)
{
VideoCapture vcap;
Mat image;
// This works on a D-Link CDS-932L
const string videoStreamAddress = "http://admin:admin123@172.41.20.55:80/? action=stream?dummy=param.mjpg";//From mjpeg streamer
//const string videoStreamAddress = "http://192.168.1.13:8080/videofeed? dummy=param.mjpg"; // Streaming from android using ip-cam
//open the video stream and make sure it's opened
if(!vcap.open(videoStreamAddress)) {
cout << "Error opening video stream or file" << std::endl;
return -1;
}
for(;;) {
if(!vcap.read(image)) {
cout << "No frame" << std::endl;
waitKey();
}
cv::imshow("Output Window", image);
if(cv::waitKey(1) >= 0) break;
}
}
首先我得到了不同的错误,所以我安装了K-Lite编解码器。现在我得到了这个错误。有人能告诉我这个错误和什么有关吗。我已经看了很多来自斯塔克弗洛和opencv的帖子,但也能得到一个令人满意的答案。请帮帮我。提前谢谢。
我用以下代码解决了这个问题。
#include <stdio.h>
#include <opencv2/opencv.hpp>
int main(){
CvCapture *camera=cvCaptureFromFile("http://username:password@ipOfCamera/axis-cgi/mjpg/video.cgi?resolution=640x480&req_fps=30&.mjpg");
if (camera==NULL)
printf("camera is nulln");
else
printf("camera is not null");
cvNamedWindow("img");
while (cvWaitKey(10)!=atoi("q")){
double t1=(double)cvGetTickCount();
IplImage *img=cvQueryFrame(camera);
/*if(img){
cvSaveImage("C:/opencv.jpg",img);
}*/
double t2=(double)cvGetTickCount();
printf("time: %gms fps: %.2gn",(t2-t1)/(cvGetTickFrequency()*1000.), 1000./((t2-t1)/(cvGetTickFrequency()*1000.)));
cvShowImage("img",img);
}
cvReleaseCapture(&camera);
}
如果它能帮助像我这样的人,那就太好了。也感谢@karlphillip给你时间。
警告不是错误放松。
在这种情况下,FFmpeg是在抱怨,而不是OpenCV。原因可能是URL上指定的mjpg格式实际上并不需要实际的编解码器。
相关文章:
- FFmpeg:制作一个应用程序比直接使用ffmepg更好吗
- 使用FFMPEG将RGB图像序列保存到.mp4时出现问题
- FFMPEG配置文件级别id大小无效
- FFMpeg库:如何在音频文件中精确查找
- OpenCV RTP-Stream with FFMPEG
- FFmpeg——使用硬件加速进行视频解码
- 如何在 C/C++ 中使用 ffmpeg 的黑框 avfilter
- 在 GLFW 窗口中显示 FFMPEG 解码帧
- FFMPEG:sws_scale返回错误:切片参数 0, 2160 无效
- 为什么有些延迟加载 DLL 会立即使用 FFMPEG 卸载?
- 将FFMpeg AVFrame对象从C++应用程序流式传输到Python的最佳方法?
- 面临分段故障 使用 ffmpeg 读取视频时,因为"pFormatCtx-> streams [i]-> codecpar"的地址0x00
- 将 FFMPEG 帧写入 png/jpeg 文件
- FFMPEG,C++,内存泄漏,我做错了什么?
- 如何在 c++ 中使用 ffmpeg 获取 DirectShow 设备列表?
- qsort 不适用于我的 impl 中的浮点类型。怎么了?
- 矛盾的未解决的外部符号+未使用的库与VS2017和FFMPEG 4
- FFmpeg av_read_frame从音频流返回数据包
- 使用ffmpeg时如何提高图像导出/提取速度?
- FFmpeg原始视频大小参数