【问题标题】:How to trim, crop and add overlay in a single command using FFmpeg如何使用 FFmpeg 在单个命令中修剪、裁剪和添加叠加层
【发布时间】:2016-08-26 01:38:39
【问题描述】:

我正在使用 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};

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

【问题讨论】:

    标签: android video ffmpeg video-editing


    【解决方案1】:

    使用

    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 允许对不同的输入串行或并行执行多个过滤操作。

    【讨论】:

    • 感谢帮助。我会试试这个。
    • 工作完美,顺便说一句,有什么办法可以减少处理时间。
    猜你喜欢
    • 1970-01-01
    • 2022-11-20
    • 1970-01-01
    • 1970-01-01
    • 2011-08-13
    • 1970-01-01
    • 2019-11-17
    • 2020-06-16
    • 1970-01-01
    相关资源
    最近更新 更多