Ask Your Question

Revision history [back]

OpenCV show video file

Hi, my IDE is QT Creator 5.7.0, compiling with MSVC (2015). I use the OpenCV 3.4.0 My OS is Windows 7 (64 Bit)

When i try to capture and "imshow" the .avi -Video, there is popping up only a gray Window and when the Video is ending, it Shows the last Picture of the Video.

Is it a Problem with opencv_ffmpeg340_64.dll? I still tried to set the Path-Variables, to copy the .dll into the debug Folder, etc.

// Auswahl Video
cv::VideoCapture cap("Regen_02_400fps_K3Stellung_170Belichtung.avi");

// Meldung wenn Video nicht gefunden wird
if (!cap.isOpened())
    std::cout<<"Error when reading steam";
//cv::namedWindow("Original");

for(;;)
{
    cap.read(frame);

    // Abbruch wenn kein Frame mehr gefunden wird
    if (!cap.read(frame))
        break;

    cv::imshow("Original", frame);
    cv::waitKey(25);

    // Abfolge "Geschwindigkeit" mit WaitKey
    char key = cvWaitKey(50);

    // ESC drücken um zu unterbrechen
    if (key == 27)
        break;

 }