#include <opencv2/opencv.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main() {
// Open video file
VideoCapture cap("path/to/your/video.mp4");
if (!cap.isOpened()) {
cerr << "Error: Could not open video file!" << endl;
return -1;
}
namedWindow("Video Stream", WINDOW_AUTOSIZE);
while (true) {
Mat frame;
cap >> frame; // Capture a new frame from the video
if (frame.empty()) {
break; // Exit loop if there are no more frames
}
imshow("Video Stream", frame); // Display the current frame
// Exit video stream if 'q' is pressed
if (waitKey(30) == 'q') {
break;
}
}
cap.release(); // Release video file
destroyAllWindows(); // Close all OpenCV windows
return 0;
}