Add background music progress stuck at 92%
knowamit opened this issue · 8 comments
Hello I am trying to add background music but progress stuck forever around 92%, please help me.
log
@yangjie10930 Thanks Lib I have solved it with Custom Commands. 👍
@amitsharma492 兄弟,怎么解决的?万谢
@amitsharma492 how?
If Someone is still looking for the solution to this. This is the command i used in order to add music to a video.
String commandThen = "-i " + MyApplication.getVideoPath() + " -i " + MyApplication.getAudioPath() + " -filter_complex [0:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume="+ MyApplication.getVideoVolume() + "[a1];[1:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=" + MyApplication.getAudioVolume() + "[a2];[a1][a2]amerge,pan=stereo:c0<c0+c2:c1<c1+c3[out] -c:v copy -map 0:v -map [out] -y " + destination.getAbsolutePath();
Here you need to provide video path, audio path, video volume, audio volume and destination path. If you are satisfied, close this issue please. Thanks
After writing this command, execute this command, by EpMedia.execCmd Function.
@knowingman try the following command:
String[] complexCommandWithTrack = {"ffmpeg", "-y", "-i", inputVideoFile.mp4, "-i", inputAudio.mp3, "-c:v", "copy", "-filter_complex", "[0:a]aformat=fltp:44100:stereo,volume=2,apad[0a];[1]aformat=fltp:44100:stereo,volume=2,[1a];[0a][1a]amerge[a]", "-map", "0:v", "-map", "[a]", "-ac", "2", "-shortest", outfile.mp4};
EpMedia Version Of the Above Command :-)
String commandThen = "-i " + FilePath.getPath(SavingActivity.this, MyApplication.getVideoUri()) + " -i " + FilePath.getPath(SavingActivity.this, MyApplication.getAudioUri()) + " -filter_complex [0:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume="+ MyApplication.getVideoVolume() + "[a1];[1:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=" + MyApplication.getAudioVolume() + ",apad[a2];[a1][a2]amerge,pan=stereo:c0<c0+c2:c1<c1+c3[out] -c:v copy -map 0:v -map [out] -y " + destination.getAbsolutePath();