How do I split an MP3 file without re-encoding it?
I have a 400 MB MP3 file at 96 kbps, taken from a CD. I want to split this into many files.
Is there any way to do that without affecting the quality of audio, or maybe without re-encoding the file?
Solution 1:
There is a program called mp3splt - I specify start and end time of the part I am interested in. It is also possible to split automatically with silence detection.
Solution 2:
You didn't specify an OS.
General-purpose audio editors decode MP3s and then re-encode upon saving, so avoid those.
Dedicated MP3 splitters usually slice on frame boundaries, thus the audio is not being decoded and re-encoded, which is good. However there's a penalty: a split-second of audio around the split points often becomes unplayable, sometimes resulting in a skip or click if the audio there isn't silent. This is due to complications related to various features and side-effects of MP3 encoding and decoding (the bit reservoir, encoder delay, padding, and decoder delay). But as long as the split points are in the middle of silence and you're not terribly concerned about losing a fractional second of that silence, then I second the recommendation for mp3DirectCut, a Windows app. It's robust and free, and it has a nice graphical view of the volume level of each frame (you might need to play with the scale a bit), which although is not a true view of the decoded waveform, is usually good enough for the purpose of spotting ideal places to cut.
If you're super concerned about accuracy, then you'll want to use the Java command-line app pcutmp3, which is so far the only tool I know of which works around these issues. The caveat is that you'll need to make sure you use a player which supports "gapless playback" (encoder delay & padding) info as written in a LAME tag.
Both pcutmp3 and mp3DirectCut support the use of cue sheets for specifying split points. So if you have the original CD, you can use a CD ripping program to generate a .cue file for the audio file. This cue sheet is a text file which will contain, among other things, precise track boundaries which the splitter can use. If you don't have the original CD, you might be able to generate a cue sheet via the website cuesheet heaven, which re-interprets freedb data. Such a .cue made without the original CD may not be accurate (if you choose the wrong pressing) and almost certainly will be incomplete (in that it only has track boundaries, none of the other things that go in cue sheets), but it should be fine for your purposes.
Solution 3:
The standard tool to do this not just for mp3 but for lots of audio and even video formats is ffmpeg:
ffmpeg -i in.opus -ss 00:00:30.0 -t 00:03:00 -c copy out.opus
Would take a 3 minute piece of in.opus
starting at 30 seconds and put it into out.opus
without transcoding (-c copy
). Take note that while this will keep some Metainformation (title, artist, etc.), some other (e.g. lyrics) will be lost. For more information see its manpage, for example about -c
:
-c[:stream_specifier] codec (input/output,per-stream)
-codec[:stream_specifier] codec (input/output,per-stream)
Select an encoder (when used before an output file) or a
decoder (when used before an input file) for one or more
streams. codec is the name of a decoder/encoder or a special
value "copy" (output only) to indicate that the stream is
not to be re-encoded.
For example
ffmpeg -i INPUT -map 0 -c:v libx264 -c:a copy OUTPUT
encodes all video streams with libx264 and copies all audio
streams.
For each stream, the last matching "c" option is applied, so
ffmpeg -i INPUT -map 0 -c copy -c:v:1 libx264 -c:a:137 libvorbis OUTPUT
will copy all the streams except the second video, which will
be encoded with libx264, and the 138th audio, which will be
encoded with libvorbis.
Caveats from @Mike Brown's answer do apply.