Under construction

MP3 is probably the most used audio format in internet radio. This has a very good reason, first of all MP3 is what made this all possible back in the 90s but also that it's design makes it perfect for streaming. In the current day almost every platform supports MP3 and the patents on it are expired or are close to. This makes it 100% public domain in several years. Compared to AAC this makes a huge advantage as many platforms do not support AAC because of the licensing fee required.
Compared to open audio formats like Vorbis an Opus MP3 has the advantage of being a must in all media frameworks (eg. Apple's media framework provides no support for these formats).

MP3 file structure

Compared to modern container formats like MP4 MP3 has a very simple file structure. All info needed about the file is in the front of the file (MP4 has this too but as an option). This makes it great for uses like streaming (both live and recorded). In many MP3 files we find an ID3 header, this can be ID3 or ID3v2 the last one can contain many info and is most used. ID3 tags can extend to over 200mb of data, however this is rare. Often this can be a few hundred kilobytes as it can contain the cover picture. If the file is VBR often a Xing/info tag is found. While MP3 has it's own structure this tag fits in the size of an MP3 frame and will use it's format. This can contain info about the encoding and for VBR 100 bytes of seektable.

The rest of the MP3 file consists of individual frames starting with HEX FFF. This is the sync frame that indicates the start of a new MP3 frame. If this is not present the decoder will ignore the data till the next sync byte. This makes it possible to ignore broken frames.

As stated above every frame starts with 11 sync bits followed by a header containing the info on the frame. Should a CRC (checksum to prevent playing incorrect frames) be set that will be follow direct to the header. The header contains info like bit and sample rate and MP3 layer.
After the CRC (if set) a 26ms of sound is placed followed by padding. This padding will make the frame the exact bitrate but will not be played. This is done as many MP3 decoders use the exact size to go to a timestamp as the MP3 frame doesn't provide the timestamp of what is tries to play.


MP3 and streaming

Read more