警告:找不到编解码器参数(../../modules/highgui/src/cap_ffmpeg_impl.hpp:540) [英] warning: Could not find codec parameters (../../modules/highgui/src/cap_ffmpeg_impl.hpp:540)

查看:2792
本文介绍了警告:找不到编解码器参数(../../modules/highgui/src/cap_ffmpeg_impl.hpp:540)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试显示来自IP摄像机的视频Feed,收到以下错误

I am trying to display the video feed from IP camera getting the following error

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编解码器。现在我得到这个错误。
可以有人请告诉我什么是错误相关的。
我已经经历了stackoverflow和opencv的许多职位,但可以设法得到满意的答案。
请帮帮我。
提前感谢。

First i got different error so I installed K-Lite codec. Now I am getting this error. Can some one please tell me what is the error related to. I have gone through many post from stackoverflow and opencv also but could manage to get a satisfactory answer. Please help me. Thanks in advance.

推荐答案

我能够解决下面代码的问题。

I was able to Solve the problem with the following code.

#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 null\n");
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: %.2g\n",(t2-t1)/(cvGetTickFrequency()*1000.), 1000./((t2-t1)/(cvGetTickFrequency()*1000.)));
    cvShowImage("img",img);
}
cvReleaseCapture(&camera);
}

如果它能帮助像我一样的人。
也谢谢@karlphillip给你的时间。

Would be good if it helps someone like me. Also Thanks @karlphillip for giving your time.

这篇关于警告:找不到编解码器参数(../../modules/highgui/src/cap_ffmpeg_impl.hpp:540)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆