Skip to main content

Topic: How to force a file to be MPEG-1, MPEG-2, or MPEG-2.5? (Read 3293 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • polemon
  • [*][*][*][*]
How to force a file to be MPEG-1, MPEG-2, or MPEG-2.5?
The three audio compression layers are defined in MPEG-1, MPEG-2, and MPEG-2.5, of which the first two are the official standards, and the third one is proprietary and unofficial.

In total, there are basically nine encoding versions, but how can I safely distinguish the nine versions form one another?
Even though the MPEG-2.5 standard is not official, I'd be interested in testing it, etc. However, I'm unsure how I can "force" creation of a - say - MP3 file that conforms to that standard.

As far as I can tell, the only real difference, is the number of channels, as well as the sampling rate (which seems to be the most deciding factor) as well as the available bitrates. These however overlap, so it's not really possible to tell which one is which, unless one uses a bitrate that is exclusive to either standard.

My question however, is more geared towards creation of these files. Suppose I want to use a tool like LAME of ffmpeg, I'm unsure, how to specifically select the MPEG standard, and the layer. I'm either not finding this in the man pages, or is it impossible to select like that? I can only assume, that the sampling rate automatically selects the standard, but I couldn't find anywhere to corroborate that.

One additional thing that is kinda murky to me, is whether MPEG-2.5 can be contained in MPEG-ES, the thin container, which is used for most ".mp3" files, etc.

  • lvqcl
  • [*][*][*][*][*]
  • Developer
Re: How to force a file to be MPEG-1, MPEG-2, or MPEG-2.5?
Reply #1
From LAME --longhelp:
MPEG-1   layer III sample frequencies (kHz):  32  48  44.1
MPEG-2   layer III sample frequencies (kHz):  16  24  22.05
MPEG-2.5 layer III sample frequencies (kHz):   8  12  11.025
(and afaics LAME can create only layer 3  files)

  • polemon
  • [*][*][*][*]
Re: How to force a file to be MPEG-1, MPEG-2, or MPEG-2.5?
Reply #2
OK, thanks, that covers three of the possible options! ¦)

Indeed the sampling rate selects the MPEG standard. How about the MP1 and MP2 versions, though? I'm guessing I'd have to use FFmpeg for that.

Since LAME uses the MPEG-2.5 standard, it puts that into an MPEG-ES container? I guess it kinda has to.

  • saratoga
  • [*][*][*][*][*]
Re: How to force a file to be MPEG-1, MPEG-2, or MPEG-2.5?
Reply #3
As far as I can tell, the only real difference, is the number of channels, as well as the sampling rate (which seems to be the most deciding factor) as well as the available bitrates. These however overlap, so it's not really possible to tell which one is which, unless one uses a bitrate that is exclusive to either standard.

Unless I'm missing something, there is no overlap.  The MPEG 2 versions are half the MPEG1, and the MPEG2.5 are one quarter. 

My question however, is more geared towards creation of these files. Suppose I want to use a tool like LAME of ffmpeg, I'm unsure, how to specifically select the MPEG standard, and the layer. I'm either not finding this in the man pages, or is it impossible to select like that? I can only assume, that the sampling rate automatically selects the standard, but I couldn't find anywhere to corroborate that.

ffmpeg -codecs will list what it can do, and at least for me it only has layer 2 and layer 3 encoders.  You can specify either when you pick the audio format.  The sampling rate should determine which MPEG version.

One additional thing that is kinda murky to me, is whether MPEG-2.5 can be contained in MPEG-ES, the thin container, which is used for most ".mp3" files, etc.

Yes they're all backwards compatible, with the exception of 2.5 which takes 1 bit out of the sync word and therefore is theoretically not compatible, but in practice works with most decoders.  See:

http://mpgedit.org/mpgedit/mpeg_format/MP3Format.html

The libmad source code is also helpful for III_decode:

http://m.baert.free.fr/contrib/docs/libmad/doxy/html/layer3_8c-source.html#l02341

The first 3 lines of the function check the header to see what the sampling rate is is and if the MPEG 2.5 bit is set, and if it is, they just double the sampling rate and adjust a pointer to the list of sampling rates to correspond to the 2.5 look up tables. 

  • polemon
  • [*][*][*][*]
Re: How to force a file to be MPEG-1, MPEG-2, or MPEG-2.5?
Reply #4
As far as I can tell, the only real difference, is the number of channels, as well as the sampling rate (which seems to be the most deciding factor) as well as the available bitrates. These however overlap, so it's not really possible to tell which one is which, unless one uses a bitrate that is exclusive to either standard.

Unless I'm missing something, there is no overlap.  The MPEG 2 versions are half the MPEG1, and the MPEG2.5 are one quarter. 

I was referring to this: https://en.wikipedia.org/wiki/MP3#Bit_rate <--- i.e. the *bitrates* overlap from standard to standard, not the sampling rates.

ffmpeg -codecs will list what it can do, and at least for me it only has layer 2 and layer 3 encoders.  You can specify either when you pick the audio format.  The sampling rate should determine which MPEG version.

OK, so it's essentially like with LAME, where the sampling rate decides the standard.

One additional thing that is kinda murky to me, is whether MPEG-2.5 can be contained in MPEG-ES, the thin container, which is used for most ".mp3" files, etc.

Yes they're all backwards compatible, with the exception of 2.5 which takes 1 bit out of the sync word and therefore is theoretically not compatible, but in practice works with most decoders.  See:[...]

Hmm, OK, so it seems to be semi-universally supported, etc. I wonder how things are with embedded decoders, though. Car audio systems, and the like. However this seems to be an issue which is dependent on each individual case.

Since pretty much all sources claim that MP1 is technically not really used in the wild anymore, since the requirement of a low-complexity decoder is pretty much non-sequitur at this point, etc. I guess one would be hard pressed to find a MP1 encoder and decoder that uses all three available standards.

Anyway, thanks for clearing this up, guys!

  • j7n
  • [*][*][*][*][*]
Re: How to force a file to be MPEG-1, MPEG-2, or MPEG-2.5?
Reply #5
QDesign i-Media can encode all combinations of Layer 1 and Layer 2 streams, stereo, dual channel, etc. It plays back its own 12 kHz encode. Nothing else plays it. The help file calls the low frequencies "low bitrate operating modes". All applications play 22 kHz. Qdesign isn't a quality encoder though. I've never seen a Layer 1 file distributed anywhere.

I always found confusing that lower resolution modes have a higher version number.

  • polemon
  • [*][*][*][*]
Re: How to force a file to be MPEG-1, MPEG-2, or MPEG-2.5?
Reply #6
Hmm, after looking into these things a bit more closely, I think I was in error about MPEG-2.5 and anything except MP3.

Am I right in thinking that MPEG-2.5 is MP3 only? I couldn't find any material suggesting that MPEG-2.5 covers MP2, let alone MP1.

  • saratoga
  • [*][*][*][*][*]
Re: How to force a file to be MPEG-1, MPEG-2, or MPEG-2.5?
Reply #7
You can create MP1 files using the pegase encoder.  Here are some test files I created years ago for testing the rockbox MP1/MP2 decoder:

http://download.rockbox.org/test_files/pegase_l1_192.mp1
http://download.rockbox.org/test_files/pegase_l1_256.mp1
http://download.rockbox.org/test_files/pegase_l2_128.mp2

Am I right in thinking that MPEG-2.5 is MP3 only?

Edit:  misread.  I believe it is in practice.
  • Last Edit: 25 April, 2017, 09:43:39 PM by saratoga

  • Rollin
  • [*][*][*][*]
Re: How to force a file to be MPEG-1, MPEG-2, or MPEG-2.5?
Reply #8
SCMPX  can create mpeg-1 layers 1, 2, 3 and mpeg-2 layers 1, 2, 3. http://www.din.or.jp/~ch3/scmpx_e.html