How to cut audio file with avconv?

Solution 1:

I think the original problem was with the formatting of your time stamp.

The format is HH:MM:SS

I am not sure I am understanding your question about the order of the options. I do not think it matters as long as -i is followed by the input file name and -ss HH:MM:SS followed my -t HH:MM:SS

The -ss HH:MM:SS is the starting point, and -t HH:MM:SS is the duration

so -ss 00:01:00 -t 00:05:00 would start at the one minute mark and run for 5 minutes.

On my system, using ffmpeg, order does not matter (you can specify time or input file in any order so long as -ss is followed by the duration (-t) )

Solution 2:

The problem comes from the different meaning of -ss depending upon where in the command line it is. It's a carry over from the days when avconv was still a part of ffmpeg project, and i believe it is being fixed in the newer versions.

In the olden days if you said something like

 ffmpeg -ss 5 -i input

What you meant was "skip to the 5 second mark in the file and begin to read there".

But if you said

ffmpeg -i input -ss 5

You meant "open the input file and skip all the data until the five second mark".

As you can understand the first approach will actually fail quite often, because you are skipping in the file without reading it. It works well only on the files which have timestamps in them, allowing you to read the frame and know if you've gone too far already or not.

Basically the way it worked in ffmpeg was "Guess the bitrate by the first second, and then assume that all other seconds are the same". But, of course, not all the seconds are the same, and if we are talking about a 52 hours of "drift" the error can be quite large.

So if you are using the early post-split version of avconv you should always put -ss after the file that is being read. But in the newer versions (to the best of my knowledge) this bug was fixed.