Creating Video from Images with OpenCV 2.4.1 on Ubuntu

后端 未结 3 996
旧巷少年郎
旧巷少年郎 2020-12-18 15:45

Here is my sample program for creating Video from images with OpenCV. But my output video is not working and An error occurred ans stating that \"Could not demultiplex strea

3条回答
  •  感动是毒
    2020-12-18 16:10

    You can try a different FOURCC code. Some of them are not correctly supported by OpenCV, some by the multimedia apps. Having one that works with both OpenCV and your favourite video player is a matter of trial and error.

    What you can try: Use VLC (in case you don't alreay use it). It is one of the most robust players out there.

    If all you want to do is to display/process a sequence of images in OpenCV as video, you can use an undocumented feature of the VideoCapture: Load a sequence of images.

    The example is in C++, but you can easily convert it to C.

    // pics are a sequence of Pictures001.jpg, PicturesS002.jpg, etc
    cv::VideoCapture cap("path/to/my/Pictures%03d.jpg");
    
    cv::Mat frame;
    
    for(;;)
    {
        cap >> frame;
        if(frame.empty())
           break;
    
        // do some processing
    }
    

提交回复
热议问题