我使用的是库implementation 'com.arthenica:mobile-ffmpeg-full-gpl:4.4.LTS'
。我需要把3个视频,添加3个图片和音乐到他们。我正在生成以下代码:
-y -i /storage/emulated/0/Movies/video_20211111_141930.mp4 -i /storage/emulated/0/Movies/video_20211111_141946.mp4 -i /storage/emulated/0/Movies/video_20211111_141958.mp4 -i /storage/emulated/0/Pictures/Maramax/IMAGETEXT.png -i /storage/emulated/0/Pictures/Maramax/IMAGESTICKER.png -i /storage/emulated/0/Pictures/Maramax/logo.png -filter_complex [0:v:0][1:v:0][2:v:0]concat=n=3:v=1[merg0];[3]scale=1280:720[i0];[merg0][i0] overlay=0:0[merg1];[4]scale=1280:720[i1];[merg1][i1] overlay=0:0[merg2];[5]scale=195:136[i2];[merg2][i2] overlay=766:30[merg3] -c copy -threads 4 -vcodec libx264 -c:a aac -preset ultrafast -shortest -crf 20 -vsync 2 /storage/emulated/0/Pictures/Maramax/finalVideo0.8238299708746938.mp4
我将它作为cmd命令数组传递给FFmpeg.executeAsync(我也尝试过使用一行命令):
Config.enableLogCallback(new LogCallback() {
public void apply(LogMessage message) {
Log.e(Config.TAG, message.getText());
}
});
FFmpeg.executeAsync(cmd, new ExecuteBinaryResponse(this.delegate, filepath));
我得到的结果是:
E/mobile-ffmpeg: Filter overlay has an unconnected output
未收集视频。如果我删除带有参数的-filter_complex,问题就消失了,也就是说,这个命令中的某个地方有错误。尝试将-filter_complex的值括在单引号和双引号中时,抛出错误。在覆盖之前删除空格也没有什么帮助。在安卓10及更低版本上,一切运行正常。这个错误发生在Android 11上。这个库已经过时了,建议去https://github.com/tanersener/ffmpeg-kit,但是如果你能解决这个库上的问题,过渡是不可取的,因为ffmpeg-kit也有很多问题。
发布于 2021-11-14 17:33:12
问题:不知道你想使用[merg3]
作为你的输出视频。
这就是为什么[merg3]
是一个未连接的输出。它没有任何用途。
解决方案:使用map
选项选择输出焊盘[merg3]
。
此外,您还可以使用map
选项从第一个输入中选择音频:
...;[merg2][i2] overlay=766:30[merg3] -map "[merg3]" -map 0:a -c copy ...
https://stackoverflow.com/questions/69943740
复制相似问题