Here is a Linux audio MP3 puzzle that has been bugging me for awhile:

How to trim the beginning few seconds off an MP3 audio file? (I can't get ffmpeg -ss to work with either 00:01 or 1.000 format)

So far, to do what I want, I resort doing it in a GUI manner which is maybe slower for a single file, and definitely slower for a batch of files.

  • 1
    An update. Later, I stumbled upon the fact that ffmpeg is very picky about the --ss time format, and I was able to most easily trim off the first 9 seconds for instance by specifying -ss 00:00:09 (note that it needs all 3 numbers in hh:mm:ss format) The version I was using may be old... FFmpeg version SVN-r18709, Copyright (c) 2000-2009 Fabrice Bellard, et al. Jun 29, 2012 at 6:02

3 Answers 3


For editing mp3's under linux, I'd recommend sox. It has a simple to use trim effect that will do what you ask for (see man sox for datails - search (press/) for "trim start"). Example:

sox input.mp3 output.mp3 trim 1 5

You didn't mention it, but if your aim is just to remove the silence at the beginning of files, you will find silence effect much more useful (man sox, search for "above-periods")

  • 1
    Thanks, awesome: it worked. I ended up using the trim for simplicity. The only downer was sox FAIL formats: can't open output file 'blah.mp3': SoX was compiled without MP3 encoding support --so, re-enter ffmpeg :/ Aug 5, 2011 at 19:27
  • That seems unusual. On my computer, it works without a problem with mp3s. It is a matter of build-time configuration. How did you install it? Aug 5, 2011 at 23:03
  • @rozcietrzewiacz, if you install sox from a distribution repository you will most likely get sox without MP3 support (because of license issues). For example on Fedora 17: no handler for file extension mp3 Jun 10, 2013 at 13:36
  • 1
    I'm having a hard time understanding how to compile sox with mp3 support. No FAQ, no google, nothing. And the question was about trimming using ffmpeg... Oct 22, 2020 at 18:46

You could try using mp3splt, which can split MP3 and Ogg files and has the advantage that it does not re-encode the file, thereby avoiding quality loss.

  • 2
    I like it; thanks. It is simple, and yet has plenty of options... For example: here is the command I just used, which adds the split times to the filename: mp3splt "$file" 4.12 27.55.7 ... It allows custom output name formatting and multiple split points.
    – Peter.O
    Dec 20, 2011 at 8:05

Make sure that your time specifications start with hours.

To cite the ffmpeg man page:

position may be either in seconds or in "hh:mm:ss[.xxx]" form

That means that when you choose the 2nd syntax only the .xxx part is optional. Else ffmpeg might mis-parse it as seconds.

Same goes for duration:

duration may be a number in seconds, or in "hh:mm:ss[.xxx]"

Another pitfall is the ordering of ffmpeg arguments (e.g. the -ss/-t options for an input file have to come before the -i option).


$ wget http://traffic.libsyn.com/twiv/TWiV179.mp3
$ ffmpeg -ss 1:05:59.3 -t 00:02:03.9 -i TWiV179.mp3 -acodec copy \

With the specification -ss 1:05:59.3 -t 2:03.9 you would get a different result (i.e. a 2 second long piece).

(Tested on Fedora 17 with ffmpeg version 0.10.7.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .