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

Here we’ll use an input file with a 1 minute duration with a 5 second introduction of silence. To remove that silence, it’s important to identify these two numbers because trimming requires tricky subtraction. Let’s look at the example below:

$ ffmpeg -ss 00:00:10 -i input.mp3 -t 00:01:00 -async 1 output.mp3   

-ss is used to seek to a part in the audio and -t is the duration of the playback. So 1 minute duration audio subtracted by 10 seconds seeking results in the first 10 seconds being removed.

A major setback with trimming is manually setting the audio duration value. Luckily, FFMPEG has a tool called ffprobe which can be used to give you exact duration:

$ ffprobe -i input.mp3 -show_entries format=duration -v quiet -of csv="p=0" -sexagesimal

Note: “How to Use FFMPEG in bash Language?” for ideas on how to use this output as a variable and dynamically set -t the advanced FFMPEG programming.

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 2

  1. From How to trim ‘x’ seconds from the end of an audio track? - John Riselvato on 04 Apr 2020 at 4:03 am

    […] 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?.  […]

  2. From (FFMPEG) How to trim ‘x’ seconds from start and end of an audio track? - John Riselvato on 04 Apr 2020 at 4:07 am

    […] last two questions covered trimming the start of an audio track and trimming the end, but what does the command look […]