【问题标题】:FFmpeg remove 2 sec from middle of video and concat the parts. Single line solutionFFmpeg 从视频中间删除 2 秒并连接部分。单线解决方案
【发布时间】:2019-01-14 21:00:01
【问题描述】:

我有一个 22 秒长的视频文件。
我想将段从 10 秒删除到 12 秒。
然后返回 1-10 秒和 12-22 秒的拼接视频文件。

我想在单个 FFmpeg 命令中执行此操作。

这个方法很简单

来源 https://www.labnol.org/internet/useful-ffmpeg-commands/28490/

ffmpeg -i input.mp4 -ss 00:00:00.0 -codec copy -t 10 output_1.mp4

ffmpeg -i input.mp4 -ss 00:00:12.0 -codec copy -t 10 output_2.mp4

然后创建一个包含所有源文件名的输入文件并运行

ffmpeg -f concat -i file-list.txt -c copy output.mp4



但我正在寻找单线解决方案

任何帮助将不胜感激。

【问题讨论】:

    标签: ffmpeg concatenation


    【解决方案1】:

    要进行精确修剪,您必须重新编码

    使用

    ffmpeg -i input.mp4 -vf select='not(between(t,10,12))',setpts=N/FRAME_RATE/TB -af aselect='not(between(t,10,12))',asetpts=N/SR/TB out.mp4
    

    【讨论】:

    • 太棒了。谢谢!
    猜你喜欢
    • 2015-01-15
    • 2016-09-24
    • 2013-04-06
    • 2019-01-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多