Capture video using FFmpeg in Android

asked 2015-07-03 02:01:45 -0500

icon mad deer gravatar image

updated 2015-07-03 06:36:23 -0500

thdrksdfthmn gravatar image

I've made a simple camera app just to learn how to capture video on an Android device. The clip is currently recorded with the help of the MediaRecorder library. A preview is shown in a VideoView before recording starts, and continues to show this during the actual recording. As I have understood, recording of videos can also be done by creating an Intent and calling an external Activity, which would result in the previous activity to be paused and destroyed (correct?).

Anyways, for this project I prefer the first approach, to not leave the activity. But unfortunately, I experience issues with the MediaRecorder library due to a known bug (which by the way seems to have been around for years). So now I have come across FFmpeg and this "TouchToRecord" (link below) demo project that uses FFmpeg Recorder from JavaCV to capture videos by touching the screen. Awesome! Except that I do not want to start the camera as a new activity, as they do in this example. I want to remain in the same activity and see the preview and record in a VideoView directly. To touch the VideoView to record isn't necessary. Do you think it's possible to use the same library (JavaCvVideoRecorder), as the creator of this demo project have been using, to do this? Or is there a better way which I have not yet discovered?

In the end, all I want to do is being able to record video directly into a VideoView, without using the MediaRecorder library.

Demo project

edit retag flag offensive close merge delete