cannot able to open video file in videocapture [closed]
I tried to work with video file using video capture. I tried the following program in visual studio 2013 by specifying path as E:\\1.mp4
it works. when i tried the same program in fedora it always shows "Cannot open". Please specify me where the mistake is
#include <iostream>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
using namespace std;
using namespace cv;
int main()
{
string filename = "1.mp4";
VideoCapture capture(filename);
Mat frame;
if( !capture.isOpened() )
{cout << "Cannot open " << endl;
return -1;
}
namedWindow( "w", 1);
for( ; ; )
{
capture >> frame;
if(frame.empty())
break;
imshow("w", frame);
waitKey(20);
}
waitKey(0);
}
Can you start by changing
string filename = "1.mp4";
to an absolute path at first that is not the root folder? Some systems do not allow software to write in root folders but they do allow writing in subroot folders. For example useE:\\test\\test.jpg
.It works. Thanks @StevenPuttemans I specified the file as "/home/user/Desktop/1.MP4" in fedora.The problem is the case-sensitive in specifying filename. the extension is 1.MP4 and typed it as 1.mp4.
Yes for any linux based system an uppercase extension is different from a lowercase extension. Glad you got it figured out!