Splitting/cutting an m4a or FLAC file

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

  1. The first time (1:01:42) is the start time of the cut.
  2. -vn means that only the audio stream is copied from the file.
  3. 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”.

3 thoughts on “Splitting/cutting an m4a or FLAC file

  1. cicelywaspen

    Thanks for this – it works! That maybe doesn’t surprise you, but after weeks of fiddling with other bits of copied code, trying to fathom what the handbrake ap is intended to do, and baffling error messages in the terminal window, I’m now giddy with file-splitting joy. So, cheers 🙂

    Reply

Leave a Reply to cicelywaspen Cancel reply