首先,我是 FFMPEG 的初学者,所以请多多包涵。
我正在使用这个库并成功地结合了音频和视频:D
但是,当我尝试在视频上插入图像/水印时,我一直失败。
这是我使用的代码:
public MediaDesc combineVideoAndImage (MediaDesc videoIn, MediaDesc image, MediaDesc out, ShellCallback sc) throws Exception
{
ArrayList<String> cmd = new ArrayList<String>();
cmd.add(ffmpegBin);
cmd.add("-i");
cmd.add(new File(videoIn.path).getCanonicalPath());
cmd.add("-vf");
cmd.add("movie=" + new File(image.path).getAbsolutePath() + " [logo];[in][logo] overlay=10:10 [out]");
cmd.add("-strict");
cmd.add("-2");
File fileOut = new File(out.path);
cmd.add(fileOut.getCanonicalPath());
execFFMPEG(cmd, sc);
return out;
}
这些代码将生成这个 cmd :
ffmpeg -i VIDEONAME.mp4 -vf "movie=LOGONAME.png [logo];[in][logo] overlay=10:10 [out]"
-strict -2 OUTPUTNAME.MP4
我已经在 ubuntu 13.10 64bit 上测试了这个 CMD,安装了最新的 FFMPEG 并且成功了。
但它不在我的android项目中。它不会捕获/抛出任何错误/异常,程序正常运行并且文件已创建但其中没有任何内容(0 字节)
任何帮助表示赞赏。感谢您的帮助:D