gpt4 book ai didi

android - 如何使用 FFmpeg 在单个命令中修剪、裁剪和添加叠加层

转载 作者:行者123 更新时间:2023-12-04 22:46:03 25 4
gpt4 key购买 nike

我正在使用 FFmpeg 在 android 中进行视频编辑。我可以使用以下命令修剪、裁剪和添加叠加层:

修剪:

command = new String[]{"-i",inputVideoFilePath,"-ss","00:00:30.0","-c","copy","-t","00:00:10.0",outputVideoFilePath};

对于裁剪:

command = new String[]{"-i",inputVideoFilePath,"-preset", "ultrafast","-filter:v","crop=400:400:0:0","-c:a","copy", outputVideoFilePath};

对于覆盖:

command = new String[]{"-i",inputVideoFilePath, "-i",overlayImagePath,"-preset", "ultrafast","-filter_complex", "overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2", "-codec:a", "copy", outputVideoFilePath};

但我无法将这些命令合并为一个命令。请帮我。

最佳答案

使用

command = new String[]{"-ss", "00:00:30.0", "-t", "00:00:10.0", "-i",inputVideoFilePath, 
"-i",overlayImagePath, "-filter_complex",
"[0]crop=400:400:0:0[a];[a][1]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2",
"-preset", "ultrafast", "-codec:a", "copy", outputVideoFilePath};

filter_complex 允许对不同输入串联或并联执行多个过滤操作。

关于android - 如何使用 FFmpeg 在单个命令中修剪、裁剪和添加叠加层,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36962963/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com