I am merging multiple .mp4 file into single .mp4 after merging only first .mp4 is displayed properly and other video is not displayed.
I used this ffmpeg command
ffmpeg -f concat -i " + strTextPath + " -c copy " + strFinalMergedVideoPath;
Related
Task:
Mix Audio Files using FFmpeg in Android.
Error:
[NULL # 0xf6468400] Unable to find a suitable output format for ' -i '
-i : Invalid argument
my Command:
File m1 = new File(Environment.getExternalStorageDirectory() + "/MyFolder/m1.mp3");
File m2 = new File(Environment.getExternalStorageDirectory() + "/MyFolder/m2.mp3");
//m1,m2 are mp3 files
//File outputDirectory2 = new File(Environment.getExternalStorageDirectory() + "/MyFolder/video1.mp3");
String[] auidoMixCmd3={" -i ",""+m1.getPath()," -i ",""+m2.getPath()," -filter_complex [0:0][1:0] amix=inputs=2:duration=first:dropout_transition=0 -codec:a libmp3lame -q:a 0:-f mp3",outputDirectory2.getPath()};
String[] auidoMixCmd2={" -i ",""+m1.getPath()," -i ",""+m2.getPath()," -i ",""+m1.getPath()," -filter_complex","\"[0:0][1:0] amix=inputs=2:duration=longest\" -c:a libmp3lame -f mp3",outputDirectory2.getPath()};
I tried more than 100 times with differnt commands but i did not get any solutions.So many commands are in Stack overflow but getting same error.Please anyone help me out here.
Since it is a String Array you don't have to add the + symbol. Also, no need for the "" before the + symbol.
Your command should look like this:
String[] auidoMixCmd3 = { "-i ", m1.getPath(), "-i ", m2.getPath(), "-filter_complex [0:a][1:a] amix=inputs=2:duration=first:dropout_transition=0 -codec:a libmp3lame -q:a 0 -f mp3", outputDirectory2.getPath()};
I'm working with 2 videos and I want to make 3 different operations at same
execution with FFmpeg. Each command works separate but it'll much more efficient to make them all run at the same execution.
So for example I have:
Video 1
Video 2
First I want to cut both videos from starting point to end point:
cmd = -i video1Path -ss 00:00:30.0 -c copy -t 00:00:10.0 video1Output
cmd = -i video2Path -ss 00:00:30.0 -c copy -t 00:00:10.0 video2Output
Than resizing Video 1:
cmd = "-i " + video1Output+ " -vf scale=240:360" + resizedVideo1;
Now overlaying the resizedVideo1 on top of Video 2:
cmd = "-i " + video2Output + " -i " + resizedVideo1 + " -filter_complex [0:v][1:v]" + overlayCmd + " " + finalVideoPath;
I'm wondering if it's possible to achieve all this actions at the same FFMpeg executions using 1 filter_complex...
The combined command will be
ffmpeg -ss 30 -t 10 -i video2 -ss 30 -t 10 -i video1
-filter_complex
"[1]scale=240:360[v1];[0][v1]overlay"
output.mp4
I am trying to use ffmpeg library for mixing two MP3 or wav audio files using the commands available that I searched over Internet like given below:
ffmpeg -i input1.mp3 -i input2.mp3 -filter_complex amerge -c:a libmp3lame -q:a 4 output.mp3
From link How to overlay two audio files using ffmpeg
Also, tried some many other solutions given on the different forms.
But none of them is working for the the library downloaded from link:
https://github.com/hiteshsondhi88/ffmpeg-android-java.
But when I am trying to run the commands available on the intener, in some commands I am getting different different error like,
-- Unable to find suitable output format for 'ffmpeg' ffmpeg: Invalid argument
And I also tried one more command,
String res = "ffmpeg -y -i " + a.getAbsolutePath() + " -i " + b.getAbsolutePath() + " -filter_complex '[0:0][1:0] amix=inputs=2:duration=longest' -c:a libmp3lame " + c.getAbsolutePath();
It's giving error, No such filter:" Error configuring filters.
What is your version of FFmpeg?
I believe it's old and that's why it's not working.
First setp download newest version from official site try if your command it's working if yes than find another (or build your own) compiled for android executable file
Well First check your FFmpeg version. The way you have used the amix filter have to be changed. amix filter mix audios. So following is what I'm suggesting.
ffmpeg -i input_audio1 -i input_audio2 -filter_complex "aevalsrc=0:d=10[s1];
[s1][1:a]concat=n=2:v=0:a=1[ac1];
[0:a][ac1]amix[aout]" -map [aout] -c:a libmp3lame output_audio
you can append a silent audio which duration is same as the first audio and them use amix over them. So the original audio's will not overlap. aevalsrc will create a silent audio with a duration of 10 sec. Also you need to select appropriate codec for your output accordingly. You can find those codec here.
Hope this helps!
I know it's been some time since this question was posted, but I think your main problem is that you shouldn't include "ffmpeg" on your string.
So your cmd line would be:
String res = "-y -i " + a.getAbsolutePath() + " -i " + b.getAbsolutePath() + " -filter_complex '[0:0][1:0] amix=inputs=2:duration=longest' -c:a libmp3lame " + c.getAbsolutePath();
I'm trying to make a mp4 from an app on Android, to do so i added the FFmpeg binary.
to create the mp3 i use a command :
ffmpegBinaryPath + " -r 24 -i " + inputImgPath + " -c:v libx264 -crf 23 -pix_fmt yuv420p -s 640x480 " + outputVideoPath;
But i want to add sound on this mp4 i use :
ffmpegBinaryPath + " -r 24 -i " + inputImgPath + " -i " + mp3Path + " -c:v libx264 -crf 23 -pix_fmt yuv420p -s 640x480 " + outputVideoPath;
But it does not work i have no error message and FFmpeg stop at the beginning.
I think i need a mp3 code or something like but i can't fin a way to make it works.
So any help will be appreciated.
Thank you.
I am working on add watermark on video file in android with the use of ffmpeg jni what i have not found any solution for the same . i am using this command "ffmpeg -i alldone.mp4 -i cancel_bttn.png -filter_complex "overlay=main_w/2-overlay_w/2:main_h/2-overlay_h/2" record.mp4 " but this was not worked.