我正在使用以下命令合并多个音频文件:
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();
其中 mFileTemp、mFileTemp2、mFileTemp3 是输入音频文件的路径,originalFile 是输出音频文件的路径。
这里我附上了分裂之后的过程:
出现以下错误:
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
有人能帮我看看我做错了什么吗?这个问题可能重复了,但我找不到任何好的解决方案。
答案1
我找到了上述问题的解决方案。我已经在问题中编辑了,
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(" ");
并将此字符串数组传递给:
ffmpeg.execute(cmd...)
请注意:我提到了http://writingminds.github.io/ffmpeg-android-java/. 用于与 Android 集成