2.1. Supported formats

It is important to clarify a common mistake. When people see a file with a .AVI extension, they immediately conclude that it is not an MPEG file. That is not true. At least not entirely. Contrary to popular belief such a file can contain MPEG1 video.

You see, a codec is not the same as a file format.
Examples of video codecs are: MPEG1, MPEG2, DivX, Indeo5, 3ivx.
Examples of file formats are: MPG, AVI, ASF.

In theory, you can put an OpenDivX video and MP3 audio into an MPG format file. However, most players will not play it, since they expect MPEG1 video and MP2 audio (unlike AVI, MPG does not have the necessary fields to describe its video and audio streams). Or you might put MPEG1 video into an AVI file. FFmpeg and MEncoder can create these files.

2.1.1. Video formats

2.1.1.1. MPEG files

MPEG files come in different guises:

- MPG: This is the most basic form of the MPEG file formats. It contains MPEG1 video, and MP2 (MPEG-1 layer 2) or rarely MP1 audio.
- DAT: This is the very same format as MPG with a different extension. It is used on Video CDs. Due to the way VCDs are created and Linux is designed, the DAT files cannot be played nor copied from VCDs as regular files. You have to use the `-vcd` option to play the Video CD.
- VOB: This is the MPEG file format on DVDs. It is the same as MPG, plus the capability to contain subtitles or non-MPEG (AC3) audio. It contains encoded MPEG2 video and usually AC3 audio, but DTS, MP2 and uncompressed LPCM are allowed, too.
  Read the DVD section !

Series of frames form independent groups in MPEG files. This means that you can cut/join an MPEG file with standard file tools (like dd, cut), and it remains completely functional.

One important feature of MPGs is that they have a field to describe the aspect ratio of the video stream within. For example SVCDs have 480x480 resolution video, and in the header that field is set to 4:3, so that it is played at 640x480. AVI files do not have this field, so they have to be rescaled during encoding or played with the `-aspect` option.

2.1.1.2. AVI files

Designed by Micro$oft, AVI (Audio Video Interleaved) is a widespread multipurpose format currently used mostly for DivX and DivX4 video. It has many known drawbacks and shortcomings (for example in streaming). It supports one video stream and 0 to 99 audio streams and can be as big as 2GB. There exists an extension allowing bigger files called OpenDMS. M$ currently strongly discourages its use and encourages ASF/WMV. Not that anybody cares.

There is a hack for AVI files that enhances them to contain Ogg Vorbis audio stream, but makes them incompatible with standard AVI. MPlayer supports playing these files, though seeking is currently unimplemented.

NOTE: DV cameras can create two types of AVI formats. One is common and playable, the other is neither.

There are two kinds of AVI files:

- Interleaved: Audio and video content is interleaved. This is the standard usage. Recommended and mostly used. Some tools create interleaved AVIs with bad sync. MPlayer detects these as interleaved, and this climaxes in loss of A/V sync, probably at seeking. These files should be played as non-interleaved (with the `-ni` option).
- Non-interleaved: First comes the whole video stream, then the whole audio stream. It thus needs a lot of seeking, making playing from network or CD-Rom difficult.

MPlayer supports two kinds of timings for AVI files:

- bps-based: It is based on the bitrate/samplerate of the video/audio stream. This method is used by most players, including avifile and windows media player. Files with broken headers, and files created with VBR audio but not VBR-compliant encoder will result in A/V desync with this method (mostly at seeking).
- interleaving-based: It does not use the bitrate value of the header, instead it uses the relative position of interleaved audio and video chunks, making badly encoded files with VBR audio playable.

Any audio and video codec is allowed, but note that VBR audio is not well supported by most players. The file format makes it possible to use VBR audio, but most players expect CBR audio, thus they fail with VBR. VBR is uncommon and Microsoft's AVI specs only describe CBR audio. I also noticed that most AVI encoders/multiplexers create bad files when using VBR audio. There are only two exceptions (known to me): NaNDub and MEncoder.

2.1.1.3. ASF/WMV files

ASF (active streaming format) comes from Microsoft. They developed two variants of ASF, v1.0 and v2.0. v1.0 is used by their media tools (windows media player and windows media encoder) and is very secret. v2.0 is published and patented :). Of course they differ, there is no compatibility at all (it is just another legal game). MPlayer supports only v1.0, as nobody has ever seen v2.0 files :). Note that ASF files nowadays come with the extension .WMA or .WMV.

2.1.1.4. QuickTime/MOV files

These formats were designed by Apple. They usually have a .QT or .MOV extension. Note that since the MPEG4 group chose QuickTime as the recommended file format for MPEG4, their MOV files come with a .MPG or .MP4 extension (Interestingly the video and audio streams in these files are real MPG and AAC files. With the `-dumpvideo` and `-dumpaudio` options you can even extract them!).

Codecs: Any codec is allowed, both CBR and VBR. Note: most new QuickTime files use Sorensen video and QDesign Music audio. These formats have not been disclosed and will probably remain so in the future, making Apple's QuickTime player the only player able to play these files (on Windows/Mac OS only).

2.1.1.5. VIV files

MPlayer happily demuxes VIVO file formats. The biggest disadvantage of the format is that it has no index block, nor a fixed packet size or sync bytes and most files lack even keyframes, so forget seeking!

The video codec of VIVO/1.0 files is standard h.263. The video codec of VIVO/2.0 files is a modified, nonstandard h.263v2. The audio is the same, it may be g.723 (standard), or Vivo Siren.

See the VIVO video codec and VIVO audio codec sections for installation instructions.

2.1.1.6. FLI files

FLI is a very old file format used by Autodesk Animator, but it is a common file format for short animations on the net. MPlayer demuxes and decodes FLI movies and is even able to seek within them (useful when looping with the `-loop` option). FLI files do not have keyframes, so the picture will be messy for a short time after seeking.

2.1.1.7. RealMedia (RM) files

Yes, MPlayer can read (demux) RealMedia (.rm) files. Seeking works (the format supports keyframes). Here are the lists of the supported RealVideo and RealAudio codecs.

2.1.1.8. NuppelVideo files

NuppelVideo is a TV grabber tool (AFAIK:). MPlayer can read its .NUV files (only NuppelVideo 5.0). Those files can contain uncompressed YV12, YV12+RTJpeg compressed, YV12 RTJpeg+lzo compressed, and YV12+lzo compressed frames. MPlayer decodes (and also encodes them with MEncoder to DivX/etc!) them all. Seeking works.

2.1.1.9. yuv4mpeg files

yuv4mpeg / yuv4mpeg2 is a file format used by the mjpegtools programs. You can grab, produce, filter or encode video in this format using these. The file format is really a sequence of uncompressed YUV 4:2:0 images.

2.1.1.10. FILM files

This format is used on old Sega Saturn CD-Rom games.

2.1.1.11. RoQ files

RoQ files are multimedia files used in some ID games such as Quake III and Return to Castle Wolfenstein.

2.1.1.12. OGG files

This is a new fileformat from Xiphophorus, developed to contain Vorbis audio. You'll need `libogg` and `libvorbis` installed before compiling MPlayer to be able to play it.

2.1.2. Audio formats

MPlayer is a Movie and not a Media player, although it can play some audio file formats (they are listed in the sections below). This is not a recommended usage of MPlayer, you better use xmms.

2.1.2.1. MP3 files

You may have problems playing certain MP3 files that MPlayer will misdetect as MPEGs and play incorrectly or not at all. This cannot be fixed without dropping support for certain broken MPEG files and thus will remain like this for the foreseeable future. The `-demuxer` flag described in the manpage may help you in these cases.

2.1.2.2. WAV files

2.1.2.3. OGG files (Vorbis)

Requires properly installed `libogg` and `libvorbis`.

2.1.2.4. WMA/ASF files

2.1.2.5. MP4 files