Capture failing on Centos6 with various codec/file types using the C api

asked 2015-09-16 11:12:02 -0600

GeorgeStorm gravatar image

Hi all, As above, I'm currently trying to get opencv working on a Centos6 install, trying to extract frames from a video in order to do some processing on them etc, however my capture is failing everytime. I've tried a variety of video types, both containers (avi and mp4), and codecs. Some of them failed to play on the install using the default player, so I assumed it was a codec issue, however even files that do play still don't work with opencv.

Current file I'm trying to use is a .avi using the cinepak codec, which I think should work based on it being on the fourcc website?

My code: (well the relevant bit)

#include <opencv/cv.h>
#include <opencv/highgui.h>
#include <opencv2/core/types_c.h>

CvCapture* capture = NULL;
capture = cvCaptureFromFile("video1.avi");
if (!capture)
{
  printf("ERROR %d\n", capture);
}

It always errors and prints a 0. The video file is in the same directory as the binary and source code.

Any ideas? I don't really want to switch to the C++ as the rest of the code is already in C and so I was hoping I could just add the OpenCV stuff and have it work with little fuss. (previously I was using opencv on a windows PC and sending the frames over the network, but wanted to extract the frames locally to improve my work iteration speed, but this has taken much longer than planned!)

Any help would be greatly appreciated.

edit retag flag offensive close merge delete