OpenCV VideoCapture not read any video File in Windows 7 32bit

i try to read .avi or .mpeg video file using VideoCapture class of OpenCV2.4.8 in C++ using QtCreator and CMake 2.8.12.1. Before built OpenCV, i download FFMPEG static version and put them into Program Files directory, i add their path into enviroments variable PATH, then i download K Lite Codec Pack Full, install it and only then i built OpenCV with CMAKE and mingw provide by Qt. After installation i add to PATH the right path of built OpenCV. The stream from webcam works fine, but the stream from a video file doesn't work. I tried on Windows 7 32bit and Windows 8 64bit. Here is the code

#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/core/core.hpp>
#include "opencv2/opencv.hpp"
cv::Mat img;
cv::VideoCapture cap("Prova.avi");
std::cerr << cap.isOpened() << std::endl;
while(cap.read(img)){
    cv::imshow("Opencv", img);
    cv::waitKey(33);
}

The same code works on Ubuntu 12.04 with the same version of OpenCV and with the ffmpeg build by myself. What is wrong?

Answers


For some unknown reason in a system 32bit the building created a dll called opencv_ffmpeg248_64.dll and the installation of opencv was in a folder "x64", so i think that dll was for 64bit system. I download the pre built version of openCV and i use the dll included in that package.


Download the file opencv_ffmpeg.dll. I got it from this

Now rename the opencv_ffmpeg.dll according to the opencv version you are using. For OpenCv 2.4.8 rename it as opencv_ffmpeg248.dll and add the location of this file to the PATH in environment variable. Now try to run your program.


Need Your Help

jquery autocomplete showing id and not label

jquery autocomplete

I'm using jquery's autocomplete function and it's working just fine except that when I select something from the drop down list, the input field get populated with the value and not the label.

bash prompt user to edit string and enter

linux bash

I want to present the user with a string to edit and enter.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.