Alex Seen
Alex Seen

Reputation: 11

how to use ffmpeg on android

I want to create video file from Jpeg and audio file. I've compiled FFMpeg to android and I've got libffmpeg.so, and obj folder with ithers resources.

But how to use it? What I need to do for use command like: "ffmpeg -i image.jpeg -i audio.mp3 out.avi" Please help.

Upvotes: 1

Views: 5767

Answers (3)

fatih orhan
fatih orhan

Reputation: 21

You may use JNI interface to call functions from a library, in your case ffmpeg library. Here is a basic tutorial of JNI: http://marakana.com/forums/android/examples/49.html

To put simply, JNI is the bridge between your Java code and C code.

In order to call ffmpeg as in command line from your Java code, You may include ffmpeg.c (and other needed files) into your jni interface (under jni directory) and compile it along with your other jni code, so that you may call ffmpeg's main function with arguments just like the command line.

Upvotes: 0

Lawrence D'Oliveiro
Lawrence D'Oliveiro

Reputation: 2804

You will need to include JNI wrapper methods that you can call from Java, that will in turn invoke the FFmpeg functions.

Upvotes: 0

blahdiblah
blahdiblah

Reputation: 34031

From the FFmpeg docs on images:

The following example shows how to use ffmpeg for creating a video from the images in the file sequence ‘img-001.jpeg’, ‘img-002.jpeg’, ..., assuming an input frame rate of 10 frames per second:

ffmpeg -i 'img-%03d.jpeg' -r 10 out.mkv

To actually run it from Android, look at the documentation for Runtime.exec().

Upvotes: 1

Related Questions