Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have several long audio files (80 minutes each; m4a) and want them split into 5- or 10-minute pieces.

I see many questions for splitting an audio file at extended pauses, tones, etc. but can't seem to find one regarding this simple operation. Does anyone know a simple way to do this?

Of course, something automatic, and command-line is okay—even preferred.

Thanks in advance!

share|improve this question

3 Answers 3

up vote 5 down vote accepted

Here's a one-liner, you just need Ruby and FFmpeg installed:

ruby -e '(0..4500).step(300) { |x| system "ffmpeg -ss #{x} -i in.m4a -c copy -t 300 out-#{x}.m4a"}'

Simply execute that in the same folder where in.m4a is. It'll copy the audio bitstream, so executing this will probably take less than a few seconds.

To explain:

  • 4800 seconds is the length of the audio file (80 minutes × 60 seconds), so our last split is at 4500 (4800 - 300 seconds).
  • We go from 0 to 4500, and we split every 300 seconds (5min × 60s).
  • FFmpeg will start at the time specified by -ss
  • And it'll copy for the time specified by -t
  • It'll write several output files called out-<x>.mp4, where <x> is the start time in seconds.
share|improve this answer
Thanks! Is your command for UNIX, or does it work on Windows too? I have a Cygwin installation, so it shouldn't matter, but just wondering. I'll try it when I get home. –  Andrew Cheong Dec 28 '12 at 14:54
This natively works on Linux (and Unixes that have Ruby installed), and it should also work on Windows – you simply need Ruby and FFmpeg, but you won't need Cygwin for that. There's Ruby Installer and FFmpeg executables for Windows as well. Now, the FFmpeg command could be automated without Ruby, using Windows batch files, or PowerShell, but I'm not a Windows user, so that's why I took Ruby (because it comes with Linux and OS X). Maybe someone with Windows batch experience can rewrite the Ruby command above? –  slhck Dec 28 '12 at 15:03
I have Cygwin because I can't get used to the Windows command-line. I think I already have ruby and ffmpeg installed there, so I should be able to use your command. But yes, a Windows version might help someone else viewing this question. +1 for now; will accept when I try it. –  Andrew Cheong Dec 28 '12 at 15:35
If, like me, your m4a file includes a video stream (in my case, a single image) then you need to add the -vn switch to select just the audio stream. If you want to keep the video stream you'll need to output to a file with an .mp4 extension. –  Rob Church Feb 1 '14 at 20:52

I was looking for a solution for this myself. The easiest way I found to do this is via MP4Box:

mp4box -split 300 infile.m4a

Where "300" is the time in seconds. MP4Box will automatically write numbered output files.

(You don't need to install the whole big GPAC application. These are the files you can extract from the archive for it to work: js.dll; libeay32.dll; libgpac.dll; MP4Box.exe; ssleay32.dll)

share|improve this answer

Download Audacity - It's a free audio tool that can do exactly what you need, and it's totally free and easy to use. http://audacity.sourceforge.net/

share|improve this answer
Is there a way to make Audacity do this automatically? I wouldn't want to manually chop multiple files into 16 pieces each by selecting 5-minute pieces with my mouse, cut them, go to the menu, save the files, et cetera. –  slhck Dec 28 '12 at 14:41
I already have Audacity, so if there is an automatic way, please let me know! –  Andrew Cheong Dec 28 '12 at 14:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.