【问题标题】:remove a subpart from the middle of a video从视频中间删除一个子部分
【发布时间】:2020-03-23 00:48:30
【问题描述】:

我正在尝试使用 FFMPEG 从视频中删除 2 到 3 秒的中间部分。使视频在 2 到 3 秒之间播放开头和结尾但没有中间部分。

这个页面有点帮助 https://superuser.com/questions/681885/how-can-i-remove-multiple-segments-from-a-video-using-ffmpeg

我的代码如下:-

ffmpeg -i input.mp4 -filter_complex "[0:v]trim=start=2:end=3,setpts=PTS-STARTPTS, concat[out1]" - map [out1] output_without_2_to_3_secs.mp4

但是使用此代码我收到以下错误消息

在过滤器 Parsed_concat_2 上找不到未标记输入板 1 的匹配流。我使用的是 Mac。

非常感谢任何建议

【问题讨论】:

    标签: shell ffmpeg


    【解决方案1】:

    您需要提取 start-2 和 3-end,然后将它们连接起来。

    ffmpeg -i input.mp4 -filter_complex '
        [0:v] trim=duration=2 [p1];
        [0:v] trim=start=3, setpts=PTS-STARTPTS [p2];
        [p1][p2] concat
    ' output.mp4
    

    【讨论】:

    • 谢谢,这段代码有效。但是,它也会在视频结尾留下 1 秒的黑色。我想这与我修剪的 1 秒有关吗?有没有办法在最后修剪 1 秒的黑度?
    • @OneWorld 如果input.mp4 有一个音频流,你也需要修剪它。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-01
    相关资源
    最近更新 更多