(FFmpeg) How to trim ‘x’ seconds from the end of an audio track?

Note: Trimming at this point should be easily understood but for a refresher refer to answers in How to trim ‘x’ seconds from the start of an audio track?

Trimming a couple of seconds off the end of a track is easy but again requires a different thinking of how time works in FFMPEG. Like trimming from the start of an audio track, trimming from the end of a track uses the argument -t or duration with no seeking.

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

  $ ffmpeg -t 00:00:50 -i input.mp3 -async 1 output.mp3   

By setting a smaller time than the actual audio duration, FFMPEG will automatically trim the audio. Now the benefit of manually setting the duration instead of FFMPEG automatically handling it is understandable.

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