I am trying to save frames coming from external camera, as an mp4 video. However, getting an error at videoWriter.open(...)
. I tried many FourCC types like ('m', 'p', '4', 'v'), ('M', 'J', 'P', 'G') but the error doesn't change. The code block:
const string NAME = filename + "_000001.mp4";
Size S = Size((int) height,(int) width);
int ex = CV_FOURCC('X', 'V', 'I', 'D');
videoWriter.open(NAME, ex, fps, S, false);
The error:
E/cv::error(): OpenCV(4.5.4) Error: Requested object was not found (could not open directory: /data/app/~~3oEemcnUha6ad_KvvVbBFw==/com.package.m_package-4H7_P1OcGVlr0XBiDa45iA==/base.apk!/lib/arm64-v8a) in glob_rec, file /build/master_pack-android/opencv/modules/core/src/glob.cpp, line 279
However, when i change the format as AVI, no error occurs and the program works correctly. The working code block:
const string NAME = filename + ".avi";
LOGE("%s: NAME = %s\n", __FUNCTION__, NAME.c_str());
Size S = Size((int) width,(int) height);
int ex = CV_FOURCC('M', 'J', 'P', 'G');
videoWriter.open(NAME, ex, fps, S, true);
I also installed ffmpeg into the testing device via Termux. (I don't know if it is required or not). Cmake version: 3.22.1. OpenCV version: 4.5.4.