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: Replaygain mp2 (mpeg 1 layer 2) (Read 5581 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Replaygain mp2 (mpeg 1 layer 2)

Hi everybody,


I used mp3gain on my mp3 collection. There was a file which generated an error in mp3gain. Both mp3trim and encspot stated the file is actually mpeg 1 layer 2 (so it should have had the .mp2 extension instead). mp3gain is supposed to be used only on layer 3 (according to its documentation).

So I am looking for one of two things:

1. A program (or a combination of programs) to losslessly convert a layer 2 file to layer 3. (I will use mp3gain on the result file).

2. A program to replaygain a layer 2 file.

Any comments or suggestions are appreciated.

(The layer 2 file is 44 kHz, 112 kbit/s, so the quality is pretty bad. I wouldn't need a lossy transcoding procedure in case 1 because it will only make things worse).


Thanks in advance

Replaygain mp2 (mpeg 1 layer 2)

Reply #1
Quote
1. A program (or a combination of programs) to losslessly convert a layer 2 file to layer 3. (I will use mp3gain on the result file).


not possible as far as i know - converting from one lossy-codec into a completely different codec is always lossy (transcoding).


2. A program to replaygain a layer 2 file.

i guess (not sure) that layer2 does not support tags. Therefore, the changes cannot be stored in the file itself - if thats okay to you, then you can use foobar2000 to replaygain it - disadvantage: the changes will only audible in foobar2000, because they will be stored in its database(since they cannot be stored in the file itself)

Another possibility may be to put the layer2 file into a container-format which supports layer2, and has its own tagging-system (mp4? not sure). That would allow to store the replaygain-values of foobar inside of the file itself - but the downside will stay the same(changes only audible in a player which supports replaygain via tags)

- Lyx
I am arrogant and I can afford it because I deliver.

Replaygain mp2 (mpeg 1 layer 2)

Reply #2
@Lyx: Thanks for the answer

Quote
i guess (not sure) that layer2 does not support tags.


I use Winamp and it does read the ID3v1 tags from this file.

I understand (please correct me if I am wrong) that there are two ways of modifying the volume of a track. The first is not touching the track data, but embedding a tag in the ancillary part of the track; a compatible player reads this tag and ajusts the track level accordingly. The second (which is used by mp3gain) is modifying the actual data; any player will play this track at its new volume.

What I would need is modifying the actual track data (which is exactly what mp3gain does with layer 3).

The questions is, is there technically possible with layer 2 the same technical trick of modifying some multiplier found in every data frame?
If yes, is there any program able to do it?

Quote
not possible as far as i know - converting from one lossy-codec into a completely different codec is always lossy (transcoding).


I might be wrong, but layer 2 and 3 might have something in common. This is a quote from http://www.harmoniccycle.com/harmonicweb/m...fo-frauFAQ.htm:

Quote
    Layer-1, Layer-2, Layer-3
    MPEG describes the compression of audio signals using high performance perceptual coding schemes. It specifies a family of three audio coding schemes, simply called Layer-1, Layer-2, and Layer-3. From Layer-1 to Layer-3, encoder complexity and performance (sound quality per bitrate) are increasing. The three codecs are compatible in a hierarchical way, i.e. a Layer-N decoder may be able to decode bitstream data encoded in Layer-N and all Layers below N (e.g., a Layer-3 decoder may accept Layer-1,-2,-3, whereas a Layer-2 decoder may accept only Layer-1 and -2.)
    
    Each audio Layer extends the features of the Layer with the lower number. The simplest form is Layer-1. It has been designed mainly for the DCC (Digital Compact Cassette), where it is used at 384 kbps (called "PASC"). Layer-2 has been designed as a trade-off between complexity and performance. It achieves a good sound quality at bitrates down to 192 kbps. Below, sound quality suffers. Layer-3 has been designed for low bitrates right from the start. It adds a number of "advanced features" to Layer-2: the frequency resolution is 18 times higher, which allows a Layer-3 encoder to adapt the quantization noise much better to the masking threshold only Layer-3 uses entropy coding (like MPEG video) to further reduce redundancy only Layer-3 uses a bit reservoir (like MPEG video) to suppress artifacts in critical moments and Layer-3 may use more advanced joint-stereo coding methods.

Replaygain mp2 (mpeg 1 layer 2)

Reply #3
Quote
I understand (please correct me if I am wrong) that there are two ways of modifying the volume of a track. The first is not touching the track data, but embedding a tag in the ancillary part of the track; a compatible player reads this tag and ajusts the track level accordingly. The second (which is used by mp3gain) is modifying the actual data; any player will play this track at its new volume.

exactly. Modifying the audiodata itself is how mp3gain does it. Writing the adjustments into tags is the way foobar and a small amount of other players do it (btw: there IS a plugin for winamp which can READ those replaygain-tags, but cannot write them).

Anyways, i dont want to give you any false information - so i will leave it up to someone else who is more in the know than i am in that department to answer your other questions :-)

However, i haven't yet seen any application like mp3gain for layer 2 files. So you are probably right that converting them someway to mp3 would be the easiest solution. Another possibility - although overkill in terms of filesize - would be to decode the layer 2 file to WAV, then use wavegain to replaygain the WAV - and after that reencode it with a lossless codec - disadvantage: there are currently not that many portable players on the market which support lossless codecs - and the filesize will of course be overkill :-)

- Lyx
I am arrogant and I can afford it because I deliver.


Replaygain mp2 (mpeg 1 layer 2)

Reply #5
@rjamorim: Thank you for the link.

It seems that is exactly what I need.

I have made some experiments:
Code: [Select]
C:\programe\besweet>besplit -core ( -input lyra.mp2 -output lyra2.mp2 -log besplit.log -type mp2 ) -ota( -G max )

And the output:
Code: [Select]
[00:03:36:215] |  Writing lyra2.mp2d : -0.9dB


Apart from the disappearance of the ID3 tags, no difference between the input and the output files exists.

I have tried then:
Code: [Select]
C:\programe\besweet>besplit -core ( -input lyra.mp2 -output lyra2.mp2 -log besplit.log -type mp2 ) -ota( -G 1.1 )

The output:
Code: [Select]
[00:03:36:215] |  Asserted -4.0dB to lyra2.mp2.


There is a difference between the binary data in the input and output files. However I hear no decrease of the volume.

Does anybody have any suggestion?


Regards,
Radu

Replaygain mp2 (mpeg 1 layer 2)

Reply #6
I forgot to mention:

I use BeSplit v0.9b6. (I don't know if DSPGuru disabled mp2 lossless transcoding support since 0.9b5).

I have tried several values x for the parameter -G x.

x <=1.0 won't do anything with the gain.
x >=2.6 would apply 2db gain.
x between 1.1 and 2.5 would apply -4db gain.

I need to apply -6db. So my only option is trying x between 1.1 and 2.5.

Replaygain mp2 (mpeg 1 layer 2)

Reply #7
Quote
Code: [Select]
C:\programe\besweet>besplit -core ( -input lyra.mp2 -output lyra2.mp2 -log besplit.log -type mp2 ) -ota( -G max )

And the output:
Code: [Select]
[00:03:36:215] |  Writing lyra2.mp2d : [b]-0.9dB[/b]


Apart from the disappearance of the ID3 tags, no difference between the input and the output files exists.

-0,9db isn't all that much. I would probably only be able to tell the difference in direct comparision myself.

- Lyx
I am arrogant and I can afford it because I deliver.

Replaygain mp2 (mpeg 1 layer 2)

Reply #8
@Lyx: When I said "no difference between files exists", I meant I made a binary comparison and they are the same. (Well, except the ID3 tags have been removed from the input).

Replaygain mp2 (mpeg 1 layer 2)

Reply #9
whops, sorry - misunderstanding :-)

Well, i don't "know" whats the cause of this, but here is a "possibility":

With mp3's its only possible to increase/decrease the volume in 1,5db steps. You will probably have noticed that with mp3gain. Well, i don't know how things are with layer2 in that department, but you may want to do some researches on how big those "steps" are there. Why? Here's a theoretical example:

Lets asume you can only change the volume in layer2 in 2.0db steps. Well, you scanned the above file and the replaygain-value was 0,9db. Rounded between 0,0 and 2,0db, the result would be that no change is made to the file at all.

However, thats just a guess - i can be completely wrong.
- Lyx
I am arrogant and I can afford it because I deliver.

Replaygain mp2 (mpeg 1 layer 2)

Reply #10
But he says that he has tried -4.0 dB as well? That should definitely be audible, right?

Here is an idea, try scanning the original MP2 and the "replaygained" MP2 with foobar2k, and check whether the replaygain values differ by ~4 dB or not. That should rule out anything related to the playback or whatever at least.

 

Replaygain mp2 (mpeg 1 layer 2)

Reply #11
Quote
But he says that he has tried -4.0 dB as well? That should definitely be audible, right?

That's exactly my point: I should have heard the decrease in volume.

I don't have foobar2k, but I've used wavgain instead:

I have set the "disk writer" plugin in WinAmp (converting the two mp2's to wav's).
I have now two wavs: lyra.wav (the "original") and lyra2.wav (the result of lowering the volume by 4 dB using besplit).
I run:
Code: [Select]
C:\programe\besweet>WavGain.exe lyra.wav lyra2.wav
lyra.wav        -6.53   1.00003
lyra2.wav       -8.52   1.00003


The result is astonishing: the original should have been lowered by 6.53 dB (to reach the standard 89 dB), but the second should have been lowered by 8.52 dB (to reach the same 89 dB). So actually the second file is *louder* than the original.

:-)

(In order to be sure, I encoded both wav's into mp3@320kbit/s and mp3gain'ed the results. mp3gain displays approx the same values: -6.5 dB for the first and -8.5 dB for the second).


Any suggestion?