I am using ffmpeg
for merging audio and video. I download a 4 second long MP3 file trying to merge but not successful. i am also trying to merge silent audio. It works but the video become half of its original length. The following command works for silent audio but cuts the video:
String mergecmd1[]={"-i",output,"-f", "lavfi" ,"-i", "aevalsrc=0", " -
shortest", "-y", output};
This is the command I have used for MP3 audio but it does not work:
String cmd1[]={"-i", output ,"-
i","/storage/emulated/0/FestiveApp/Assets/audio.mp3" ,"-codec", "copy",
"-shortest", output};
ffmpeg = FFmpeg.getInstance(Donts_Activity.this);
try {
ffmpeg.execute(command, new ExecuteBinaryResponseHandler() {
@Override
public void onStart() {
// Log.e("ffmpeg","Exaction Start");
}
@Override
public void onProgress(String message) {}
@Override
public void onFailure(String message) {
progressDialog.dismiss();
Log.e("ok",message);
}
@Override
public void onSuccess(String message) {
new Sessionmanager(Donts_Activity.this).SetImageToVideoPath(output);
Log.e("ok","success");
progressDialog.dismiss();
Intent intent=new Intent(Donts_Activity.this,MediaRecorderRecipe.class);
startActivity(intent);
finish();
}
@Override
public void onFinish() {
}
});
} catch (FFmpegCommandAlreadyRunningException e) {
Log.e("ffmpeg",e.toString());
progressDialog.dismiss();
}
My first goal generate video with audio but video length does not be reduce or cut if i am using mp3 or silent ffmpeg audio command