Android – ffmpeg merge multiple audio files into single audio file with android

androidaudioffmpeg

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.

Best Answer

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

Related Question