ffmpeg: Cut out a part of a video


Following is a snippet we used to remove a few seconds from a video using ffmpeg

ffmpeg -i 'input.mkv' -filter_complex \
  "[0:v]trim=end=553,setpts=N/FRAME_RATE/TB[v0]; \
   [0:a]atrim=end=553,asetpts=N/SR/TB[a0]; \
   [0:v]trim=start=559,setpts=N/FRAME_RATE/TB[v1]; \
   [0:a]atrim=start=559,asetpts=N/SR/TB[a1]; \
   [v0][a0][v1][a1]concat=n=2:v=1:a=1[v][a]" \
  -map "[v]" -map "[a]" 'output.mkv'

Specifically, we removed the seconds 09:13 (second 553) to 09:19 (second 559).

This post is also available in: Greek

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.