njh / twolame

MPEG Audio Layer 2 (MP2) encoder
http://www.twolame.org/
GNU Lesser General Public License v2.1
59 stars 34 forks source link

Padding in layer II #26

Closed eblanca closed 8 years ago

eblanca commented 8 years ago

I see in twolame the default behavior is to have padding disabled, instead lame sets this to enabled. Out of curiosity, is there a particular reason for this different setting? In case of padding, does the further byte provide more room for audio samples?

njh commented 8 years ago

I have not had any experience of anyone setting it one way or another.

Wikipedia says:

MPEG-1 layer I was also used by the Digital Compact Cassette format, in the form of the PASC audio compression codec. Because of the need of a steady stream of frames per second on a tape-based medium, PASC uses the rarely used (and under-documented) padding bit in the MPEG header to indicate that a frame was padded with 32 extra 0-bits (four 0-bytes) to change a short 416-byte frame into 420 bytes. The varying frame size only occurs when a 44.1 kHz 16-bit stereo audio signal is encoded at 384 kilobits per second, because the bitrate of the uncompressed signal is not an exact multiple of the bitrate of the compressed bit stream.

So it is about bringing the MPEG Audio stream up to a constant bitrate - but resulting in less audio per bps.

eblanca commented 8 years ago

Thank you