Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: removing silent frames from non-gapless mp3s (Read 5369 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

removing silent frames from non-gapless mp3s

I have some ambient compilation encoded with gogo at 192 Kb/s. It's net release, and it's not gapless - it has around 2000 (+/- 500) frames of silence at the end of every track which sounds like click unless  crossfader is used with foobar.

So what I did: I decoded all tracks to 1 wav and marked and deleted those annoyances with Audition, then transcoded to OGG -q5 (BS). The result is fine, but I was thinking if there is some better way of doing this, preferably without transcoding?

removing silent frames from non-gapless mp3s

Reply #1
Try mpTrim.

removing silent frames from non-gapless mp3s

Reply #2
do you possibly mean ~2000 samples (approximately 2 frames) of silence at the end of the mp3 file? 2000 frames is about 52 seconds.
either way, mptrim will auto-detect silence at the beginning and end of an mp3 file (free version only does songs 7 min and shorter). So you can save the file having stripped these silent frames from the mp3.

To do this optimally, you may want to use foobar2000 to edit gapless information and enc_delay and enc_padding.
Standard enc_delay values (for number of silent samples from beginning of the mp audiostream to where the audio from the encoded source actually starts) are 528 for iTunes, 672 for Windows Media Player FhG, and 576 for Lame.
This method can quickly balloon into a time-suck though, so see if it sounds gapless enough for you after using mptrim to strip silence.
God kills a kitten every time you encode with CBR 320

removing silent frames from non-gapless mp3s

Reply #3
Thanks
I did try mp3Trim but I guess I'm not using it right
First I choose auto trimming which detects 1 (or 2 in aggressive mode) frames at the end, but without success - files still have silent part (tiny click on track change)
I also did Fix header in foobar and checked the length which is multiple of 576
I then try manually entering the trim range, but again - bad result

do you possibly mean ~2000 samples (approximately 2 frames)...

Yeah, that's what I've meant
When mp3s are opened directly in Audition it shows silent samples of ~2000 at the beginning and ~6000 at the end, but if I decode them to single WAV in foobar and open the file in Audition, than silent part between tracks is just ~2000 samples.

Here is metamp3 from one track:

Code: [Select]
   Type                    : mpeg 1 layer III
   Mode                    : stereo
   Frequency               : 44100 Hz
   Frames                  : 10982
   Length                  : 00:04:46
   Max. Reservoir          : 510
   Av. Reservoir           : 471
   Emphasis                : none
   Scalefac                : 5.2%
   Bad Last Frame          : no
   Encoder                 : Gogo (after 3.0)

   Bitrate (average)       : 192
   -----------------------------------------------------------
   192     ||||||||||||||||||||||||||||||||||||||||      100.0%
   -----------------------------------------------------------
   Lame Header             : No


The release is Amazonian Dreamtime (Steve Roach, Brian Eno...) and I can upload sample track if that's OK

removing silent frames from non-gapless mp3s

Reply #4
I'll try to describe the best known to me (but time consuming) method of fixing the gaps in the mp3 encoded albums. You will need the wave editor with a proper selection zoom feature (to count samples) and foobar2000 to edit the delay/padding info in the mp3 files.

1) Decode all files to uncompressed wav format with foobar2000 (this is important, because if you open the mp3 directly with the wave editor its internal decoder may add extra silence at the beginning and/or at the end). You need to convert separate tracks to separate wav files, not to a single wav file.
2) Determine the encoder delay (number of silent samples at the beginning of each track). This number should be identical for all tracks if they were encoded with the same software. In case of gogo, since it's lame-based the delay should be 576 samples, but it wouldn't hurt to check visually in the editor.
3) For each track that should end with gapless transition, determine the number of silent samples at the end (the padding). Unfortunately this procedure can not be reliably automated, because silent samples may not strictly equal zero (due to the encoder filter ringing). You'll need to visually search for the waveform cut-off.
4) Determine the true length of the track in samples: true length = (raw length) - (encoder delay) - (padding). This number should be a multiple of 588 (the audio CD sector size). If it is not, then either you incorrectly determined number of padding samples, or the content was not encoded from the audio CD, or possibly it was digitally processed prior to mp3 encoding.
5) Edit the mp3 info frame with foobar2000 (local menu -> utilities -> edit mp3 gapless playback information). Enter the encoder delay from step 2 into the "encoder delay" field and the true track length from step 4 into the "padding" field. Save the changes.

That's it, the files now should play gaplessly. There still may remain minor glitches due to imperfect waveform restoration (it's a lossy encoding, after all) but this is all that you can do without re-encoding the files.

removing silent frames from non-gapless mp3s

Reply #5
Good tutorial. Does what it says, tracks now play gaplessly
Thanks

removing silent frames from non-gapless mp3s

Reply #6
I'll try to describe the best known to me (but time consuming) method of fixing the gaps in the mp3 encoded albums. You will need the wave editor with a proper selection zoom feature (to count samples) and foobar2000 to edit the delay/padding info in the mp3 files.

1) Decode all files to uncompressed wav format with foobar2000 (this is important, because if you open the mp3 directly with the wave editor its internal decoder may add extra silence at the beginning and/or at the end). You need to convert separate tracks to separate wav files, not to a single wav file.
2) Determine the encoder delay (number of silent samples at the beginning of each track). This number should be identical for all tracks if they were encoded with the same software. In case of gogo, since it's lame-based the delay should be 576 samples, but it wouldn't hurt to check visually in the editor.
3) For each track that should end with gapless transition, determine the number of silent samples at the end (the padding). Unfortunately this procedure can not be reliably automated, because silent samples may not strictly equal zero (due to the encoder filter ringing). You'll need to visually search for the waveform cut-off.
4) Determine the true length of the track in samples: true length = (raw length) - (encoder delay) - (padding). This number should be a multiple of 588 (the audio CD sector size). If it is not, then either you incorrectly determined number of padding samples, or the content was not encoded from the audio CD, or possibly it was digitally processed prior to mp3 encoding.
5) Edit the mp3 info frame with foobar2000 (local menu -> utilities -> edit mp3 gapless playback information). Enter the encoder delay from step 2 into the "encoder delay" field and the true track length from step 4 into the "padding" field. Save the changes.

That's it, the files now should play gaplessly. There still may remain minor glitches due to imperfect waveform restoration (it's a lossy encoding, after all) but this is all that you can do without re-encoding the files.


Guys. Sorry to dig up an old thread but would this method also work on MP3 V0 files? Also what program would you  suggest for editing the gaps out?
Thanks.

removing silent frames from non-gapless mp3s

Reply #7
everything said earlier also applies to V0 files
God kills a kitten every time you encode with CBR 320