ffmpeg merge multiple audio files into single audio file with android

1

I am using the below command to merge multiple audio files :

String s="-i "+mFileTemp.getPath()+" -i "+mFileTemp2.getPath()+" -i "+mFileTemp3.getPath()+" -filter_complex [0:0][1:0][2:0]concat=n=3:v=0:a=1[out] -map [out] "+originalFile.getPath();

Where mFileTemp, mFileTemp2, mFileTemp3 are the path to input audio file where originalFile is the output audio file path.

Here I am attaching how its passing after splitting:

ffmpeg passing argument after splitting

Getting the following error :

ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.8 (GCC)
configuration: --target-os=linux --cross-
prefix=/home/vagrant/SourceCode/ffmpeg-android/toolchain-
android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --
enable-runtime-cpudetect --sysroot=/home/vagrant/SourceCode/ffmpeg-
android/toolchain-android/sysroot --enable-pic --enable-libx264 --
enable-libass --enable-libfreetype --enable-libfribidi --enable-
libmp3lame --enable-fontconfig --enable-pthreads --disable-debug --
disable-ffserver --enable-version3 --enable-hardcoded-tables --
disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-
doc --disable-shared --enable-static --pkg-
config=/home/vagrant/SourceCode/ffmpeg-android/ffmpeg-pkg-config --
prefix=/home/vagrant/SourceCode/ffmpeg-android/build/armeabi-v7a --
extra-cflags='-I/home/vagrant/SourceCode/ffmpeg-android/toolchain-
android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-
overflow -fstack-protector-all' --extra-ldflags='-
L/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/lib -Wl,-
z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-
cxxflags=
libavutil      55. 17.103 / 55. 17.103
libavcodec     57. 24.102 / 57. 24.102
libavformat    57. 25.100 / 57. 25.100
libavdevice    57.  0.101 / 57.  0.101
libavfilter     6. 31.100 /  6. 31.100
libswscale      4.  0.100 /  4.  0.100
libswresample   2.  0.101 /  2.  0.101
libpostproc    54.  0.100 / 54.  0.100
Guessed Channel Layout for  Input Stream #0.0 : stereo
Input #0, wav, from '/storage/emulated/0/AudioRecorder/cello.wav':
Duration: 00:00:03.75, bitrate: 1411 kb/s
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2
channels, s16, 1411 kb/s
Guessed Channel Layout for  Input Stream #1.0 : stereo
Input #1, wav, from '/storage/emulated/0/AudioRecorder/strings.wav':
Duration: 00:00:05.00, bitrate: 1411 kb/s
Stream #1:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2
channels, s16, 1411 kb/s
Guessed Channel Layout for  Input Stream #2.0 : stereo
Input #2, wav, from
'/storage/emulated/0/AudioRecorder/ChillingMusic.wav':
Duration: 00:00:27.41, bitrate: 1411 kb/s
Stream #2:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2
channels, s16, 1411 kb/s
[AVFilterGraph @ 0xf6e49040] No such filter: ''
Error initializing complex filters.
Invalid argument

Kindly someone helps me what I am doing wrong? This Question may be duplicate but I don't find any good solution for the post.

Myself

Posted 2018-02-27T17:19:52.460

Reputation: 53

Your concat options are confusing. You have 3 inputs with 1 stream each, but your input labels for concat would be for 3 inputs with 3 streams each. You need to add v=0 to your concat because the default is v=1, but you don't have any video streams. Your concat has 3 output labels, but I'm assuming you want one. As for No such filter: '' I'm guessing it is due to incorrect splitting, quoting, or implementation of the command in the script and not an issue with the ffmpeg command itself. Get the command working first before you try to add it to your script. – llogan – 2018-02-27T18:28:12.943

@LordNeckbeard : Thanks for the reply. I found the solution : String s="-i "+mFileTemp.getPath()+" -i "+mFileTemp2.getPath()+" -i "+mFileTemp3.getPath()+" -filter_complex [0:0][1:0][2:0]concat=n=3:v=0:a=1[out] -map [out] "+originalFile.getPath(); this works for me – Myself – 2018-02-27T19:15:10.017

Answers

2

I found the solution for the above question. I had already edited in the question,

        String s="-i "+mFileTemp.getPath()+" -i "+mFileTemp2.getPath()+" -i "+mFileTemp3.getPath()+" -filter_complex [0:0][1:0][2:0]concat=n=3:v=0:a=1[out] -map [out] "+originalFile.getPath();

        String[] cmd= s.split(" ");

and pass this string array to :

         ffmpeg.execute(cmd...)

Please note: I referred the http://writingminds.github.io/ffmpeg-android-java/. for integrating with android

Myself

Posted 2018-02-27T17:19:52.460

Reputation: 53