在向视频添加多个图像的同时加快FFMPEG视频处理时间

4

我正在尝试在视频的特定时间间隔上叠加多个图像...但对于1分钟长度的视频来说,处理时间太长了。

我使用了VideoKit库来实现它。

这是我用于将多个图像添加到视频的代码。

 String[] command = {"-i", inputPath, 
                "-i", imagePath1,"-i", imagePath2,"-i",imagePath3,
                "-filter_complex",
                "[0][1]overlay=y=H-h:enable='between(t,2,10)'[v1];
                 [v1][2]overlay=y=H-h:enable='between(t,10,20)'[v2];
                 [v2][3]overlay=y=H-h:enable='between(t,20,30)'[v3]",
                "-map", "[v3]",  outputPath};

有没有更快的视频处理库?

如果您正在使用libx264(H.264视频)或libx265(H.265 / HEVC),请使用更快的编码预设(-preset选项)。请参阅FFmpeg Wiki:H.264H.265 - llogan
@llogan,正如您所说,我已经使用了“-preset”、“ultrafast”命令,这使得处理速度更快,但我仍然需要像这个应用程序一样更加流畅地工作:https://play.google.com/store/apps/details?id=com.newbiz.mvmaster。 - Vivek Faldu
1个回答

4

我刚刚添加了两个标签,以加快处理速度。

String[] command = {"-i", inputPath, 
\"-i", imagePath1,"-i", imagePath2,"-i",imagePath3,
"-filter_complex",
"[0][1]overlay=y=H-h:enable='between(t,2,10)'[v1];
[v1][2]overlay=y=H-h:enable='between(t,10,20)'[v2];
[v2][3]overlay=y=H-h:enable='between(t,20,30)'[v3]",
"-map", "[v3]",
**"-preset", "ultrafast",**  outputPath};

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接