I wanted to split animated gif files using FFmpeg-Android-Java, so I referenced this question Android, split gif to frames with ffmpeg and wrote this code.
String path = "/storage/emulated/0/Download/mothersday-toaster.gif";
String cmd[] = {"-i",path,"-vsync","0","/storage/emulated/0/Download/output$03d.png"};
try {
// to execute "ffmpeg -version" command you just need to pass "-version"
ffmpeg.execute(cmd, new ExecuteBinaryResponseHandler() {
@Override
public void onStart() {}
@Override
public void onProgress(String message) {}
@Override
public void onFailure(String message) {Log.d("Q", "failed to convert");}
@Override
public void onSuccess(String message) {}
@Override
public void onFinish() {}
});
} catch (FFmpegCommandAlreadyRunningException e) {
// Handle if FFmpeg is already running
}
Although, It always gives me the "failed to convert" log. FFMPEG is already loaded. Is there something wrong with my code?