opencv_ffmpeg320_64.dll error with mjpeg

asked 2017-03-18 06:15:11 -0500

Wael gravatar image

Hi i am trying to load mjpeg camera

Code is working perfect in opencv2.4

but when i try same code with opencv 3.2 and i get the below error

[mpjpeg @ 00000094198e87e0] Expected boundary '--' not found, instead found a li ne of 3 bytes

Please can you help

const std::string videoStreamAddress = "CAM_URL";
    cv::setBreakOnError(true);
    cv::namedWindow("Example3", cv::WINDOW_AUTOSIZE);

    cv::VideoCapture cap;
    cap.open(videoStreamAddress);

    if (!cap.isOpened())
    { 
        cout << "File is not opened!";
        exit(-1);
    }

    //cout << frame .total()<< endl;
    int i = 1;
    Mat frame;
    for (;;)
    {
        try {
            cout << "showing next frame" << i << endl;
            cap.read(frame);
            //cap.read(frame);
            if (frame.empty())
            {
                cout << "Empty" << endl;
                break;
            }
            else
                cout << "Frame: " << i << endl;
            i++;
            imshow("Example3", frame);
            cout << "Frame showed" << i << endl;
            char c = waitKey(30);//without this image won't be shown


            if (c == 27) break;
            //if (waitKey(30) >= 27) break;  //exception
        }
        catch (...) { /* */

            //cout << e.msg << endl; // output exception message
        }

    }

Regards Wael

edit retag flag offensive close merge delete

Comments

this sounds more, like your server does not comply with the mjpeg protocol, and that the current code in opencv_ffmpeg.dll is simply more picky about correctness.

berak gravatar imageberak ( 2017-03-18 07:20:17 -0500 )edit

I tried Opencv 2.4 and it is working 100%

Also i copied opencv_ffmpeg310_64.dll and renamed it to opencv_ffmpeg320_64.dll copied it to opencv3320 ->> vc14/bin folder and code is worked 100% as well

Regards

Wael gravatar imageWael ( 2017-03-18 11:15:05 -0500 )edit