(FFmpeg) How to Trim ‘x’ Seconds From the End of a Video?

Trimming a couple of seconds, minutes or hours off the end of a video is easy but again requires a different understanding of time in FFmpeg. Trimming from the end of an MP4 uses the argument -t or duration with no seeking.

Tip: The duration must be set before the input else FFmpeg applies the duration to the final output.

In this example, the input file is 5 minutes long with the requirement of 1 minute removed from the end:


 $ ffmpeg -t 00:04:00 -i input.mp4 -async 1 output.mp4  

By setting a smaller time than the actual video duration, FFmpeg automatically trims the video length (5 minutes – 1 minute = 4 minutes). Now the benefit of manually setting the duration instead of FFmpeg automatically handling it is obvious.

Love FFmpeg? Grab a copy of FFmpeg For Beginners on Kindle or Paperback to learn over 120 ways to master FFmpeg!

buy now on amazon

Trackbacks & Pingbacks 1

  1. From (FFmpeg) How to Trim ‘x’ Seconds From the Start and End of a Video? - John Riselvato on 17 Apr 2020 at 1:03 pm

    […] last two questions covered trimming the start of a video and trimming the end of a video, but what does […]