Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VideoWriter can not open file with some special characters in its path name #8013

Closed
e3oroush opened this issue Jan 15, 2017 · 2 comments
Closed

Comments

@e3oroush
Copy link

System information (version)
  • OpenCV => 3.1
  • Operating System / Platform => Linux ubuntu 14.04 LTS
  • Compiler => gcc 4.8,4
Detailed description

I found this strange behavior in cv::VideoWriter class. When I wanted to open a video to write, if the video file name contains character ':', e.g. "abc:8:00.avi" application got crashed and the error report was not very clear. The weird thing was if I insert some special charcter like '_' (underscore) the problem would solve, for example: a_bc:8
I think VideoWriter should handle these namings or at least warn its user about this problem at opening video.

@gsunilkumar1
Copy link

@e-soroush

System information (version)
OpenCV => 3.1.0
Operating System / Platform => Linux ubuntu 14.04 LTS
Compiler => gcc 4.9.4

I tried to reproduce the issue with VideoWriter Class.But the application did not crash but works as expected as it saves with characters .Could you please share more details or sample code where you got this issue.

@e3oroush
Copy link
Author

e3oroush commented Mar 24, 2017

Thanks for your investigation. I ran this piece of code and got:

Could not open video for writing

int main() {
    cv::VideoCapture vc("vid.mp4");
    if(vc.isOpened() == false) {
        std::cerr << "Could not open video" << std::endl;
        return 1;
    }
    cv::Mat frame;
    vc.read(frame);
    cv::VideoWriter vw("test:23.mp4", CV_FOURCC('H', '2', '6', '4'), 25, frame.size());
    if(vw.isOpened() == false) {
        std:: cerr << "Could not open video for writing" << std::endl;
        return 1;
    }
    vw.write(frame);
    while(vc.read(frame))
        vw.write(frame);
    vw.release();
    std::cout << "everything is fine" << std::endl;
    return 0;
}

Right now with OpenCV 3.2 and Ubuntu 16.04 it behaves much better! It just doesn't write anything and doesn't crash. But why it can't write with this type of naming?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants