ARuiz
ARuiz

Reputation: 41

Splitting m4a into multiple files with ffmpeg

I have an audio file (.m4a) and want to split it into smaller pieces using ffmpeg. All answers I have seen do something along one of the following two possibilities:

  1. ffmpeg -i inputFile -map 0 -f segment -segment_time 60 -c copy "$output%03d.m4a

or

  1. ffmpeg -i inputFile -acodec copy -ss start_time -to end_time outputFile

With 1. the first file is fine. From the second file on, I just get a minute of silence in quicktime, and in VLC the file plays but the timing is odd: for example the second file should have second 0 equals to second 60 in the original file. However in vlc it starts playing on second 60 and goes on to second 120.

With 2. I have to set start times and end for each file, unfortunately I notice a small jump when I play one after the other, so it seems as if some miliseconds are lost.

There are definitely a few old questions asked around this, but none of them actually helped me with this.

Upvotes: 4

Views: 4012

Answers (1)

Gyan
Gyan

Reputation: 93309

Quicktime probably doesn't like files starting with a timestamp other than 0.

Use

ffmpeg -i inputFile -map 0 -f segment -segment_time 60 -reset_timestamps 1 -c copy "$output%03d.m4a

Upvotes: 7

Related Questions