简体   繁体   English

在ffmpeg监护人项目中使用叠加视频过滤器(android)

[英]using overlay video filter in ffmpeg guardian project (android)

First, im a beginner in FFMPEG so please bear with me. 首先,我是FFMPEG的初学者,所以请耐心等待。

Im using this library and successfully combined an audio and a video :D 我使用这个库并成功组合了音频和视频:D

However, i keep failing when i tried to insert an image/watermark over a video. 但是,当我试图在视频上插入图像/水印时,我仍然失败。

This is the code im using : 这是我正在使用的代码:

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;
    }

Those code will generate this cmd : 这些代码将生成此cmd:

ffmpeg -i VIDEONAME.mp4 -vf "movie=LOGONAME.png [logo];[in][logo] overlay=10:10 [out]"
-strict -2 OUTPUTNAME.MP4

I have tested this CMD on ubuntu 13.10 64bit, with latest FFMPEG installed and t succeed. 我已经在ubuntu 13.10 64bit上测试了这个CMD,安装了最新的FFMPEG并且成功了。

But it does not in my android project. 但它不在我的android项目中。 It does not catch/throw any error/exception, the program running normally and the file is created but has nothing in it (0 byte) 它不会捕获/抛出任何错误/异常,程序正常运行并且文件已创建但其中没有任何内容(0字节)

Any help is appreciated. 任何帮助表示赞赏。 Thanks for your help :D 谢谢你的帮助:D

Try with following command 尝试使用以下命令

ffmpeg -i input.mp4 -i watermark.png -filter_complex "overlay=10:10" -codec:a copy output.mp4

i have tested it on android and it is working perfect. 我已经在Android上测试了它,它工作得很完美。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM