OpenCV on Android using NDK: Fail on using cvCaptureFromFile open MP4 file

asked 2014-05-05 17:01:08 -0500

updated 2014-05-06 01:00:43 -0500

berak gravatar image

I'm using Eclipse ADT with NDK developing a Android Application involving OpenCV.

I tried

CvCapture *inputVideo = cvCaptureFromFile(location);

In the native cpp file, but it always gives input NULL.

I have make sure that location is a char* point to a MP4 file on my Android Phone and READ_EXTERNAL_STORAGE permission is given.

(which is actually a MP4 file generated by Android built-in Camera Software and could be open by build-in Video Software)

I tried VideoCapture::VideoCapture, the cpp version of cvCaptureFromFile but still video.isOpen() is False always.

Is it like actually OpenCV does not support MP4 on Android or I need to come with other software?

edit retag flag offensive close merge delete


think of it, what should decompress your mp4 ? there is no backend (ffmpeg, gstreamer, whatever) for this on android. (if there was, you could just use VideoCapture straight from java)

also please don't use the arcane c-api, as it works on IplImages, and the java wrappers use cv::Mat, 2 very different pair of shoes.

berak gravatar imageberak ( 2014-05-06 00:58:19 -0500 )edit