Every so often I have an audio file that I need to break into sections. With more files coming as .m4a, the various GUI options I’d used before no longer work.
Now I’ve found a method that doesn’t need a GUI – use command line ffmpeg to split these files. The basics I found from a superuser question that was automatically breaking a file into smaller pieces. Taking out the Ruby sections, here’s the useful snippet.
ffmpeg -ss 1:01:42 -i c:\Data\temp\in.m4a -vn -c copy -t 1:00:00 out.m4a
- The first time (1:01:42) is the start time of the cut.
- -vn means that only the audio stream is copied from the file.
- The second time (1:00:00) is the duration of the cut. It can be longer then the length of the whole file.
Note that the cut is made at the nearest point to that time that the stream allows, so it might be a little out.
For FLAC change to “-c flac”.