MacOS – n easy way on a Mac to split an audio file at defined intervals

audioautomationmacos

I have a 45 minute long audio (.m4a) file.

I would like to split this audio file into a separate audio file every 2 minutes.

So, that:

AudioFile1.m4a is created from [00:00] to [02:00] of
originalAudioFile.m4a.

AudioFile2.m4a is created from [02:00] to [04:00] of
originalAudioFile.m4a.

AudioFile3.m4a is created from [04:00] to [06:00] of
originalAudioFile.m4a.

and this is continued until

AudioFile23.m4a is created from [44:00] to [45:00] of
originalAudioFile.m4a.

Here are additional details:

  • I am not particular about the filenames of the resulting files.

  • I am not particular about the file types of the resulting files (e.g., whether they become .mp3 files or stay .m4a files).

  • This is not a situation where the resulting audio files will be mastered to a CD or something. I'm just looking for a quick and handy way to split an audio file based on a specific interval. A minor loss in audio quality is not a big deal (but this would obviously not be preferred).

  • I do not want the originalAudioFile.m4a to be altered in the process.

The most important condition is that the method requires minimal time and effort from the user.

There are various methods to accomplish what I want in Microsoft Windows, but can this be done on a Mac?

Best Answer

Use ffmpeg. It's available via Homebrew and MacPorts, but I just prefer to use the prebuilt binaries

Just off the top of my head, you could do something simple like:

$ ffmpeg -i source_audio_file.mp3 -ss 0 -t 120 segment_1.mp3
$ ffmpeg -i source_audio_file.mp3 -ss 120 -t 240 segment_2.mp3
$ ffmpeg -i source_audio_file.mp3 -ss 240 -t 360 segment_3.mp3
.
.
.

To put this into a script wouldn't be too hard