Android FFMPEG: Could not execute the ffmpeg from Java code
I am working on an Android app where I want to create a video from a list
of static images. After doing some search on internet, it made me realized
that using "FFMPEG" is the way to go in getting this thing done. So I got
hold of this site: https://github.com/guardianproject/android-ffmpeg-java
from where I downloaded the C library and the Java wrapper. I was able to
compile the C library - of course not the way the instruction was laid out
- but still I was able to get "ffmpeg" executable under
/external/android-ffmpeg/ffmpeg directory. I copied that executable in my
current directory and then copied it to a directory under Android where my
app can access it. Then I called the provided Java wrapper but I am seeing
some errors in the log file like follows:
08-13 11:55:37.848: D/FFMPEG(29598): /data/data/com.sample/app_bin/ffmpeg
-y -loop 1 -i /storage/emulated/0/usersnapshot/ffmpeg/image%03d.jpg -r 25
-t 2 -qscale 5 /storage/emulated/0/video/snapshot-video.mp4
08-13 11:55:37.898: I/ShellCallback : shellOut()(29598):
/data/data/com.sample/app_bin/ffmpeg[1]: syntax error: '(' unexpected
08-13 11:55:37.938: I/ShellCallback : processComplete()(29598): 1
And following is the code snippet (where targetDirectoryForFFMPEG =
directory where the images are stored):
FfmpegController ffmpegController = new FfmpegController(this,
targetDirectoryForFFMPEG);
String out = videoOutPutFile.getPath();
MediaDesc mediaIn = new MediaDesc();
mediaIn.path = targetDirectoryForFFMPEG+"/image%03d.jpg";
mediaIn.videoFps = "25";
ffmpegController.convertImageToMP4(mediaIn, 2, out,new
ShellCallback() {
@Override
public void shellOut(String shellLine) {
Log.i("ShellCallback : shellOut()", shellLine);
}
@Override
public void processComplete(int exitValue) {
Log.i("ShellCallback : processComplete()", exitValue+"");
}
});
Has anybody implemented this before? If yes, can you point me to what am I
doing incorrect? I will provide more information if needed.
Just wondering if you ever got this resolved. I seem to be going through it now.
ReplyDeletebruce@realkeysmusic.com