具体如何在Android中使用ffmpeg可参考在android studio中使用FFmpeg。
下面只是列一下相关的命令。(毕竟我比较懒)
如果要把音频比如一个mp3合成到视频中。最简单的例子如下:
Runnable compoundRun=new Runnable() {
@Override
public void run() {
String[] commands = new String[6];
commands[0] = "ffmpeg";
commands[1] = "-i";
commands[2] = videoUrl;
commands[3] = "-i";
commands[4] = musicUrl;
commands[5] = outputUrl;
FFmpegKit.execute(commands, new FFmpegKit.KitInterface() {
@Override
public void onStart() {
Log.d("FFmpegLog LOGCAT","FFmpeg 命令行开始执行了...");
}
@Override
public void onProgress(int progress) {
Log.d("FFmpegLog LOGCAT","done com"+"FFmpeg 命令行执行进度..."+progress);
}
&