我使用以下命令合并多个音频文件:
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
请有人帮助我,我做错了什么? 这个问题可能重复,但我找不到任何好的解决方案。
@LordNeckbeard:谢谢你的回复。我找到了解决方案: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();这对我有用
—
Myself
v=0
到你的concat,因为默认是v=1
,但你没有任何视频流。你的concat有3个输出标签,但我假设你想要一个。至于No such filter: ''
我猜这是由于脚本中的命令分割,引用或执行不正确而不是问题ffmpeg
命令本身。在尝试将命令添加到脚本之前,先获取命令。