Cut multiple parts of a video with ffmpeg

后端 未结 1 1516
無奈伤痛
無奈伤痛 2021-02-04 03:25

In what I\'m trying to do, I need to remove some parts of a video file, and create a new one from that.

For example, from a video file like this:

<
相关标签:
1条回答
  • 2021-02-04 03:38

    The select filter is better for this.

    ffmpeg -i video \
           -vf "select='between(t,4,6.5)+between(t,17,26)+between(t,74,91)',
                setpts=N/FRAME_RATE/TB" \
           -af "aselect='between(t,4,6.5)+between(t,17,26)+between(t,74,91)',
                asetpts=N/SR/TB" out.mp4
    

    select and its counterpart filter is applied to the video and audio respectively. Segments selected are times 4 to 6.5 seconds, 17 to 26 seconds and finally 74 to 91 seconds. The timestamps are made continuous with the setpts and its counterpart filter..

    0 讨论(0)
提交回复
热议问题