Help - Search - Members - Calendar
Full Version: direct editing of MP3 audio
Hydrogenaudio Forums > Lossy Audio Compression > MP3 > MP3 - General
Heapug
I don't know how MP3 describes starts, ends and lengths of it's internal workings in order to play back correctly; but I'm hoping it is possible to edit an MP3 file in a similar way to editing a WAV file.

I'd like to be able to at least shorten an MP3 file from either end, and hopefully to be able to cut, paste and even perhaps xfade, without changing the data that remains for the audio I want to keep.

Clearly the data has to be changed at the point of a xfade and perhaps at the very start and end of a section that is removed, but I'd like to ensure that the audio is not effecively decoded and encoded again where this is not necessary.

Can anyone recommend a (preferably costless...) application for doing this? Or might it even be possible in this wonderful Foobar thing that everyone is so enthusiastic about...?
Klyith
QUOTE(Heapug @ Oct 14 2006, 19:26) *
I don't know how MP3 describes starts, ends and lengths of it's internal workings in order to play back correctly; but I'm hoping it is possible to edit an MP3 file in a similar way to editing a WAV file.
Not even close. Because of how mp3 files encode sound data, almost no manipulation of the actual sound is possible. The most you can do is make cuts and sometimes joins. The joins can never be gapless. It's also possible to manipulate the gain associated with each frame to make a volume change like a fade.

Most people who want to do stuff like this either re-encode or wrap the mp3s inside some type of container file.

QUOTE
I'd like to be able to at least shorten an MP3 file from either end, and hopefully to be able to cut, paste and even perhaps xfade, without changing the data that remains for the audio I want to keep.

Clearly the data has to be changed at the point of a xfade and perhaps at the very start and end of a section that is removed, but I'd like to ensure that the audio is not effecively decoded and encoded again where this is not necessary.

Can anyone recommend a (preferably costless...) application for doing this? Or might it even be possible in this wonderful Foobar thing that everyone is so enthusiastic about...?
If your mp3s are CBR, you can use mp3directcut to split, join, and do volume changes (including fades) without reencoding. You have to remove tags from the files first, it can't do anything with VBR files, and it still doesn't always work even when you think everything is ok.

As for crossfading, forget about it. One could do cuts from each end of the mp3 files, decode the small cuts to xfade and re-encode, then rejoin the three resulting files. But because you can't join mp3s without a gap, the result would sound horrible.

If your files are VBR, you can use musicutter to cut & join them, but it can't do anything else.
mixminus1
QUOTE(Klyith @ Oct 14 2006, 17:34) *

If your mp3s are CBR, you can use mp3directcut to split, join, and do volume changes (including fades) without reencoding. You have to remove tags from the files first,

blink.gif
QUOTE

it can't do anything with VBR files,

blink.gif
QUOTE

and it still doesn't always work even when you think everything is ok.

blink.gif blink.gif

Have you ever actually used mp3directcut? I've used it on dozens of MP3s encoded (and tagged) with LAME 3.96.1 at V2 and V5 and I've never had a single problem with mp3directcut or any of the files it creates. Of course, you lose the LAME header on the split files (AFAIK, SebastianG's pcutmp3 is the only splitter that can keep gapless information), and every once in awhile you'll end up with an odd total time being reported when the file is played ("Fix MP3 header" in foobar2000 always cures that).

Really, I've never seen anything like the problems you're describing...
Klyith
QUOTE(mixminus1 @ Oct 14 2006, 20:45) *
Have you ever actually used mp3directcut?
Yes. I did a project to make a music mod for a game in which I used mp3directcut as the primary tool. ~100 mp3s merged to 30, 3.5 hours total music. It took a hell of a lot of experimenting and trail and error. And other miscellaneous smaller things, cutting silence from songs, a couple of fade ins / outs, and such to try to fix small annoyances on mp3s I got from places other than cds I own.

QUOTE
I've used it on dozens of MP3s encoded (and tagged) with LAME 3.96.1 at V2 and V5 and I've never had a single problem with mp3directcut or any of the files it creates.
I've had:
problems with tags (id3v1 is fine, id3v2 is unsupported)*
problems with files encoded with non-lame
problems with joining files from different encoders
problems with VBR files (more failures than successes here)
total failures to open or properly work with some files

*I recommended removing all tags above for simplicity and safety.

QUOTE
Of course, you lose the LAME header on the split files (AFAIK, SebastianG's pcutmp3 is the only splitter that can keep gapless information), and every once in awhile you'll end up with an odd total time being reported when the file is played ("Fix MP3 header" in foobar2000 always cures that).
Fix header cures it most of the time, but not always. I had several results that display incorrect times and even stop playing prematurely in foobar, despite fixing headers and rebuilding streams and everything else until I was blue in the face. Fortunately other players like the basic mp3 dshow codec don't have the problem.

QUOTE
Really, I've never seen anything like the problems you're describing...

Maybe you're the one who hasn't used it enough? huh.gif Or you always use it on files you encoded, and haven't encountered the weirdness of other encoders? unsure.gif Or you're just really lucky, or I'm really unlucky? wink.gif I dunno.
mixminus1
QUOTE(Klyith @ Oct 14 2006, 18:59) *

QUOTE(mixminus1 @ Oct 14 2006, 20:45) *
Have you ever actually used mp3directcut?
Yes. I did a project to make a music mod for a game in which I used mp3directcut as the primary tool. ~100 mp3s merged to 30, 3.5 hours total music. It took a hell of a lot of experimenting and trail and error. And other miscellaneous smaller things, cutting silence from songs, a couple of fade ins / outs, and such to try to fix small annoyances on mp3s I got from places other than cds I own.

QUOTE
I've used it on dozens of MP3s encoded (and tagged) with LAME 3.96.1 at V2 and V5 and I've never had a single problem with mp3directcut or any of the files it creates.
I've had:
problems with tags (id3v1 is fine, id3v2 is unsupported)*
problems with files encoded with non-lame
problems with joining files from different encoders
problems with VBR files (more failures than successes here)
total failures to open or properly work with some files

*I recommended removing all tags above for simplicity and safety.

QUOTE
Of course, you lose the LAME header on the split files (AFAIK, SebastianG's pcutmp3 is the only splitter that can keep gapless information), and every once in awhile you'll end up with an odd total time being reported when the file is played ("Fix MP3 header" in foobar2000 always cures that).
Fix header cures it most of the time, but not always. I had several results that display incorrect times and even stop playing prematurely in foobar, despite fixing headers and rebuilding streams and everything else until I was blue in the face. Fortunately other players like the basic mp3 dshow codec don't have the problem.

QUOTE
Really, I've never seen anything like the problems you're describing...

Maybe you're the one who hasn't used it enough? huh.gif Or you always use it on files you encoded, and haven't encountered the weirdness of other encoders? unsure.gif Or you're just really lucky, or I'm really unlucky? wink.gif I dunno.

[Mr. Burns]Qualifications! Excellent![/Mr. Burns]

Thank you for providing specific examples...I guess the moral of the story is: if all your files have been encoded with LAME, it should be smooth sailing. If not...caveat emptor. wink.gif
drumroll57
Reviving this old thread, for the benefit of anyone else who may be wondering about this as I was myself, I needed to do an emergency edit of a podcast for which I did not have access to the source, and music cutter worked just fine, the way I did the edits is by previewing them in a normal editor (in this case Audition), getting the exact in and out points, then translating them to the range needed for music cutter, that is mainly the frames, since Audition is using 0~1000 for its frame range, and music cutter is 30 frames per second.
(example, 300 frames in Audition becomes 10 in music cutter, so 29.13.300 in Audition became 29m 13s 10 in music cutter, hopefully you get the idea)

This really saved the day for my particular project!

Thanks again to those who took the time to post all of this info.

D.
odyssey
I'd recommend mpTrim, but it's not free. It's really powerful, although a little tricky to use. It allows to cut start/end (even analog silence if you specify), and also has the ability to fade in and out - LOSSLESS wink.gif
j7n
Mp3Trim is best if you need batch processing of many files. Otherwise the free MP3DirectCut with pseudo-waveform display is easier to use.

I wouldn't call mp3 fades lossless, nor transparent. They sound noticeably quantized (1.5 dB steps) and cannot be reversed unless you record the adjustment performed upon each frame.
Dynamic
QUOTE(j7n @ Jul 5 2008, 01:53) *

Mp3Trim is best if you need batch processing of many files. Otherwise the free MP3DirectCut with pseudo-waveform display is easier to use.

I wouldn't call mp3 fades lossless, nor transparent. They sound noticeably quantized (1.5 dB steps) and cannot be reversed unless you record the adjustment performed upon each frame.


I'd agree that mp3DirectCut is easy to use. If you're a perfectionist, someone pointed out that using mp3packer to expand the file to 320 kbps CBR can help eliminate bit reservoir so no infomation (or very little) stored in previous frames is lost when you trim the files (pcutmp3 is also suitable). After editing, you can then use mp3packer to repack the exact same payload data to the smallest VBR file possible, making use of bit reservoir as fully as possible.

I haven't noticed quantization in the fades that I've done using mp3DirectCut (but that's a very limited number and probably never on continuous tones) and I would have expected that the lapping transform windows on decoding would naturally provide smoothing between the steps, though of course the smoothed steps still . Perhaps one day I'll ABX an mp3DirectCut fade, decoded to WAV against an identical logarithmic fade done on the decoded WAV.

If it is noticeable, or you wish to cross-fade, it's possible to trim out the fading or crossfading sections, apply the effects in a WAV editor then re-encode (i.e. transcode, preferably at high bitrate) just for that section, though encoder delay and padding could cause more problems re-stitching it to the preceding and following parts of unaltered MP3.
j7n
I did mention this workaround little while ago.

Whether the stairstepping is audible depends on the signal. The more uniform and noise-like it is, the more clearly you can hear that fade. Applause is a good example.

I tried to re-encode only parts of a stream in the past, but failed. This is however possible with MP2 format using the CDex encoder. Haven't tried AC-3, could work.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.