[FFmpeg-user] Removing part of a video

Cecil Westerhof Cecil at decebal.nl
Fri Nov 12 15:03:44 EET 2021


I need to cut a part out of a video. (A certain speaker does not want
to be published.)
Searching on the internet I found this:
    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).

Is this the correct way to do it (after setting the correct
timestamps), or is there a better way?

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof


More information about the ffmpeg-user mailing list