HydrogenAudio

Lossy Audio Compression => MP3 => MP3 - General => Topic started by: cernall on 2010-07-02 09:14:22

Title: MP3 is a Container or Codec alone
Post by: cernall on 2010-07-02 09:14:22
We can se files with MP# extension. Is MP3 a container also, or it is a codec alone?

If its a codec alone, then how can we play and have some meta information in the mp3 files?
Title: MP3 is a Container or Codec alone
Post by: dv1989 on 2010-07-02 09:37:54
http://en.wikipedia.org/wiki/MP3#File_structure (http://en.wikipedia.org/wiki/MP3#File_structure)
Metadata is stored in ID3 tag (http://en.wikipedia.org/wiki/ID3)(s).

MP3 is MPEG-1 Audio Layer 3. MPEG-1 can be a container of sorts, though I don't know if this applies to MP3 files, which have just one audio track: http://en.wikipedia.org/wiki/MPEG-1#Program_streams (http://en.wikipedia.org/wiki/MPEG-1#Program_streams)
Title: MP3 is a Container or Codec alone
Post by: odyssey on 2010-07-02 13:50:42
I understand your confusion.

mp4 is a container, usually containing aac audio and/or avc video.
mp3 is audio probably with a sort of it's own container, allowing tags etc to be stored.
Title: MP3 is a Container or Codec alone
Post by: probedb on 2010-07-02 15:50:20
But it's not actually a container as such, audio formats have headers and such so I'm guessing tags are essentially just extra data in the headers?

Of course I could be completely wrong
Title: MP3 is a Container or Codec alone
Post by: spoon on 2010-07-02 20:50:16
I think the definition of a container (m4a, wav, aiff, etc) is that it should be able to contain different audio formats. Mp3 (if you ignore the mp3 surround distraction), only holds mp3.
Title: MP3 is a Container or Codec alone
Post by: Aleron Ives on 2010-07-02 21:21:10
I think the definition of a container (m4a, wav, aiff, etc) is that it should be able to contain different audio formats. Mp3 (if you ignore the mp3 surround distraction), only holds mp3.

Yeah, the naming convention isn't consistant, which is rather confusing to people. MP3 is just a codec, because a file with the .mp3 extension is always MP3 audio. The successor to MP3 is AAC, and files with the .aac extension are "raw" AAC audio the same way MP3 audio is always presented. Unfortunately, AAC is often stored in MP4, which is a container, not a codec. MP4 can hold AAC audio, AVC video, or both, but MP4 itself is not content. It always has to hold something else, which is what makes it a container. (MP4 can also hold MP3 audio, XviD or DivX video, and any other number of formats. AVC/AAC are just the most common contents of MP4 containers.)
Title: MP3 is a Container or Codec alone
Post by: saratoga on 2010-07-02 22:46:48
We can se files with MP# extension. Is MP3 a container also, or it is a codec alone?

If its a codec alone, then how can we play and have some meta information in the mp3 files?


MP3 is basically a raw bitstream (similar to .AAC) with tags stuck into it by exploiting how the mp3 spec says a bitstream should be parsed to hid extra data in a semi-backwards compatible way.  Its not really a container in that its not officially standardized, but rather grew organically over the years.
Title: MP3 is a Container or Codec alone
Post by: mjb2006 on 2010-07-02 22:51:26
Answering the original questions... [this is basically just a longer version of saratoga's reply, which came in while I was typing]
Quote
how can we play and have some meta information in the mp3 files?
Quote
I'm guessing tags are essentially just extra data in the headers?

MP3 data is just the audio data segments ('frames') which, in series, compose a 'stream'. Each frame has its own header containing technical metadata about that frame (format version, bitrate, stereo mode, etc.), but nothing about the entire stream - no artist, title, etc.; AFAIK that kind of metadata was deliberately omitted from the MP3 spec, perhaps because it was thought that if a container format were needed, a suitable one would be properly developed by the industries that were interested in MP3.

So instead, at least for the way most of use MP3, various ad-hoc, not-very-well-thought-out-or-standardized methods have been devised to append or prepend chunks of formatted data ('tags') to a given stream. The most popular tag format has long been ID3, of which there are several versions, but APEv2 seems to be increasingly popular. These tags are basically garbage (in that they're not MP3 data) on the ends of the stream, but the programmers' maxim "be strict in what you produce and lenient in what you accept" dictates that consumers of ".mp3" files concentrate on whatever MP3 frames are there, and either properly handle or just ignore any garbage—er, tags. You can think of the file as being a 'container', then, but really it's just an MP3 stream possibly with other stuff embedded. Generally, you should expect that any MP3 file you run across will have no tags, or one tag, or many tags, all in different formats, and possibly at inconsistent locations.