VideoCapture not working in opencv android
I'm trying to use VideoCapture() in an android application. The app makes a JNI call to the cpp file which has the videocapture() call and passes it a video path.
- I have provided the storage read and write permissions.
- The path is also in correct format like (/storage/emulated/0/filename.avi)
- The video file that I put into my device is first encoded as mjpeg and then as avi using ffmpeg on my PC.
Still I get false result when I check VideoCapture.isopened().
Any suggestions to fix this issue?
extern "C" { void JNICALL Java_com_example_ambikav_opencvvideo_MainActivity_myfun( JNIEnv *env, jobject instance, jstring path) { nPath = env->GetStringUTFChars(path, NULL); LOGD("path: %s \n",nPath);
extern "C"
{
void JNICALL Java_com_example_ambikav_opencvvideo_MainActivity_myfun(
JNIEnv *env, jobject instance, jstring path) {
nPath = env->GetStringUTFChars(path, NULL);
LOGD("path: %s \n",nPath);
cv::VideoCapture videoCapture(nPath);
if(videoCapture.isOpened()){
LOGD("yes");
}
else{
LOGD("no");