在ffmpeg中添加两个命令

时间:2017-07-12 11:19:19

标签: ffmpeg video-processing android-ffmpeg

我使用两个命令,一个用于设置帧的大小,另一个用于在左上角添加水印

此命令将帧大小设置为720 * 1280

String [] complexCommandOne = {" -y" ," -i",路径," -strict"," experimental"," -vf"," scale = 720: 1280"," -preset"," ultrafast",output};

下面的命令将水印添加到上面的输出文件

String [] complexCommandTwo = {"-y" ,"-i", output,"-strict","experimental", "-vf", "movie="+pngpath+" [watermark]; [in][watermark] overlay=x=10:y=10 [out]","-s", "720x1280","-r", "30", "-b", "15496k", "-vcodec", "mpeg4","-ab", "48000", "-ac", "2", "-ar", "22050","-preset", "ultrafast", fileName};

这两个命令在20秒视频上花费3-5分钟

我想将它们合并,以便缩短时间。

任何帮助。我是新的我Ffgmeg

1 个答案:

答案 0 :(得分:0)

从未见过这样的事情,但看起来基本上只是使用常规的FFmpeg CLI语法。

所以就是这样,我想:

{"-y", "-i", input, "-strict", "experimental", "-vf", "movie="+pngpath+" [watermark]; [in] scale=720:1280 [scaled]; [scaled][watermark] overlay=x=10:y=10 [out]", "-s", "720x1280", "-r:v", "30", "-b:v", "15496k", "-c:v", "mpeg4", "-b:a", "48000", "-ac", "2", "-r:a", "22050", "-preset:v", "ultrafast", fileName}

通常看起来像这样:

ffmpeg -y -i INPUTFILE -strict experimental -vf "movie=LOGOFILE [watermark]; [in] scale=720:1280 [scaled]; [scaled][watermark] overlay=x=10:y=10 [out]" -s 720x1280 -r:v 30 -b:v 15496k -c:v mpeg4 -b:a 48000 -ac 2 -r:a 22050 -preset:v ultrafast OUTPUTFILE

你有什么FFmpeg版本? 因为超过3.0你可以省略“-strict”,“experimental”(当它仍然被认为是一个实验性功能时,需要启用FFmpeg自己的AAC音频编解码器。)