The MPEG file format is described here as long it is necessary to understand the
Java implementation problems.
Ordinarily file formats are described in form of offsets. In TARGA image file format for instance
the image width is placed at offset 13 and 14. In MPEG such kind of description is impossible because:
The DCT coefficients for instance are coded according to the table to right(extract). Where level is the DCT value an run defines how many DCT coefficients before are zero. The whole table has 112 entries. So the MPEG standard ISO 11172 describes the MPEG file format by means of a C-like language. |
| |||||||||||||||||||||||||||||||||||||||||||||||||||
Another important aspect is that the DC coefficients are coded as differences to the DC coefficient in last block because one can assume the average brightness to be similar for neighbouring blocks. Because of the VLC the small differences are coded by less bits than the greater absolute values.
In the past most of MPEG files were MPEG video files according to ISO/IEC 11172-2. But in the last months more and more layer I MPEG files appear. This particularly because most hardware MPEG encoders produce layer I/II MPEG files which often contain video and audio data according to ISO/IEC 11172-1.
The file structure is as follows:
The file consists of so called "packs" which contain "packets". The packet data are video or audio data. A Layer I MPEG stream can have up to 16 video channels and up to 32 audio channels. If you concat the packet data of one video channel byte by byte you'll get an MPEG video file according to ISO/IEC 11172-2.
This is exactly what the current MPEG decoder does. It can only deal with one video channel. The audio channels are simply skipped.
Java-inline-MPEG-Player