Ask Your Question

Revision history [back]

how to close and reopen videoCapture

Hi,

I want to open and clopen again VideoCapture. I have modify example starter_video.cpp :

int main(int ac, char** av) {

    if (ac != 2) {
        help(av);
        return 1;
    }
    std::string arg = av[1];
    { // First open
    VideoCapture capture(arg); 
        if (!capture.isOpened()) 
            capture.open(atoi(arg.c_str()));
        if (!capture.isOpened()) {
            cerr << "Failed to open the video device, video file or image sequence!\n" << endl;
            help(av);
            return 1;
        }
        process(capture);
    }
    {//Second Open
    VideoCapture capture(arg); 
        if (!capture.isOpened()) 
            capture.open(atoi(arg.c_str()));
        if (!capture.isOpened()) {
            cerr << "Failed to open the video device, video file or image sequence!\n" << endl;
            help(av);
            return 1;
        }
         return process(capture);
    }

I can see capture in a window for first opening. For second I have got an error message :

VIDEOIO ERROR: V4L/V4L2: VIDIOC_S_CROP

press space to save a picture. q or esc to quit

Corrupt JPEG data: 1 extraneous bytes before marker 0xd7

Corrupt JPEG data: 1 extraneous bytes before marker 0xd4

Corrupt JPEG data: 2 extraneous bytes before marker 0xd5

... Corrupt JPEG data: 2 extraneous bytes before marker 0xd7

I press ESC Here

VIDEOIO ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV

press space to save a picture. q or esc to quit

VIDIOC_STREAMON: Bad file descriptor

Unable to stop the stream.: Bad file descriptor

What's wrong in my program or may be in my linux mint with cinamon install?

Version control: 3.0.0-beta-21-g4b97e8c Thanks for yours helps

how to close and reopen videoCapture

Hi,

I want to open and clopen close and open again VideoCapture. I have modify example starter_video.cpp :

int main(int ac, char** av) {

    if (ac != 2) {
        help(av);
        return 1;
    }
    std::string arg = av[1];
    { // First open
    VideoCapture capture(arg); 
        if (!capture.isOpened()) 
            capture.open(atoi(arg.c_str()));
        if (!capture.isOpened()) {
            cerr << "Failed to open the video device, video file or image sequence!\n" << endl;
            help(av);
            return 1;
        }
        process(capture);
    }
    {//Second Open
    VideoCapture capture(arg); 
        if (!capture.isOpened()) 
            capture.open(atoi(arg.c_str()));
        if (!capture.isOpened()) {
            cerr << "Failed to open the video device, video file or image sequence!\n" << endl;
            help(av);
            return 1;
        }
         return process(capture);
    }

I can see capture in a window for first opening. For second I have got an error message :

VIDEOIO ERROR: V4L/V4L2: VIDIOC_S_CROP

press space to save a picture. q or esc to quit

Corrupt JPEG data: 1 extraneous bytes before marker 0xd7

Corrupt JPEG data: 1 extraneous bytes before marker 0xd4

Corrupt JPEG data: 2 extraneous bytes before marker 0xd5

... Corrupt JPEG data: 2 extraneous bytes before marker 0xd7

I press ESC Here

VIDEOIO ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV

press space to save a picture. q or esc to quit

VIDIOC_STREAMON: Bad file descriptor

Unable to stop the stream.: Bad file descriptor

What's wrong in my program or may be in my linux mint with cinamon install?

Version control: 3.0.0-beta-21-g4b97e8c Thanks for yours helps

how to close and reopen videoCapture

Hi,

I want to open and close and open again VideoCapture. I have modify example starter_video.cpp :

int main(int ac, char** av) {

    if (ac != 2) {
        help(av);
        return 1;
    }
    std::string arg = av[1];
    { // First open
    VideoCapture capture(arg); 
        if (!capture.isOpened()) 
            capture.open(atoi(arg.c_str()));
        if (!capture.isOpened()) {
            cerr << "Failed to open the video device, video file or image sequence!\n" << endl;
            help(av);
            return 1;
        }
        process(capture);
    }
    {//Second Open
    VideoCapture capture(arg); 
        if (!capture.isOpened()) 
            capture.open(atoi(arg.c_str()));
        if (!capture.isOpened()) {
            cerr << "Failed to open the video device, video file or image sequence!\n" << endl;
            help(av);
            return 1;
        }
         return process(capture);
    }

I can see capture in a window for first opening. For second I have got an error message. Warning and Error message for program :

VIDEOIO ERROR: V4L/V4L2: VIDIOC_S_CROP

press space to save a picture. q or esc to quit

Corrupt JPEG data: 1 extraneous bytes before marker 0xd7

Corrupt JPEG data: 1 extraneous bytes before marker 0xd4

Corrupt JPEG data: 2 extraneous bytes before marker 0xd5

... Corrupt JPEG data: 2 extraneous bytes before marker 0xd7

I press ESC Here

VIDEOIO ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV

press space to save a picture. q or esc to quit

VIDIOC_STREAMON: Bad file descriptor

Unable to stop the stream.: Bad file descriptor

What's wrong in my program or may be in my linux mint with cinamon install?

Version control: 3.0.0-beta-21-g4b97e8c Thanks for yours helps

how to close and reopen videoCapture

Hi,

I want to open and close and open again VideoCapture. I have modify example starter_video.cpp :

int main(int ac, char** av) {

    if (ac != 2) {
        help(av);
        return 1;
    }
    std::string arg = av[1];
    { // First open
    VideoCapture capture(arg); 
        if (!capture.isOpened()) 
            capture.open(atoi(arg.c_str()));
        if (!capture.isOpened()) {
            cerr << "Failed to open the video device, video file or image sequence!\n" << endl;
            help(av);
            return 1;
        }
        process(capture);
    }
} // First Videocapture must be destroyed here
    {//Second Open
Open new object videocapture is allocated here
    VideoCapture capture(arg); 
        if (!capture.isOpened()) 
            capture.open(atoi(arg.c_str()));
        if (!capture.isOpened()) {
            cerr << "Failed to open the video device, video file or image sequence!\n" << endl;
            help(av);
            return 1;
        }
         return process(capture);
    }

I can see capture in a window for first opening. For second I have got an error message. Warning and Error message for program :

VIDEOIO ERROR: V4L/V4L2: VIDIOC_S_CROP

press space to save a picture. q or esc to quit

Corrupt JPEG data: 1 extraneous bytes before marker 0xd7

Corrupt JPEG data: 1 extraneous bytes before marker 0xd4

Corrupt JPEG data: 2 extraneous bytes before marker 0xd5

... Corrupt JPEG data: 2 extraneous bytes before marker 0xd7

I press ESC Here

VIDEOIO ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV

press space to save a picture. q or esc to quit

VIDIOC_STREAMON: Bad file descriptor

Unable to stop the stream.: Bad file descriptor

What's wrong in my program or may be in my linux mint with cinamon install?

Version control: 3.0.0-beta-21-g4b97e8c Thanks for yours helps