My goal is this: I have to read the video stored on the SD card, process its frame for the frame and then save it again in a new file on the SD card. The problem is that OpenCV4Android does not come with a video encoder / decoder, since it does not include ffmpeg. Moreover, using JavaCV for image processing is not an option for me, since the code is already written in native OpenCV, and I access them through JNI. I read a lot here on stackoverflow and the rest of Google. But I did not find a solution.
JavaCV allows me to view video frame by frame, as well as save it frame by frame. However, I can’t convert the video to regular OpenCV Mat objects that can be handled by regular OpenCV4Android.
I read about JCodec as a library for encoding / decoding videos. Will JCodec let me complete my task? If so, do you know any examples.
Compiling FFMPEG for Android would also be an option. However, I think it's a bit overkill to write FrameGrabber and FrameRecorder. I think there must be some solution besides JavaCV.
Starting with API 18, Android has MediaCodec and MediaMuxer. Maybe they can help me?
So let's get to my requirements. I am currently configured for Android API 19, so I have all the available features that I need. For me, the most important requirement is the following:
If I process a video 10 seconds with 30 FPS, the result should also be a video with 10 seconds with 30 FPS. Therefore, I want an exact copy of the video, but with some design added to each OpenCV frame. Using OpenCV through Python, for example, you can accomplish this task using the VideoWriter class and the VideoInput class. I need the same functionality on Android.
I'm curious that so far this problem has not (or I have not found).
I hope I explained everything.
android opencv video
Vion
source share