Is there an easy way to split mp3 files?

33

12

I recently learned a neat trick. To join mp3 files together, you simply use the command (in Windows)

copy /b *.mp3 joined.mp3

and voila, you have one large mp3 file.

My question: is there a method of doing the opposite, i.e. splitting an mp3 file, this easily?

Yuval

Posted 2009-07-16T11:39:26.037

Reputation: 2 022

You should tag this for Windows – Mark Thalman – 2009-07-28T19:22:45.787

1Not necessarily... the command-line join example I gave should work just as well in other systems. Plus, the question is for a command-line splitter for any OS. – Yuval – 2009-07-29T13:40:19.530

Yuval, the answer you accepted will cause your MP3 to be decoded and reencoded. This will really reduce your audio quality. Check out my answer on MP3DirectCut. – Jim McKeeth – 2009-08-01T01:37:26.320

Also, your joining method will result in a bad frame in the middle of the audio from the header and tail (where the tags are) remaining. It would be better to use a joining tool that removes these bad frames. – Jim McKeeth – 2009-08-01T01:38:14.290

Jim, I thank you for the concern about the audio quality, but I mainly use splitting and joining MP3s for listening to audiobooks more conveniently, and these are hardly high-quality to begin with... – Yuval – 2009-08-01T07:49:48.843

Using FFMPEG as I added below – Shai Alon – 2018-04-02T09:24:58.877

Answers

28

There are two ways to split an MP3:

  1. Decoding into a wave, splitting, and re-encoding. This is the method Audacity uses and results in lost audio quality.
  2. Splitting the MP3 directly. You have a lower resolution for where to split, but the result is no loss in audio quality. I've used MP3DirectCut with relatively good success.

Usually you will want to use the 2nd method since it is lossless, unless you really don't care about your audio quality.

Jim McKeeth

Posted 2009-07-16T11:39:26.037

Reputation: 4 907

1Thanks Jim. I was not aware of this as well. I had been using Audacity for a while now, it is now going to be MP3Direct from now on. – Kanini – 2009-10-21T03:11:24.850

I'm very fond of mp3DirectCut. All it does is split up mp3 files, and it's pretty good at it. – Michael Kohne – 2009-07-22T18:49:39.453

I wasn't aware of this... 10x for the info! – Yuval – 2009-07-22T21:10:28.320

38

I regularly use mp3splt. It is an open source program for Windows and Linux, and includes a gui (which I don't use, so I can't comment on it).

This is the commandline I usually use to split a podcast into 6 minute segments:

mp3splt podcast.mp3 -g %[@N=0,@o] -o "@n @f" -t 6.0
  • -t 6.0: split every 6 minutes
  • -g %[@N=0,@o]: for every section use the original tags, but update the track number starting from 0.
  • -o "@n @f": The output file name should be the original filename with the track number tacked on in front.

Nathan Fellman

Posted 2009-07-16T11:39:26.037

Reputation: 8 152

2i am using the same for my audiobooks on car radios that dont remember position very well. i recommend using "-f" which they say is necessary for vbr and i experienced as more error tolerant. also i add "-O 0.3" for a 3 second overlap in case the split happens in the middle of a word. – peter – 2014-11-19T09:03:29.733

this tool was perfect for cutting MP3's for use in HTTP streaming. quicktime wasn't liking the m3u8's populated by mp3's cut by ffmpeg, but mp3splt worked perfectly.

It cut up each part automatically too! Command line is a bonus win.

Thanks for posting this!! – brack – 2010-06-24T16:06:54.367

Great, fastest way I could find! – ImtiazeA – 2018-09-22T06:12:23.340

crashes in windows 8.1 – Scott Anderson – 2013-11-09T23:01:06.760

1

@ScottAnderson: May I recommend filing a bug on their website? http://sourceforge.net/p/mp3splt/bugs/

– Nathan Fellman – 2013-11-10T08:12:25.437

8

It's not as easy as the command you mention in your question. With that being said there are easy ways to do it.

Audacity is one free program that allows you to split mp3s. It's relatively easy to use once you get a hang of the interface.

scheibk

Posted 2009-07-16T11:39:26.037

Reputation: 1 198

3Audacity is good and the Beta version 1.3.x even easier to use. I suggest to start directly with that version – Drake – 2009-07-16T11:55:51.067

3FYI, while Audacity is a great tool, splitting MP3's this way involves decoding and re-encoding the MP3. This degrades the audio quality. – Jim McKeeth – 2009-07-22T18:36:44.273

6

Try MP3DirectCut. It's free and works for me.

Umber Ferrule

Posted 2009-07-16T11:39:26.037

Reputation: 3 149

2

If you happen to be using Linux you can always use "split --bytes=1M --numeric-suffixes largefile.mp3 smallfile". However, you will have to append the .mp3 yourself unfortunately.

Richie Marquez

Posted 2009-07-16T11:39:26.037

Reputation: 1 393

2

For the record, that's not the best way to merge MP3s.

It works, but it leaves superfluous information (the ID3 tags) from the subsequent files in the final file. Copy, when used that way, is just a concatenate - the extra header information is still in there.

The structure of an MP3 file can give you an idea:

enter image description here

(Click to zoom)

Tom Ritter

Posted 2009-07-16T11:39:26.037

Reputation: 966

Nice, but the question was not about merge, but about split. – Shai Alon – 2018-04-02T09:25:45.830

1

This is very interesting, but it doesn't answer the question. It might be more relevant here: http://superuser.com/questions/202809/join-multiple-mp3-files-lossless

– Nathan Fellman – 2013-11-10T08:16:25.507

If the tags are a concern, you can remove all tags first, but then you'll have to add them back in afterwards. – Mr Lister – 2014-03-18T09:34:39.930

2

Specialized MP3 splitters, like mp3DirectCut, cut on frame boundaries. But most MP3s use the bit reservoir to conserve space; a frame's audio data often starts in a prior frame, sometimes 2 or 3 frames back. Thus the frames near the split points are likely unplayable and are silently skipped. If the split occurs in the middle of silence, it's probably of no concern.

If the split occurs in the middle of continuous music, you might notice the skipped frames. To help mitigate this, use mp3packer to expand the mp3 to 320 kbps with minimal bit reservoir usage (-b 320 -r in.mp3 temp.mp3), make your edits in mp3DirectCut, then use mp3packer again to repack (-s -t -z temp.mp3 out.mp3). It's not guaranteed to work because bit reservoir usage might be unavoidable in a high-bitrate file, but it can help, and doesn't result in quality loss.

Alternatively, you can use pcutmp3 to do the split. It preserves the necessary frames and adds gapless playback data (encoder delay & padding info) to a LAME tag at the beginning of the file. Players which support this data will trim the extra samples upon playback.

Mike Brown

Posted 2009-07-16T11:39:26.037

Reputation: 642

Very smart explanation, and technical. Nice! – Daniel Mošmondor – 2018-07-31T09:59:45.560

1

Excellent online tool: http://magicode.me/mp3-cut

Advantages:

  • Extremely Fast!
  • Splitting the original MP3 directly (Not Decoding & re-encoding) - so any los quality.
  • All processing is in client-side.

video: https://www.youtube.com/watch?v=Qmb6BNg6IhM

dovid

Posted 2009-07-16T11:39:26.037

Reputation: 83

1

Use FFMPEG to do so (https://unix.stackexchange.com/questions/280767/how-do-i-split-an-audio-file-into-multiple), with the parameters:

ffmpeg -i LongFile.mp3 -f segment -segment_time 10 -c copy ShortFile_%03d.mp3

This will split the mp3 file into 10 minutes files with names ShortFile_000.mp3, ShoetFile_001.mp3, etc.

Shai Alon

Posted 2009-07-16T11:39:26.037

Reputation: 111

1

Not that easily, but there are a number of mp3 splitting tools available online that allow you to pick where to split an mp3 file.

Of course if you wanted to split up an mp3 file just to transfer it (and not to play back the split portions), you could use a generic file splitting utility and then the binary copy method you've used to reassemble the mp3.

Sliff

Posted 2009-07-16T11:39:26.037

Reputation: 1 297

Back in the day I used to use arj (http://www.arjsoftware.com/) to split files to chunks of 1.44MB to fit on floppies. I see it's still around. WinRAR (http://www.rarlab.com/) can do the same. Heck, even good ole' pkzip 2.04g (http://www.pkware.com) added support for that, though it was a lot less convenient than arj

– Nathan Fellman – 2009-08-01T03:41:05.150

Is there one you can recommend? Do you know one that is free? – Yuval – 2009-07-16T11:45:46.020

0

Sliff is right, no os tool available.

Technically mp3 is configured such that you can split at any place you want. It uses 18 ms block of static or variable length with a certain bit combination at the beginning of each block. If you split the file in midst of a block, the player is just going to forward silently to the next block and you therefore lose a max of 18 ms.

Tag blocks - where you enter information about artist, title, album and such, can be at any place in the file or be ommitted. Even multiple tag blocks do not harm (the first is taken).

You can therefore split and join wherever you want.

Any tool to split files would do then.

malach

Posted 2009-07-16T11:39:26.037

Reputation:

Tags in the middle of a file are likely to be ignored. Also, since most MP3s utilize the bit reservoir, frame boundaries don't line up with audio data start points. So if you split on frame boundaries, as all specialized MP3 splitters do, you may make some frames adjacent to the split point unplayable, same as if you cut in the middle of a frame. Probably not noticeable if the cut is made in the middle of silence, but if there's continuous sound across the edit point, the seam may audible. – Mike Brown – 2013-01-25T15:18:45.263