Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Capture video using FFmpeg in Android

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.

Link to demo project: https://github.com/sourab-sharma/TouchToRecord

click to hide/show revision 2
No.2 Revision

Capture video using FFmpeg in Android

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.

Link to demo project: https://github.com/sourab-sharma/TouchToRecordDemo project