4

I'm trying to split an audio file as follows:

ffmpeg -i file.mp3 -vn -acodec copy -ss 00:00:00 -t 00:03:21 01-track1.mp3
ffmpeg -i file.mp3 -vn -acodec copy -ss 00:03:21 -t 00:08:26 02-track2.mp3
ffmpeg -i file.mp3 -vn -acodec copy -ss 00:08:26 -t 00:10:45 03-track3.mp3

That seems to work but I noticed that the starttime is not correct. So now I have files like this:

track1.mp3: 00:03:21
track2.mp3: 00:08:25
track3.mp3: 00:10:44

The endtime is correct but it always start from the beginning of the audio file instead of the place it should start

1
  • 1
    In case it helps ... From my old notes: 1: -ss is the start point in hh:mm:ss from the beginning of the video file. 2: -t is the length of time in hh:mm:ss of the segment. In other words, a thirty second segment is being processed. -t is not needed if the segment extends to the end of the video.
    – DK Bose
    Oct 12, 2018 at 13:29

1 Answer 1

3

Thanks to the comment of @DK Bose, I got it working:

Instead of using ffmpeg -i file.mp3 -vn -acodec copy -ss 00:03:21 -t 00:08:26 02-track2.mp3

I needed to say what the duration of the file must be. So from 00:03:21 to 00:08:26 is 00:05:05 minutes and the command should look like ffmpeg -i file.mp3 -vn -acodec copy -ss 00:03:21 -t 00:05:05 02-track2.mp3

Then I get an audio file with the duration of 05:05 minutes.

Another possibility (with recent ffmpeg versions) is using the -to parameter like this: ffmpeg -i file.mp3 -vn -acodec copy -ss 00:03:21 -to 00:08:26 02-track2.mp3

You must log in to answer this question.

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