【发布时间】:2018-11-16 17:35:21
【问题描述】:
我正在使用 BravoBit 依赖项 在 Android 中执行 ffmpeg 命令。下面是依赖
implementation 'nl.bravobit:android-ffmpeg:1.1.5'
执行 ffmpeg 命令需要 String[] commands。 但我无法弄清楚如何以数组格式传递复杂的命令。每当我尝试执行我的命令时,我都会不断收到无效参数错误。 以下是我尝试使用的命令之一。
String[] cmd = new String[]{"-i", uri,
"-i",overlayUri , "-filter_complex","[0:v]setpts=PTS-STARTPTS", "scale=1920x1080[top]","[1:v]loop=-1:size=750","setpts=N/FRAME_RATE/TB","scale=1920x1080","format=yuva420p", "colorchannelmixer=aa=0.5[bottom]"
, "[top][bottom]overlay=shortest=1, format=yuv420p", outputPath};
这里uri,overlayUri是输入和叠加文件路径,outputPath是输出文件路径。
我得到的错误
[NULL @ 0xf6d44e00] 无法为 '[1:v]loop=-1:size=750' 找到合适的输出格式 [1:v]loop=-1:size=750: 参数无效
【问题讨论】:
-
"-filter_complex"之后和outputPath之前的所有过滤器规范都作为单个字符串。必要时不要忘记;分隔符 -
@AlexCohn 以及如何定义编解码器?它们会与 filer_complex 分开还是与它们分开。
-
哪些编解码器?除了极少数例外,您的数组看起来像 ["-xxx", "yyy", "-abc", "def", ... , outputPath]
-
我现在明白了。感谢您之前的 cmets。但是对于编解码器,我的意思是 libvorbis 等,而且我也无法弄清楚如何使用 -map 命令