[FFmpeg-devel] MPEG Audio encoding

John Sigler linux.kernel
Fri Jan 25 10:51:13 CET 2008


[ This message was originally posted to ffmpeg-user ]

Hello,

I have a few questions concerning the MPEG Audio encoder in ffmpeg.
( mpegaudioenc.c )

(I've been reading the corresponding Wikipedia articles.)
http://en.wikipedia.org/wiki/MPEG-1_Audio_Layer_I
http://en.wikipedia.org/wiki/MPEG-1_Audio_Layer_II

AFAICT mpegaudioenc.c implements MPEG-2 Layer II (i.e. MP2).

Is there support for MPEG Audio Layer I in libavcodec?
(I suppose that would be MP1.)
AFAIU, Layer I is "worse" than Layers II and III in every metric?
(Except perhaps algorithmic complexity?)
LAME seems (??) to have removed MP1 support some time ago.

If I understand the code correctly, when I pick a sampling frequency
from the set { 44100, 48000, 32000 } then lsf = 0 which means the set of
available bitrates is { 0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192,
224, 256, 320, 384 }

When I pick a sampling frequency from the set { 22050, 24000, 16000 }
then lsf = 1 which means the set of available bitrates is { 0, 8, 16,
24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160 }

On a related subject, the Wikipedia article states:

The format is based on successive digital frames of 1152 sampling
intervals with four possible formats:

     * mono format
     * stereo format
     * joint stereo format (stereo irrelevance)
     * dual channel (uncorrelated) format

http://en.wikipedia.org/wiki/Joint_stereo

And mpegaudio.h defines

#define MPA_STEREO  0
#define MPA_JSTEREO 1
#define MPA_DUAL    2
#define MPA_MONO    3

But joint stereo and dual mono do not seem (??) to be supported by
the encoder. Is that correct?

Were joint stereo and dual mono actually defined for Layer II,
or did they only show up later in Layer III?

The relevant (?) code seems to be in encode_frame()

   put_bits(p, 2, s->nb_channels == 2 ? MPA_STEREO : MPA_MONO);

Regards.





More information about the ffmpeg-devel mailing list