I have some pretty basic code, it works fine when using a webcam (input 0) but seems to hang when trying to read frames from a video file as opposed to a webcam, any ideas?
#include <iostream>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
using namespace cv;
using namespace std;
int main(int argc, char *argv[]) {
VideoCapture stream(argv[1]);
if (!stream.isOpened()) {
cout << "cannot open file";
}
while (true) {
Mat frame;
stream.read(frame);
imshow("preview", frame);
if (waitKey(30) >= 0)
break;
}
return 0;
}