Concatenating MP3s (Original CD not available) |
![]() ![]() |
Concatenating MP3s (Original CD not available) |
Feb 19 2009, 12:28
Post
#1
|
|
![]() Group: Members Posts: 4 Joined: 19-February 09 From: Birmingham, UK Member No.: 67173 |
I realise there is a high chance of being shot down here due to 1) my lack of in-depth knowledge in this area, and 2) this being something that may have been covered many times before, but I'll have a go anyway as it’s a slightly different train of thought, I think. I have searched a fair bit in the last day or two on this topic and haven't found a perfect answer so far...
I have a few albums, purchased legally from online music stores, which are "mix" albums and as such need to be played back gaplessly. This is fine in iTunes, on iPod, in WinAmp, but ideally I want these albums in a single MP3 file. This helps me greatly in playlist generation, syncing various media players, as well as playback through a media server to uPNP players e.g. xbox360 Making a single MP3 from the original music source isn't applicable as I don't have the CDs. I have tried the "copy /b" approach along with 4 other software concatenation tools. All leave a 0.05 - 0.07 gaps between tracks, which for electronic music mixes is very noticeable. Having studied the original MP3s this would be a trailing 0.05 silence on track 1 and a leading 0.02 silence on track 2 for example. I believe these gaps are there due to the way MP3s are encoded in the first place. LAME I think does something along the lines of storing the true start/finish, or the gap times, in metadata, so LAME aware players can use this to perform very good gapless playback. iTunes I believe does some kind of silence analysis, and I have found this works very well indeed. So my question: are there not any tools/utilities out there that will concatenate several MP3s, either using the LAME metadata to remove the gaps, or if this is not possible or the LAME metadata is not there (another encoder was used) use some silence analysis like iTunes to achieve the same gap removal? Cheers, VB (P.S. I really don't want to use a sound editor to go and remove the gaps myself by hand, Audacity/WavePad for example) |
|
|
|
Feb 19 2009, 13:32
Post
#2
|
|
|
ReplayGain developer Group: Developer Posts: 3203 Joined: 5-November 01 From: North Yorkshire Member No.: 409 |
The problem is that the silence is encoded into the files. You can't cut at a finer resolution than a single mp3 frame without re-encoding - but you would need to cut to within a few samples to remove audible silence.
Even lame encoded "gapless" mp3s can't be concatenated in this way - there's still silence in there - it's just skipped by metadata in compliant players when playing back the separate files. pcutmp3 offers a solution - or would do if re-combination were implemented - but it's no solution for existing files, just a better way to make new ones in the future. If you don't mind transcoding, then any set of mp3s that play gaplessly in foobar2k can easily be re-encoded into a single file using foobar2k. I don't know about iTunes. I guess you could digitally re-record its output while it was playing and encode that. Maybe someone knows an automated approach to that too...? Cheers, David. |
|
|
|
Feb 19 2009, 18:05
Post
#3
|
|
![]() Group: Members Posts: 4 Joined: 19-February 09 From: Birmingham, UK Member No.: 67173 |
Thanks for the swift reply David.
Hmm; I downloaded Foobar2k, and the first album I tried didn't playback gaplessly. It does so in iTunes. I have to admit I wasn't expecting that, I have a pretty poor opinion of iTunes, only using it because of the iPod I was bought for my birthday! For the sake of it I tried "Convert" -> "Merge all track into one output file" in Foobar2k, but unsurprisingly after the playback test, the output file had gaps too. Digitally re-recording iTunes' output seems a nice idea in theory, not sure how it would work in practice though. Quite time consuming as well. I don't know enough about encoding/fames/samples/MP3/etc really, and am probably simplifying this way too far, but from a techie point of view it seems bonkers that you can playback gaplessly (with a fairly poor media player, iTunes) but not concatenate gaplessly. Surely playback should be harder as it is a real-time process? Cheers, VB |
|
|
|
Feb 19 2009, 18:23
Post
#4
|
|
|
ReplayGain developer Group: Developer Posts: 3203 Joined: 5-November 01 From: North Yorkshire Member No.: 409 |
I think iTunes looks for the gaps (when you tell it to analyse the files for gapless playback), stores data about how long they are, and skips them during playback.
foobar2k will only respond to the lame tags (which say how much of the file to skip at the start and end). These tags are 100% accurate, not guessed. However, foobar2k won't read the iTunes ones, and AFAIK it doesn't have a method for "guessing" them like iTunes does. Maybe someone knows different? IIRC mp3 frames are 576 samples long, and you can't always cut them as you'd like (e.g. the bit reservoir means information for a given moment can be spread across frames, and if you cut it, you get an audible squeak/glitch) - whereas skipping/bodging things on playback gives you accuracy down to a single sample. Cheers, David. P.S. welcome to the forum! |
|
|
|
Feb 22 2009, 13:30
Post
#5
|
|
![]() Group: Members Posts: 4 Joined: 19-February 09 From: Birmingham, UK Member No.: 67173 |
Thanks, I'll probably be learning more than helping anyone, but looks like a great forum.
"I think iTunes looks for the gaps (when you tell it to analyse the files for gapless playback), stores data about how long they are, and skips them during playback." - so it shouldn't be too hard to do the same but for concatenating instead of playback? I wonder if that product exists, as I'm certainly no programmer, not since I left Java at Uni 7 years ago... Anyone know if such a product exists? Everything I've tried so far hasn't done the gap/silence analysis... (mp3wrap, FX ConCat, MakeItOne, AudioBookConverter, "copy /b") Cheers, VB |
|
|
|
Feb 22 2009, 14:04
Post
#6
|
|
|
Group: Members Posts: 1710 Joined: 1-September 05 From: SE Pennsylvania Member No.: 24233 |
No, the reason that iTunes can use that information to playback gapless is that it is decoding the files for playback, so it can switch from one decoded stream to the other gapless. The only way to do exactly the equivalent would be to decode both files, combine the pcm data, end then reencode.
|
|
|
|
Feb 22 2009, 15:07
Post
#7
|
|
|
Group: Members Posts: 1047 Joined: 24-June 02 From: Catalunya(Spain) Member No.: 2383 |
In a couple of times that i got interested to do that without having the original audio, i added the trick manually in foobar2000.
In other words, I edited it with the option "Utils-Edit MP3 gapless playback information". The process is easy. At top, skip 576. (it may have been encoded with fhg,though. then i believe it's 1142, just try) At bottom, take the number of samples of that mp3, substract those 576 that you skip in front, and then substract the residue of dividing it with 588 (CD audio frame boundary). Sometimes you need to substract 576 more. This uses to work for data ripped from CD audio. Note: Using an audio editor like audacity will help you dedice which is the best value for those. |
|
|
|
Feb 22 2009, 16:13
Post
#8
|
|
![]() Group: Members Posts: 4 Joined: 19-February 09 From: Birmingham, UK Member No.: 67173 |
No, the reason that iTunes can use that information to playback gapless is that it is decoding the files for playback, so it can switch from one decoded stream to the other gapless. The only way to do exactly the equivalent would be to decode both files, combine the pcm data, end then reencode. Cheers mate. Yeah, I totally agree. I wouldn't expect to be able to achieve this goal without transcoding, decodind and re-encoding at some point. I just hoped there was some software/automated process to do it rather than go into the files and doing it all manually, that's all. Cheers, VB |
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 22nd November 2009 - 05:37 |