Extended options and controls

  MPlayer - The Movie Player


Screenshot on Absolute OS

http://www.mplayerhq.hu


Table of Contents

How to read this documentation
1. Introduction
2. Installation
2.1. Software requirements
2.2. Video cards
2.2.1. YUV cards
2.2.2. Non-YUV cards
2.2.3. Cirrus-Logic cards
2.3. Sound cards
2.4. Features
2.5. What about the GUI?
2.6. Fonts and OSD
2.6.1. TrueType fonts
2.6.2. bitmap fonts
2.6.3. OSD menu
2.7. RTC
3. Usage
3.1. Command line
3.2. Subtitles and OSD
3.3. Control
3.3.1. Controls configuration
3.3.2. Control from LIRC
3.3.3. Slave mode
3.4. Streaming from network or pipes
3.4.1. Saving streamed content
3.5. Remote streams
3.5.1. Compiling the server
3.5.2. Using remote streams
3.6. Edit Decision Lists (EDL)
3.6.1. Using an EDL file
3.6.2. Making an EDL file
3.7. Advanced audio
3.7.1. Surround/Multichannel playback
3.7.1.1. DVDs
3.7.1.2. Playing stereo files to four speakers
3.7.1.3. AC3/DTS Passthrough
3.7.1.4. MPEG audio Passthrough
3.7.1.5. Matrix-encoded audio
3.7.1.6. Surround emulation in headphones
3.7.1.7. Troubleshooting
3.7.2. Channel manipulation
3.7.2.1. General information
3.7.2.2. Playing mono with two speakers
3.7.2.3. Channel copying/moving
3.7.2.4. Channel mixing
3.7.3. Software Volume adjustment
4. CD/DVD usage
4.1. CD/DVD drives
4.1.1. Linux
4.1.2. FreeBSD
4.2. DVD playback
4.3. VCD playback
5. Frequently Asked Questions
6. Containers
6.1. Video formats
6.1.1. MPEG files
6.1.2. AVI files
6.1.3. ASF/WMV files
6.1.4. QuickTime/MOV files
6.1.5. VIVO files
6.1.6. FLI files
6.1.7. RealMedia (RM) files
6.1.8. NuppelVideo files
6.1.9. yuv4mpeg files
6.1.10. FILM files
6.1.11. RoQ files
6.1.12. OGG/OGM files
6.1.13. SDP files
6.1.14. PVA files
6.1.15. NSV files
6.1.16. Matroska files
6.1.17. NUT files
6.1.18. GIF files
6.2. Audio formats
6.2.1. MP3 files
6.2.2. OGG/OGM files (Vorbis)
6.2.3. CD audio
6.2.4. XMMS
7. Codecs
7.1. Video codecs
7.1.1. FFmpeg/libavcodec
7.1.2. XAnim codecs
7.1.3. VIVO video
7.1.4. MPEG-1/2 video
7.1.5. MS Video1, Cinepak CVID, and other older codecs
7.1.6. RealVideo
7.1.7. XviD
7.1.8. Sorenson
7.1.9. x264
7.1.9.1. What is x264?
7.1.9.2. What is H.264?
7.1.9.3. How can I play H.264 videos with MPlayer?
7.1.9.4. How can I encode videos using MEncoder and x264?
7.2. Audio codecs
7.2.1. Software AC3 decoding
7.2.2. Hardware AC3 decoding
7.2.3. libmad support
7.2.4. Hardware MPEG audio codec
7.2.5. VIVO audio
7.2.6. RealAudio
7.2.7. QDesign codecs
7.2.8. Qualcomm codecs
7.2.9. AAC codec
7.2.10. AMR codecs
7.3. Win32 codecs importing HOWTO
7.3.1. VFW codecs
7.3.2. DirectShow codecs
8. Video output devices
8.1. Setting up MTRR
8.2. Video outputs for traditional video cards
8.2.1. Xv
8.2.1.1. 3dfx cards
8.2.1.2. S3 cards
8.2.1.3. nVidia cards
8.2.1.4. ATI cards
8.2.1.5. NeoMagic cards
8.2.1.6. Trident cards
8.2.1.7. Kyro/PowerVR cards
8.2.2. DGA
8.2.3. SDL
8.2.4. SVGAlib
8.2.5. Framebuffer output (FBdev)
8.2.6. Matrox framebuffer (mga_vid)
8.2.7. 3Dfx YUV support
8.2.8. OpenGL output
8.2.9. AAlib - text mode displaying
8.2.10. libcaca - Color ASCII Art library
8.2.11. VESA - output to VESA BIOS
8.2.12. X11
8.2.13. VIDIX
8.2.13.1. ATI cards
8.2.13.2. Matrox cards
8.2.13.3. Trident cards
8.2.13.4. 3DLabs cards
8.2.13.5. nVidia cards
8.2.13.6. SiS cards
8.2.14. DirectFB
8.2.15. DirectFB/Matrox (dfbmga)
8.3. MPEG decoders
8.3.1. DVB output and input
8.3.2. DXR2
8.3.3. DXR3/Hollywood+
8.4. Other visualization hardware
8.4.1. Zr
8.4.2. Blinkenlights
8.5. TV-out support
8.5.1. Matrox G400 cards
8.5.2. Matrox G450/G550 cards
8.5.3. ATI cards
8.5.4. nVidia
8.5.5. NeoMagic
9. Audio output devices
9.1. Audio/Video synchronization
9.2. Troubleshooting
10. TV
10.1. TV input
10.1.1. Compilation
10.1.2. Usage tips
10.1.3. Examples
11. Radio
11.1. Radio input
11.1.1. Compilation
11.1.2. Usage tips
11.1.3. Examples
12. Ports
12.1. Linux
12.1.1. Debian packaging
12.1.2. RPM packaging
12.1.3. ARM
12.2. *BSD
12.2.1. FreeBSD
12.2.2. OpenBSD
12.2.3. Darwin
12.3. Commercial Unix
12.3.1. Solaris
12.3.2. IRIX
12.3.3. HP-UX
12.3.4. AIX
12.4. Windows
12.4.1. Cygwin
12.4.2. MinGW
12.5. Mac OS
12.5.1. MPlayer OS X GUI
12.6. Exotic Platforms
12.6.1. QNX
12.6.2. Amiga/MorphOS (GeekGadgets)
13. Basic usage of MEncoder
13.1. Selecting codecs and container formats
13.2. Selecting input file or device
13.3. Encoding two pass MPEG-4 ("DivX")
13.4. Encoding to Sony PSP video format
13.5. Encoding to MPEG format
13.6. Rescaling movies
13.7. Stream copying
13.8. Encoding from multiple input image files (JPEG, PNG, TGA, SGI)
13.9. Extracting DVD subtitles to VOBsub file
13.10. Preserving aspect ratio
14. Encoding with MEncoder
14.1. Making a high quality MPEG-4 ("DivX") rip of a DVD movie
14.1.1. Preparing to encode: Identifying source material and framerate
14.1.1.1. Identifying source framerate
14.1.1.2. Identifying source material
14.1.2. Constant quantizer vs. multipass
14.1.3. Constraints for efficient encoding
14.1.4. Cropping and Scaling
14.1.5. Choosing resolution and bitrate
14.1.5.1. Computing the resolution
14.1.6. Filtering
14.1.7. Interlacing and Telecine
14.1.8. Encoding interlaced video
14.1.9. Notes on Audio/Video synchronization
14.1.10. Choosing the video codec
14.1.11. Audio
14.1.12. Muxing
14.1.12.1. Improving muxing and A/V sync reliability
14.1.12.2. Limitations of the AVI container
14.1.12.3. Muxing into the Matroska container
14.2. How to deal with telecine and interlacing within NTSC DVDs
14.2.1. Introduction
14.2.2. How to tell what type of video you have
14.2.2.1. Progressive
14.2.2.2. Telecined
14.2.2.3. Interlaced
14.2.2.4. Mixed progressive and telecine
14.2.2.5. Mixed progressive and interlaced
14.2.3. How to encode each category
14.2.3.1. Progressive
14.2.3.2. Telecined
14.2.3.3. Interlaced
14.2.3.4. Mixed progressive and telecine
14.2.3.5. Mixed progressive and interlaced
14.2.4. Footnotes
14.3. Encoding with the libavcodec codec family
14.3.1. libavcodec's video codecs
14.3.2. libavcodec's audio codecs
14.3.3. Encoding options of libavcodec
14.3.4. Encoding setting examples
14.3.5. Custom inter/intra matrices
14.3.6. Example
14.4. Encoding with the XviD codec
14.4.1. What options should I use to get the best results?
14.4.2. Encoding options of XviD
14.4.3. Encoding profiles
14.4.4. Encoding setting examples
14.5. Encoding with the x264 codec
14.5.1. Encoding options of x264
14.5.1.1. Introduction
14.5.1.2. Options which primarily affect speed and quality
14.5.1.3. Options pertaining to miscellaneous preferences
14.5.2. Encoding setting examples
14.6. Encoding with the Video For Windows codec family
14.6.1. Video for Windows supported codecs
14.7. Using MEncoder to create VCD/SVCD/DVD-compliant files.
14.7.1. Format Constraints
14.7.1.1. Format Constraints
14.7.1.2. GOP Size Constraints
14.7.1.3. Bitrate Constraints
14.7.2. Output Options
14.7.2.1. Aspect Ratio
14.7.2.2. Maintaining A/V sync
14.7.2.3. Sample Rate Conversion
14.7.3. Using libavcodec for VCD/SVCD/DVD Encoding
14.7.3.1. Introduction
14.7.3.2. lavcopts
14.7.3.3. Examples
14.7.3.4. Advanced Options
14.7.4. Encoding Audio
14.7.4.1. toolame
14.7.4.2. twolame
14.7.4.3. libavcodec
14.7.5. Putting it all Together
14.7.5.1. PAL DVD
14.7.5.2. NTSC DVD
14.7.5.3. PAL AVI Containing AC3 Audio to DVD
14.7.5.4. NTSC AVI Containing AC3 Audio to DVD
14.7.5.5. PAL SVCD
14.7.5.6. NTSC SVCD
14.7.5.7. PAL VCD
14.7.5.8. NTSC VCD
A. How to report bugs
A.1. Report security releated bugs
A.2. How to fix bugs
A.3. How to do regression testing using Subversion
A.4. How to report bugs
A.5. Where to report bugs
A.6. What to report
A.6.1. System Information
A.6.2. Hardware and drivers
A.6.3. Configure problems
A.6.4. Compilation problems
A.6.5. Playback problems
A.6.6. Crashes
A.6.6.1. How to conserve information about a reproducible crash
A.6.6.2. How to extract meaningful information from a core dump
A.7. I know what I am doing...
B. Known bugs
B.1. Special system/CPU-specific bugs/problems
B.2. Various A-V sync and other audio problems
B.2.1. General audio delay or jerky sound (exists with all or many files)
B.2.2. Audio delay/de-sync specific to one or a few files
B.2.3. No sound at all
B.2.4. No picture at all (just plain grey/green window)
B.2.5. Video-out problems
C. MPlayer skin format
C.1. Overview
C.1.1. Directories
C.1.2. Image formats
C.1.3. Skin components
C.1.4. Files
C.2. The skin file
C.2.1. Main window and playbar
C.2.2. Subwindow
C.2.3. Skin menu
C.3. Fonts
C.3.1. Symbols
C.4. GUI messages
C.5. Creating quality skins
D. History

How to read this documentation

If you are a first-time installer: be sure to read everything from here to the end of the Installation section, and follow the links you will find. If you have any other questions, return to the Table of Contents and search for the topic, read the FAQ, or try grepping through the files. Most questions should be answered somewhere here and the rest has probably already been asked on our mailing lists.

Chapter 1. Introduction

MPlayer is a movie player for Linux (runs on many other Unices, and non-x86 CPUs, see Ports). It plays most MPEG, VOB, AVI, OGG/OGM, VIVO, ASF/WMA/WMV, QT/MOV/MP4, FLI, RM, NuppelVideo, yuv4mpeg, FILM, RoQ, PVA, Matroska files, supported by many native, XAnim, RealPlayer, and Win32 DLL codecs. You can watch VideoCD, SVCD, DVD, 3ivx, RealMedia, Sorenson, Theora, and MPEG-4 (DivX) movies too. Another big feature of MPlayer is the wide range of supported output drivers. It works with X11, Xv, DGA, OpenGL, SVGAlib, fbdev, AAlib, libcaca, DirectFB, but you can use GGI and SDL (and this way all their drivers) and some lowlevel card-specific drivers (for Matrox, 3Dfx and Radeon, Mach64, Permedia3) too! Most of them support software or hardware scaling, so you can enjoy movies in fullscreen. MPlayer supports displaying through some hardware MPEG decoder boards, such as the DVB and DXR3/Hollywood+. And what about the nice big antialiased shaded subtitles (14 supported types) with European/ISO 8859-1,2 (Hungarian, English, Czech, etc), Cyrillic, Korean fonts, and the onscreen display (OSD)?

The player is rock solid playing damaged MPEG files (useful for some VCDs), and it plays bad AVI files which are unplayable with the famous windows media player. Even AVI files without index chunk are playable, and you can temporarily rebuild their indexes with the -idx option, or permanently with MEncoder, thus enabling seeking! As you see, stability and quality are the most important things, but the speed is also amazing. There is also a powerful filter system for video and audio manipulation.

MEncoder (MPlayer's Movie Encoder) is a simple movie encoder, designed to encode MPlayer-playable movies (AVI/ASF/OGG/DVD/VCD/VOB/MPG/MOV/VIV/FLI/RM/NUV/NET/PVA) to other MPlayer-playable formats (see below). It can encode with various codecs, like MPEG-4 (DivX4) (one or two passes), libavcodec, PCM/MP3/VBR MP3 audio.

MEncoder features

  • Encoding from the wide range of fileformats and decoders of MPlayer
  • Encoding to all the codecs of FFmpeg's libavcodec
  • Video encoding from V4L compatible TV tuners
  • Encoding/multiplexing to interleaved AVI files with proper index
  • Creating files from external audio stream
  • 1, 2 or 3 pass encoding
  • VBR MP3 audio

    Important

    VBR MP3 audio doesn't always play nicely on windows players!

  • PCM audio
  • Stream copying
  • Input A/V synchronizing (PTS-based, can be disabled with -mc 0 option)
  • fps correction with -ofps option (useful when encoding 30000/1001 fps VOB to 24000/1001 fps AVI)
  • Using our very powerful filter system (crop, expand, flip, postprocess, rotate, scale, rgb/yuv conversion)
  • Can encode DVD/VOBsub AND text subtitles into the output file
  • Can rip DVD subtitles to VOBsub format

Planned features

  • Even wider variety of available en/decoding formats/codecs (creating VOB files with DivX4/Indeo5/VIVO streams :).

MPlayer and MEncoder can be distributed under the terms of the GNU General Public License Version 2.

Chapter 2. Installation

A quick installation guide can be found in the README file. Please read it first and then come back here for the rest of the gory details.

In this section I'll try to guide you through the compiling and configuring process of MPlayer. It's not easy, but it won't necessarily be hard. If you experience a different behavior than what I explain, please search through this documentation and you'll find your answers. If you see links, please follow them and read carefully what they contain. It will take some time, but it IS worth it.

You need a fairly recent system. On Linux, 2.4.x kernels are recommended.

2.1. Software requirements

  • binutils - Recommended version is 2.11.x. This program is responsible for generating MMX/ 3DNow!/etc instructions, thus very important.

  • gcc - Recommended versions are 2.95 and 3.3+. 2.96 and 3.0.x are known to generate faulty code, 3.1 and 3.2 also had problems. On PowerPC, use 4.x+.

  • XFree86 - Recommended version is always the newest (4.3). Normally, everyone wants this, as starting with XFree86 4.0.2, it contains the XVideo extension (somewhere referred to as Xv) which is needed to enable the hardware YUV acceleration (fast image display) on cards that support it. Make sure its development package is installed, too, otherwise it won't work. For some video cards you don't need XFree86. See list below.

  • make - Recommended version is always the newest (at least 3.79.x). This usually isn't important.

  • FreeType 2.0.9 or later is required to have a font for the OSD and subtitles.

  • SDL - it's not mandatory, but can help in some cases (bad audio, video cards that lag strangely with the xv driver). Always use the newest (beginning from 1.2.x).

  • libjpeg - optional JPEG decoder, used by the -mf option and some QT MOV files. Useful for both MPlayer and MEncoder if you plan to work with jpeg files.

  • libpng - recommended and default (M)PNG decoder. Required for GUI. Useful for both MPlayer and MEncoder.

  • lame - recommended, needed for encoding MP3 audio with MEncoder, recommended version is always the newest (at least 3.90).

  • zlib - recommended, necessary for compressed MOV header and PNG support.

  • libogg - optional, needed for playing OGG file format.

  • libvorbis - optional, needed for playing OGG Vorbis audio.

  • LIVE555 Streaming Media - optional, needed for playing RTSP/RTP streams.

  • directfb - optional, from http://www.directfb.org. At least 0.9.13 is required.

  • cdparanoia - optional, for CDDA support

  • libxmms - optional, for XMMS input plugin support. At least 1.2.7 is required.

  • libsmb - optional, for Samba support.

  • ALSA - optional, for ALSA audio output support. At least 0.9.0rc4 is required.

  • bio2jack - optional, for JACK audio output support, needed only in compile time. You can obtain it from http://bio2jack.sf.net. Since it doesn't have install option you have to manually put the file libbio2jack.a somewhere in your library path (e.g. /usr/local/lib) or use the --with-bio2jack=DIR switch to tell ./configure where that file is.

2.2. Video cards

There are generally two kind of video cards. One kind (the newer cards) has hardware scaling and YUV acceleration support, the other cards don't.

2.2.1. YUV cards

They can display and scale (zoom) the picture to any size that fits in their memory, with small CPU usage (even when zooming), thus fullscreen is nice and very fast.

  • Matrox G200/G400/G450/G550 cards: although a Vidix driver is provided, it is recommended to use the mga_vid module instead, for it works much better. Please see the mga_vid section about its installation and usage. It is important to do these steps before compiling MPlayer, otherwise no mga_vid support will be built. Also check out the Matrox TV-out section. If you don't use Linux, your only possibility is the VIDIX driver: read the VIDIX section.

  • 3Dfx Voodoo3/Banshee cards: please see tdfxfb section in order to gain big speedup. It is important to do these steps before compiling MPlayer, otherwise no 3Dfx support will be built. If you use X, use at least 4.2.0, as 3dfx Xv driver was broken in 4.1.0, and earlier releases.

  • ATI cards: VIDIX driver is provided for the following cards: Radeon, Rage128, Mach64 (Rage XL/Mobility, Xpert98). Also see the ATI cards section of the TV-out documentation, to know if you card's TV-out is supported under Linux/MPlayer.

  • S3 cards: the Savage and Virge/DX chips have hardware acceleration. Use as new XFree86 version as possible, older drivers are buggy. Savage chips have problems with YV12 display, see S3 Xv section for details. Older, Trio cards have no, or slow hardware support.

  • nVidia cards: may or may not be good choice for video playing. If you do not have a GeForce2 (or newer) card, it's not likely to work without bugs. the built-in nVidia driver in XFree86 does not support hardware YUV acceleration on all nVidia cards. You have to download nVidia's closed-source drivers from nVidia.com. See the nVidia Xv driver section for details. Please also check the nVidia TV-out section if you wish to use a TV.

  • 3DLabs GLINT R3 and Permedia3: a VIDIX driver is provided (pm3_vid). Please see the VIDIX section for details.

  • Other cards: none of the above?

    • Try if the XFree86 driver (and your card) supports hardware acceleration. See the Xv section for details.
    • If it doesn't, then your card's video features aren't supported under your operating system :( If hardware scaling works under Windows, it doesn't mean it will work under Linux or other operating system, it depends on the drivers. Most manufacturers neither make Linux drivers nor release specifications of their chips - so you are unlucky if using their cards. See Non-YUV cards.

2.2.2. Non-YUV cards

Fullscreen playing can be achieved by either enabling software scaling (use the -zoom or -vf option, but I warn you: this is slow), or switching to a smaller video mode, for example 352x288. If you don't have YUV acceleration, this latter method is recommended. Video mode switching can be enabled by using the -vm option and it works with the following drivers:

  • using XFree86: see details in DGA driver and X11 driver sections. DGA is recommended! Also try DGA via SDL, sometimes it's better.
  • not using XFree86: try the drivers in the following order: vesa, fbdev, svgalib, aalib.

2.2.3. Cirrus-Logic cards

  • GD 7548: present on-board and tested in Compaq Armada 41xx notebook series.

    • XFree86 3: works in 8/16bpp modes. However, the driver is dramatically slow and buggy in 800x600@16bpp. Recommended: 640x480@16bpp
    • XFree86 4: the Xserver freezes soon after start unless acceleration is disabled, but then the whole thing gets slower than XFree86 3. No XVideo.
    • FBdev: framebuffer can be turned on with the clgenfb driver in the kernel, though for me it worked only in 8bpp, thus unusable. The clgenfb source had to be extended with the 7548 ID before compilation.
    • VESA: the card is only VBE 1.2 capable, so VESA output can't be used. Can't be workarounded with UniVBE.
    • SVGAlib: detects an older Cirrus chip. Usable but slow with -bpp 8.

2.3. Sound cards

  • Soundblaster Live!: with this card you can use 4 or 6 (5.1) channels AC3 decoding instead of 2. Read the Software AC3 decoding section. For hardware AC3 passthrough you must use ALSA 0.9 with OSS emulation!
  • C-Media with S/PDIF out: hardware AC3 passthrough is possible with these cards, see Hardware AC3 decoding section.
  • Features of other cards aren't supported by MPlayer. It's very recommended to read the sound card section!

2.4. Features

  • Decide if you need GUI. If you do, see the GUI section before compiling.

  • If you want to install MEncoder (our great all-purpose encoder), see the MEncoder section.

  • If you have a V4L compatible TV tuner card, and wish to watch/grab and encode movies with MPlayer, read the TV input section.

  • If you have a V4L compatible radio tuner card, and wish to listen and capture sound with MPlayer, read the radio section.

  • There is a neat OSD Menu support ready to be used. Check the OSD menu section.

Then build MPlayer:

./configure
make
make install

At this point, MPlayer is ready to use. The directory $PREFIX/share/mplayer contains the codecs.conf file, which is used to tell the program all the codecs and their capabilities. This file is needed only when you want to change its properties, as the main binary contains an internal copy of it. Check if you have codecs.conf in your home directory (~/.mplayer/codecs.conf) left from old MPlayer versions, and remove it.

Note that if you have a codecs.conf in ~/.mplayer/, the builtin and system codecs.conf will be ignored completely. Do not do this unless you want to fiddle with MPlayer internals as this can can cause many problems. If you want to change the codecs search order, use the -vc, -ac, -vfm, or -afm options either on the command line or in your config file (see the manual page).

Debian users can build a .deb package for themselves, it's very simple. Just exec

fakeroot debian/rules binary

in MPlayer's root directory. See Debian packaging for detailed instructions.

Always browse the output of ./configure, and the configure.log file, they contain information about what will be built, and what will not. You may also want to view config.h and config.mak files. If you have some libraries installed, but not detected by ./configure, then check if you also have the proper header files (usually the -dev packages) and their version matches. The configure.log file usually tells you what is missing.

Though not mandatory, the fonts should be installed in order to gain OSD, and subtitle functionality. The recommended method is installing a TTF font file and telling MPlayer to use it. See the Subtitles and OSD section for details.

2.5. What about the GUI?

The GUI needs GTK 1.2.x or GTK 2.0 (it isn't fully GTK, but the panels are). The skins are stored in PNG format, so GTK, libpng (and their devel stuff, usually called gtk-dev and libpng-dev) has to be installed. You can build it by specifying --enable-gui during ./configure. Then, to turn on GUI mode, you have to execute the gmplayer binary.

Currently you can't use the -gui option on the command line, due to technical reasons.

As MPlayer doesn't have a skin included, you have to download them if you want to use the GUI. See the download page. They should be extracted to the usual system-wide directory ($PREFIX/share/mplayer/skins), or to $HOME/.mplayer/skins. MPlayer by default looks in these directories for a directory named default, but you can use the -skin newskin option, or the skin=newskin config file directive to use the skin in */skins/newskin directory.

2.6. Fonts and OSD

You need to tell MPlayer which font to use to enjoy OSD and subtitles. Any TrueType font or special bitmap fonts will work. However, TrueType fonts are recommended as they look far better, can be properly scaled to the movie size and cope better with different encodings.

2.6.1. TrueType fonts

There are two ways to get TrueType fonts to work. The first is to pass the -font option to specify a TrueType font file on the command line. This option will be a good candidate to put in your configuration file (see the manual page for details). The second is to create a symlink called subfont.ttf to the font file of your choice. Either

ln -s /path/to/sample_font.ttf ~/.mplayer/subfont.ttf

for each user individually or a system-wide one:

ln -s /path/to/sample_font.ttf $PREFIX/share/mplayer/subfont.ttf

If MPlayer was compiled with fontconfig support, the above methods won't work, instead -font expects a fontconfig font name and defaults to the sans-serif font. To get a list of fonts known to fontconfig, use fc-list. Example:

mplayer -font 'Bitstream Vera Sans' anime.mkv

2.6.2. bitmap fonts

If for some reason you wish or need to employ bitmap fonts, download a set from our homepage. You can choose between various ISO fonts and some sets of fonts contributed by users in various encodings.

Uncompress the file you downloaded to ~/.mplayer or $PREFIX/share/mplayer. Then rename or symlink one of the extracted directories to font, for example:

ln -s ~/.mplayer/arial-24 ~/.mplayer/font

ln -s $PREFIX/share/mplayer/arial-24 $PREFIX/share/mplayer/font

Fonts should have an appropriate font.desc file which maps unicode font positions to the actual code page of the subtitle text. Another solution is to have UTF-8-encoded subtitles and use the -utf8 option or just name the subtitles file <video_name>.utf and have it in the same directory as the video file.

2.6.3. OSD menu

MPlayer has a completely user definiable OSD Menu interface.

Note

the Preferences menu is currently UNIMPLEMENTED!

Installation

  1. compile MPlayer by passing the --enable-menu to ./configure
  2. make sure you have an OSD font installed
  3. copy etc/menu.conf to your .mplayer directory
  4. copy etc/input.conf to your .mplayer directory, or to the system-wide MPlayer config dir (default: /usr/local/etc/mplayer)
  5. check and edit input.conf to enable menu movement keys (it is described there).
  6. start MPlayer by the following example:

    $ mplayer -menu file.avi

  7. push any menu key you defined

2.7. RTC

There are three timing methods in MPlayer.

  • To use the old method, you don't have to do anything. It uses usleep() to tune A/V sync, with +/- 10ms accuracy. However sometimes the sync has to be tuned even finer.
  • The new timer code uses the RTC (RealTime Clock) for this task, because it has precise 1ms timers. The -rtc option enables it, but a properly set up kernel is required. If you are running kernel 2.4.19pre8 or later you can adjust the maximum RTC frequency for normal users through the /proc filesystem. Use one of the following two commands to enable RTC for normal users:

    echo 1024 > /proc/sys/dev/rtc/max-user-freq

    sysctl dev/rtc/max-user-freq=1024

    You can make this setting permanent by adding the latter to /etc/sysctl.conf.

    You can see the new timer's efficiency in the status line. The power management functions of some notebook BIOSes with speedstep CPUs interact badly with RTC. Audio and video may get out of sync. Plugging the external power connector in before you power up your notebook seems to help. In some hardware combinations (confirmed during usage of non-DMA DVD drive on an ALi1541 board) usage of the RTC timer causes skippy playback. It's recommended to use the third method in these cases.

  • The third timer code is turned on with the -softsleep option. It has the efficiency of the RTC, but it doesn't use RTC. On the other hand, it requires more CPU.

Chapter 3. Usage

3.1. Command line

MPlayer utilizes a complex playtree. It consists of global options written as first, for example

mplayer -vfm 5

and options written after filenames, that apply only to the given filename/URL/whatever, for example:

mplayer -vfm 5 movie1.avi movie2.avi -vfm 4

You can group filenames/URLs together using { and }. It is useful with option -loop:

mplayer { 1.avi -loop 2 2.avi } -loop 3

The above command will play files in this order: 1, 1, 2, 1, 1, 2, 1, 1, 2.

Playing a file:

mplayer [options] [path/]filename

Another way to play a file:

mplayer [options] file:///uri-escaped-path

Playing more files:

mplayer [default options] [path/]filename1 [options for filename1] filename2 [options for filename2] ...

Playing VCD:

mplayer [options] vcd://trackno [-cdrom-device /dev/cdrom]

Playing DVD:

mplayer [options] dvd://titleno [-dvd-device /dev/dvd]

Playing from the WWW:

mplayer [options] http://site.com/file.asf

(playlists can be used, too)

Playing from RTSP:

mplayer [options] rtsp://server.example.com/streamName

Examples:

mplayer -vo x11 /mnt/Films/Contact/contact2.mpg
mplayer vcd://2 -cdrom-device /dev/hdc
mplayer -afm 3 /mnt/DVDtrailers/alien4.vob
mplayer dvd://1 -dvd-device /dev/hdc
mplayer -abs 65536 -delay -0.4 -nobps ~/movies/test.avi

3.2. Subtitles and OSD

MPlayer can display subtitles along with movie files. Currently the following formats are supported:

  • VOBsub

  • OGM

  • CC (closed caption)

  • MicroDVD

  • SubRip

  • SubViewer

  • Sami

  • VPlayer

  • RT

  • SSA

  • PJS (Phoenix Japanimation Society)

  • MPsub

  • AQTitle

  • JACOsub

MPlayer can dump the previously listed subtitle formats (except the three first) into the following destination formats, with the given options:

  • MPsub: -dumpmpsub

  • SubRip: -dumpsrtsub

  • MicroDVD: -dumpmicrodvdsub

  • JACOsub: -dumpjacosub

  • Sami: -dumpsami

MEncoder can dump DVD subtitles into VOBsub format.

The command line options differ slightly for the different formats:

VOBsub subtitles.  VOBsub subtitles consist of a big (some megabytes) .SUB file, and optional .IDX and/or .IFO files. If you have files like sample.sub, sample.ifo (optional), sample.idx - you have to pass MPlayer the -vobsub sample [-vobsubid id] options (full path optional). The -vobsubid option is like -sid for DVDs, you can choose between subtitle tracks (languages) with it. In case that -vobsubid is omitted, MPLayer will try to use the languages given by the -slang option and fall back to the langidx in the .IDX file to set the subtitle language. If it fails, there will be no subtitles.

Other subtitles.  The other formats consist of a single text file containing timing, placement and text information. Usage: If you have a file like sample.txt, you have to pass the option -sub sample.txt (full path optional).

Adjusting subtitle timing and placement:

-subdelay sec
Delays subtitles by sec seconds. Can be negative. The value is added to movie's time position counter.
-subfps RATE
Specify frame/sec rate of subtitle file (float number).
-subpos 0-100
Specify the position of subtitles.

If you experience a growing delay between the movie and the subtitles when using a MicroDVD subtitle file, most likely the framerate of the movie and the subtitle file are different. Please note that the MicroDVD subtitle format uses absolute frame numbers for its timing, but there is no fps information in it, and therefore the -subfps option should be used with this format. If you like to solve this problem permanently, you have to manually convert the subtitle file framerate. MPlayer can do this conversion for you:

mplayer -dumpmicrodvdsub -fps subtitles_fps -subfps avi_fps -sub subtitle_filename dummy.avi

About DVD subtitles, read the DVD section.

3.3. Control

MPlayer has a fully configurable, command driven, control layer which lets you control MPlayer with keyboard, mouse, joystick or remote control (using LIRC). See the man page for the complete list of keyboard controls.

3.3.1. Controls configuration

MPlayer allows you bind any key/button to any MPlayer command using a simple config file. The syntax consist of a key name followed by a command. The default config file location is $HOME/.mplayer/input.conf but it can be overridden using the -input conf option (relative path are relative to $HOME/.mplayer).

You can get a full list of supported key names by running mplayer -input keylist and a full list of available commands by running mplayer -input cmdlist.

Example 3.1. A simple input control file

##
## MPlayer input control file
##

RIGHT seek +10
LEFT seek -10
- audio_delay 0.100
+ audio_delay -0.100
q quit
> pt_step 1
< pt_step -1
ENTER pt_step 1 1

3.3.2. Control from LIRC

Linux Infrared Remote Control - use an easy to build home-brewn IR-receiver, an (almost) arbitrary remote control and control your Linux box with it! More about it on the LIRC homepage.

If you have the LIRC package installed, configure will autodetect it. If everything went fine, MPlayer will print "Setting up LIRC support..." on startup. If an error occurs it will tell you. If there is no message about LIRC there is no support compiled in. That's it :-)

The application name for MPlayer is - surprise - mplayer. You can use any MPlayer commands and even pass more than one command by separating them with \n. Do not forget to enable the repeat flag in .lircrc when it makes sense (seek, volume, etc). Here is an excerpt from a sample .lircrc:

begin
     button = VOLUME_PLUS
     prog = mplayer
     config = volume 1
     repeat = 1
end

begin
    button = VOLUME_MINUS
    prog = mplayer
    config = volume -1
    repeat = 1
end

begin
    button = CD_PLAY
    prog = mplayer
    config = pause
end

begin
    button = CD_STOP
    prog = mplayer
    config = seek 0 1\npause
end

If you do not like the standard location for the lirc-config file (~/.lircrc) use the -lircconf filename switch to specify another file.

3.3.3. Slave mode

The slave mode allows you to build simple frontends to MPlayer. When run with the -slave option MPlayer will read commands separated by a newline (\n) from stdin. The commands are documented in the slave.txt file.

3.4. Streaming from network or pipes

MPlayer can play files from the network, using the HTTP, FTP, MMS or RTSP/RTP protocol.

Playing works simply by passing the URL on the command line. MPlayer honors the http_proxy environment variable, using a proxy if available. Proxies can also be forced:

mplayer http_proxy://proxy.micorsops.com:3128/http://micorsops.com:80/stream.asf

MPlayer can read from stdin (not named pipes). This can for example be used to play from FTP:

wget ftp://micorsops.com/something.avi -O - | mplayer -

Note

It is also recommended to enable -cache when playing from the network:

wget ftp://micorsops.com/something.avi -O - | mplayer -cache 8192 -

3.4.1. Saving streamed content

Once you succeed in making MPlayer play your favorite internet stream, you can use the option -dumpstream to save the stream into a file. For example:

  mplayer http://217.71.208.37:8006 -dumpstream -dumpfile stream.asf

will save the content streamed from http://217.71.208.37:8006 into stream.asf. This works with all protocols supported by MPlayer, like MMS, RSTP, and so forth.

3.5. Remote streams

Remote streams allow you to access most MPlayer stream type from a remote host. The main purpose of this feature is to make it possible to directly use the CD or DVD drive of another computer on the network (provided you have the required bandwidth). On the downside some stream type (currently TV and MF) are not usable remotely because they are implemented at the demuxer level. It is sad for MF but TV stream would anyway require an insane amount of bandwidth.

3.5.1. Compiling the server

After having compiled MPlayer go to the TOOLS/netstream directory and enter make to build the server binary. You can then copy the netstream binary to the right place on your system (usually /usr/local/bin on Linux).

3.5.2. Using remote streams

First you have to start the server on the computer you intend to remotely access. Currently the server is very basic and does not have any commands line arguments so just enter netstream. Now you can for example play the second track of a VCD on the server with :

mplayer -cache 5000 mpst://servername/vcd://2

You can also access files on this server :

mplayer -cache 5000 mpst://servername//usr/local/movies/lol.avi

Note that paths which aren't starting with a / will be relative to the directory where the server is running. The -cache option is not needed but highly recommended.

Be aware that currently the server is not secure at all. So do not complain about the numerous exploits which are possible through this. Instead send some (good) patch to make it better or start writing your own server.

3.6. Edit Decision Lists (EDL)

The edit decision list (EDL) system allows you to automatically skip or mute sections of videos during playback, based on a movie specific EDL configuration file.

This is useful for those who may want to watch a film in "family-friendly" mode. You can cut out any violence, profanity, Jar-Jar Binks .. from a movie according to your own personal preferences. Aside from this, there are other uses, like automatically skipping over commercials in video files you watch.

The EDL file format is pretty bare-bones. There is one command per line that indicates what to do (skip/mute) and when to do it (using pts in seconds).

3.6.1. Using an EDL file

Include the -edl <filename> flag when you run MPlayer, with the name of the EDL file you want applied to the video.

3.6.2. Making an EDL file

The current EDL file format is:

[begin second] [end second] [action]

Where the seconds are floating-point numbers and the action is either 0 for skip or 1 for mute. Example:

5.3   7.1    0
15    16.7   1
420   422    0

This will skip from second 5.3 to second 7.1 of the video, then mute at 15 seconds, unmute at 16.7 seconds and skip from second 420 to second 422 of the video. These actions will be performed when the playback timer reaches the times given in the file.

To create an EDL file to work from, use the -edlout <filename> flag. During playback, just hit i to mark the beginning and end of a skip block. A corresponding entry will be written to the file for that time. You can then go back and fine-tune the generated EDL file as well as change the default operation which is to skip the block described by each line.

3.7. Advanced audio

3.7.1. Surround/Multichannel playback

3.7.1.1. DVDs

Most DVDs and many other files include surround sound. MPlayer supports surround playback but does not enable it by default because stereo equipment is by far more common. To play a file that has more than two channels of audio use -channels. For example, to play a DVD with 5.1 audio:

mplayer dvd://1 -channels 6

Note that despite the name "5.1" there are actually six discrete channels. If you have surround sound equipment it is safe to put the channels option in your MPlayer configuration file ~/.mplayer/config. For example, to make quadraphonic playback the default, add this line:

channels=4

MPlayer will then output audio in four channels when all four channels are available.

3.7.1.2. Playing stereo files to four speakers

MPlayer does not duplicate any channels by default, and neither do most audio drivers. If you want to do that manually:

mplayer filename -af channels=2:2:0:1:0:0

See the section on channel copying for an explanation.

3.7.1.3. AC3/DTS Passthrough

DVDs usually have surround audio encoded in AC3 (Dolby Digital) or DTS (Digital Theater System) format. Some modern audio equipment is capable of decoding these formats internally. MPlayer can be configured to relay the audio data without decoding it. This will only work if you have a S/PDIF (Sony/Philips Digital Interface) jack in your sound card.

If your audio equipment can decode both AC3 and DTS, you can safely enable passthrough for both formats. Otherwise, enable passthrough for only the format your equipment supports.

To enable passthrough on the command line:

  • For AC3 only, use -ac hwac3

  • For DTS only, use -ac hwdts

  • For both AC3 and DTS, use -afm hwac3

To enable passthrough in the MPlayer configuration file:

  • For AC3 only, use ac=hwac3,

  • For DTS only, use ac=hwdts,

  • For both AC3 and DTS, use afm=hwac3

Note that there is a comma (",") at the end of ac=hwac3, and ac=hwdts,. This will make MPlayer fall back on the codecs it normally uses when playing a file that does not have AC3 or DTS audio. afm=hwac3 does not need a comma; MPlayer will fall back anyway when an audio family is specified.

3.7.1.4. MPEG audio Passthrough

Digital TV transmissions (such as DVB and ATSC) and some DVDs usually have MPEG audio streams (in particular MP2). Some MPEG hardware decoders such as full-featured DVB cards and DXR2 adapters can natively decode this format. MPlayer can be configured to relay the audio data without decoding it.

To use this codec:

 mplayer -ac hwmpa 

3.7.1.5. Matrix-encoded audio

***TODO***

This section has yet to be written and cannot be completed until somebody provides sample files for us to test. If you have any matrix-encoded audio files, know where to find some, or have any information that could be helpful, please send a message to the MPlayer-DOCS mailing list. Put "[matrix-encoded audio]" in the subject line.

If no files or further information are forthcoming this section will be dropped.

Good links:

3.7.1.6. Surround emulation in headphones

MPlayer includes an HRTF (Head Related Transfer Function) filter based on an MIT project wherein measurements were taken from microphones mounted on a dummy human head.

Although it is not possible to exactly imitate a surround system, MPlayer's HRTF filter does provide more spatially immersive audio in 2-channel headphones. Regular downmixing simply combines all the channels into two; besides combining the channels, hrtf generates subtle echoes, increases the stereo separation slightly, and alters the volume of some frequencies. Whether HRTF sounds better may be dependent on the source audio and a matter of personal taste, but it is definitely worth trying out.

To play a DVD with HRTF:

mplayer dvd://1 -channels 6 -af hrtf

hrtf only works well with 5 or 6 channels. Also, hrtf requires 48 kHz audio. DVD audio is already 48 kHz, but if you have a file with a different sampling rate that you want to play using hrtf you must resample it:

mplayer filename -channels 6 -af resample=48000,hrtf

3.7.1.7. Troubleshooting

If you do not hear any sound out of your surround channels, check your mixer settings with a mixer program such as alsamixer; audio outputs are often muted and set to zero volume by default.

3.7.2. Channel manipulation

3.7.2.1. General information

Unfortunately, there is no standard for how channels are ordered. The orders listed below are those of AC3 and are fairly typical; try them and see if your source matches. Channels are numbered starting with 0.

mono

  1. center

stereo

  1. left
  2. right

quadraphonic

  1. left front
  2. right front
  3. left rear
  4. right rear

surround 4.0

  1. left front
  2. right front
  3. center rear
  4. center front

surround 5.0

  1. left front
  2. right front
  3. left rear
  4. right rear
  5. center front

surround 5.1

  1. left front
  2. right front
  3. left rear
  4. right rear
  5. center front
  6. subwoofer

The -channels option is used to request the number of channels from the audio decoder. Some audio codecs use the number of specified channels to decide if downmixing the source is necessary. Note that this does not always affect the number of output channels. For example, using -channels 4 to play a stereo MP3 file will still result in 2-channel output since the MP3 codec will not produce the extra channels.

The channels audio filter can be used to create or remove channels and is useful for controlling the number of channels sent to the sound card. See the following sections for more information on channel manipulation.

3.7.2.2. Playing mono with two speakers

Mono sounds a lot better when played through two speakers - especially when using headphones. Audio files that truly have one channel are automatically played through two speakers; unfortunately, most files with mono sound are actually encoded as stereo with one channel silent. The easiest and most foolproof way to make both speakers output the same audio is the extrastereo filter:

mplayer filename -af extrastereo=0

This averages both channels, resulting in both channels being half as loud as the original. The next sections have examples of other ways to do this without a volume decrease, but they are more complex and require different options depending on which channel to keep. If you really need to maintain the volume, it may be easier to experiment with the volume filter and find the right value. For example:

mplayer filename -af extrastereo=0,volume=5

3.7.2.3. Channel copying/moving

The channels filter can move any or all channels. Setting up all the suboptions for the channels filter can be complicated and takes a little care.

  1. Decide how many output channels you need. This is the first suboption.

  2. Count how many channel moves you will do. This is the second suboption. Each channel can be moved to several different channels at the same time, but keep in mind that when a channel is moved (even if to only one destination) the source channel will be empty unless another channel is moved into it. To copy a channel, keeping the source the same, simply move the channel into both the destination and the source. For example:

    channel 2 --> channel 3
    channel 2 --> channel 2
    

  3. Write out the channel copies as pairs of suboptions. Note that the first channel is 0, the second is 1, etc. The order of these suboptions does not matter as long as they are properly grouped into source:destination pairs.

Example: one channel in two speakers

Here is an example of another way to play one channel in both speakers. Suppose for this example that the left channel should be played and the right channel discarded. Following the steps above:

  1. In order to provide an output channel for each of the two speakers, the first suboption must be "2".

  2. The left channel needs to be moved to the right channel, and also must be moved to itself so it won't be empty. This is a total of two moves, making the second suboption "2" as well.

  3. To move the left channel (channel 0) into the right channel (channel 1), the suboption pair is "0:1", "0:0" moves the left channel onto itself.

Putting that all together gives:

mplayer filename -af channels=2:2:0:1:0:0

The advantage this example has over extrastereo is that the volume of each output channel is the same as the input channel. The disadvantage is that the suboptions must be changed to "2:2:1:0:1:1" when the desired audio is in the right channel. Also, it is more difficult to remember and type.

Example: left channel in two speakers shortcut

There is actually a much easier way to use the channels filter for playing the left channel in both speakers:

mplayer filename -af channels=1

The second channel is discarded and, with no further suboptions, the single remaining channel is left alone. Sound card drivers automatically play single-channel audio in both speakers. This only works when the desired channel is on the left.

Example: duplicate front channels to the rear

Another common operation is to duplicate the front channels and play them back on the rear speakers of a quadraphonic setup.

  1. There should be four output channels. The first suboption is "4".

  2. Each of the two front channels needs to be moved to the corresponding rear channel and also to itself. This is four moves, so the second suboption is "4".

  3. The left front (channel 0) needs to moved to the left rear (channel 2): "0:2". The left front also needs to be moved to itself: "0:0". The right front (channel 1) is moved to the right rear (channel 3): "1:3", and also to itself: "1:1".

Combine all the suboptions to get:

mplayer filename -af channels=4:4:0:2:0:0:1:3:1:1

3.7.2.4. Channel mixing

The pan filter can mix channels in user-specified proportions. This allows for everything the channels filter can do and more. Unfortunately, the suboptions are much more complicated.

  1. Decide how many channels to work with. You may need to specify this with -channels and/or -af channels. Later examples will show when to use which.

  2. Decide how many channels to feed into pan (further decoded channels are discarded). This is the first suboption, and it also controls how many channels to employ for output.

  3. The remaining suboptions specify how much of each channel gets mixed into each other channel. This is the complicated part. To break the task down, split the suboptions into several sets, one set for each output channel. Each suboption within a set corresponds to an input channel. The number you specify will be the percentage of the input channel that gets mixed into the output channel.

    pan accepts values from 0 to 512, yielding 0% to 51200% of the original volume. Be careful when using values greater than 1. Not only can this give you very high volume, but if you exceed the sample range of your sound card you may hear painful pops and clicks. If you want you can follow pan with ,volume to enable clipping, but it is best to keep the values of pan low enough that clipping is not necessary.

Example: one channel in two speakers

Here is yet another example for playing the left channel in two speakers. Follow the steps above:

  1. pan should output two channels, so the first suboption is "2".

  2. Since we have two input channels, there will be two sets of suboptions. Since there are also two output channels, there will be two suboptions per set. The left channel from the file should go with full volume to the new left and the right channels. Thus the first set of suboptions is "1:1". The right channel should be discarded, so the second would be "0:0". Any 0 values at the end can be left out, but for ease of understanding we will keep them.

Putting those options together gives:

mplayer filename -af pan=2:1:1:0:0

If the right channel is desired instead of the left, the suboptions to pan will be "2:0:0:1:1".

Example: left channel in two speakers shortcut

As with channels, there is a shortcut that only works with the left channel:

mplayer filename -af pan=1:1

Since pan has only one channel of input (the other channel is discarded), there is only one set with one suboption, which specifies that the only channel gets 100% of itself.

Example: downmixing 6-channel PCM

MPlayer's decoder for 6-channel PCM is not capable of downmixing. Here is a way to downmix PCM using pan:

  1. The number of output channels is 2, so the first suboption is "2".

  2. With six input channels there will be six sets of options. Fortunately, since we only care about the output of the first two channels, we only need to make two sets; the remaining four sets can be omitted. Beware that not all multichannel audio files have the same channel order! This example demonstrates downmixing a file with the same channels as AC3 5.1:

    0 - front left
    1 - front right
    2 - rear left
    3 - rear right
    4 - center front
    5 - subwoofer
    

    The first set of suboptions lists the percentages of the original volume, in order, which each output channel should receive from the front left channel: "1:0". The front right channel should go into the right output: "0:1". The same for the rear channels: "1:0" and "0:1". The center channel goes into both output channels with half volume: "0.5:0.5", and the subwoofer goes into both with full volume: "1:1".

Put all that together, for:

mplayer 6-channel.wav -af pan=2:1:0:0:1:1:0:0:1:0.5:0.5:1:1

The percentages listed above are only a rough example. Feel free to tweak them.

Example: Playing 5.1 audio on big speakers without a subwoofer

If you have a huge pair of front speakers you may not want to waste any money on buying a subwoofer for a complete 5.1 sound system. If you use -channels 5 to request that liba52 decode 5.1 audio in 5.0, the subwoofer channel is simply discarded. If you want to distribute the subwoofer channel yourself you need to downmix manually with pan:

  1. Since pan needs to examine all six channels, specify -channels 6 so liba52 decodes them all.

  2. pan outputs to only five channels, the first suboption is 5.

  3. Six input channels and five output channels means six sets of five suboptions.

    • The left front channel only replicates onto itself: "1:0:0:0:0"
    • Same for the right front channel: "0:1:0:0:0"
    • Same for the left rear channel: "0:0:1:0:0"
    • And also the same for the right rear channel: "0:0:0:1:0"
    • Center front, too: "0:0:0:0:1"
    • And now we have to decide what to do with the subwoofer, e.g. half into front right and front left: "0.5:0.5:0:0:0"

Combine all those options to get:

mplayer dvd://1 -channels 6 -af pan=5:1:0:0:0:0:0:1:0:0:0:0:0:1:0:0:0:0:0:1:0:0:0:0:0:1:0.5:0.5:0:0:0

3.7.3. Software Volume adjustment

Some audio tracks are too quiet to be heard comfortably without amplification. This becomes a problem when your audio equipment cannot amplify the signal for you. The -softvol option directs MPlayer to use an internal mixer. You can then use the volume adjustment keys (by default 9 and 0) to reach much higher volume levels. Note that this does not bypass your sound card's mixer; MPlayer only amplifies the signal before sending it to your sound card. The following example is a good start:

mplayer quiet-file -softvol -softvol-max 300

The -softvol-max option specifies the maximum allowable output volume as a percentage of the original volume. For example, -softvol-max 200 would allow the volume to be adjusted up to twice its original level. It is safe to specify a large value with -softvol-max; the higher volume will not be used until you use the volume adjustment keys. The only disadvantage of a large value is that, since MPlayer adjusts volume by a percentage of the maximum, you will not have as precise control when using the volume adjustment keys. Use a lower value with -softvol-max and/or specify -volstep 1 if you need higher precision.

The -softvol option works by controlling the volume audio filter. If you want to play a file at a certain volume from the beginning you can specify volume manually:

mplayer quiet-file -af volume=10

This will play the file with a ten decibel gain. Be careful when using the volume filter - you could easily hurt your ears if you use too high a value. Start low and work your way up gradually until you get a feel for how much adjustment is required. Also, if you specify excessively high values, volume may need to clip the signal to avoid sending your sound card data that is outside the allowable range; this will result in distorted audio.

Chapter 4. CD/DVD usage

4.1. CD/DVD drives

Modern CD-ROM drives can attain very high head speeds, yet some CD-ROM drives are capable of running at reduced speeds. There are several reasons that might make you consider changing the speed of a CD-ROM drive:

  • There have been reports of read errors at high speeds, especially with badly pressed CD-ROMs. Reducing the speed can prevent data loss under these circumstances.

  • Many CD-ROM drives are annoyingly loud, a lower speed may reduce the noise.

4.1.1. Linux

You can reduce the speed of IDE CD-ROM drives with hdparm, setcd or cdctl. It works like this:

hdparm -E [speed] [cdrom device]

setcd -x [speed] [cdrom device]

cdctl -bS [speed]

If you are using SCSI emulation, you might have to apply the settings to the real IDE device, not the emulated SCSI device.

If you have root privileges the following command may also help:

echo file_readahead:2000000 > /proc/ide/[cdrom device]/settings

This sets prefetched file reading to 2MB, which helps with scratched CD-ROMs. If you set it to too high, the drive will continuously spin up and down, and will dramatically decrease the performance. It is recommended that you also tune your CD-ROM drive with hdparm:

hdparm -d1 -a8 -u1 [cdrom device]

This enables DMA access, read-ahead, and IRQ unmasking (read the hdparm man page for a detailed explanation).

Please refer to "/proc/ide/[cdrom device]/settings" for fine-tuning your CD-ROM.

SCSI drives do not have a uniform way of setting these parameters (Do you know one? Tell us!) There is a tool that works for Plextor SCSI drives.

4.1.2. FreeBSD

speed:

cdcontrol [-f device] speed [speed]

DMA:

sysctl hw.ata.atapi_dma=1

4.2. DVD playback

For the complete list of available options, please read the man page. The Syntax for a standard Digital Versatile Disc (DVD) is as follows:

mplayer dvd://<track> [-dvd-device <device>]

Example:

mplayer dvd://1 -dvd-device /dev/hdc

If you have compiled MPlayer with dvdnav support, the syntax is the same, except that you need to use dvdnav:// instead of dvd://.

The default DVD device is /dev/dvd. If your setup differs, make a symlink or specify the correct device on the command line with the -dvd-device option.

MPlayer uses libdvdread and libdvdcss for DVD decryption and playback. These two libraries are contained in the libmpdvdkit2 subdirectory of the MPlayer source tree, you do not have to install them separately. You can also use system-wide versions of the two libraries, but this solution is not recommended, as it can result in bugs, library incompatibilities and slower speed.

Note

In case of DVD decoding problems, try disabling supermount, or any other such facilities. Some RPC-2 drives may also require setting the region code.

DVD structure.  DVD disks have 2048 bytes per sector with ECC/CRC. They usually have an UDF filesystem on a single track, containing various files (small .IFO and .BUK files and big (1GB) .VOB files). They are real files and can be copied/played from the mounted filesystem of an unencrypted DVD.

The .IFO files contain the movie navigation information (chapter/title/angle map, language table, etc) and are needed to read and interpret the .VOB content (movie). The .BUK files are backups of them. They use sectors everywhere, so you need to use raw addressing of sectors of the disc to implement DVD navigation or decrypt the content.

DVD support needs raw sector-based access to the device. Unfortunately you must (under Linux) be root to get the sector address of a file. That's why we don't use the kernel's filesystem driver at all, instead we reimplement it in userspace. libdvdread 0.9.x and libmpdvdkit do this. The kernel UDF filesystem driver is not needed as they already have their own builtin UDF filesystem driver. Also the DVD does not have to be mounted as only the raw sector-based access is used.

Sometimes /dev/dvd cannot be read by users, so the libdvdread authors implemented an emulation layer which transfers sector addresses to filenames+offsets, to emulate raw access on top of a mounted filesystem or even on a hard disk.

libdvdread even accepts the mountpoint instead of the device name for raw access and checks /proc/mounts to get the device name. It was developed for Solaris, where device names are dynamically allocated.

The default DVD device is /dev/dvd. If your setup differs, make a symlink, or specify the correct device on the command line with the -dvd-device option.

DVD authentication.  The authentication and decryption method of the new-style DVD support is done using a patched libdvdcss (see above). The method can be specified through the environment variable DVDCSS_METHOD, which can be set to key, disk or title.

If nothing is specified it tries the following methods (default: key, title request):

  1. bus key: This key is negotiated during authentication (a long mix of ioctls and various key exchanges, crypto stuff) and is used to encrypt the title and disk keys before sending them over the unprotected bus (to prevent eavesdropping). The bus key is needed to get and predecrypt the crypted disk key.

  2. cached key: MPlayer looks for already cracked title keys which are stored in the ~/.mplayer/DVDKeys directory (fast ;).

  3. key: If no cached key is available, MPlayer tries to decrypt the disk key with a set of included player keys.

  4. disk: If the key method fails (e.g. no included player keys), MPlayer will crack the disk key using a brute force algorithm. This process is CPU intensive and requires 64 MB of memory (16M 32Bit entries hash table) to store temporary data. This method should always work (slow).

  5. title request: With the disk key MPlayer requests the crypted title keys, which are inside hidden sectors using ioctl(). The region protection of RPC-2 drives is performed in this step and may fail on such drives. If it succeeds, the title keys will be decrypted with the bus and disk key.

  6. title: This method is used if the title request failed and does not rely on any key exchange with the DVD drive. It uses a crypto attack to guess the title key directly (by finding a repeating pattern in the decrypted VOB content and guessing that the plain text corresponding to the first encrypted bytes is a continuation of that pattern). The method is also known as "known plaintext attack" or "DeCSSPlus". In rare cases this may fail because there is not enough encrypted data on the disk to perform a statistical attack or because the key changes in the middle of a title. This method is the only way to decrypt a DVD stored on a hard disk or a DVD with the wrong region on an RPC2 drive (slow).

RPC-1 DVD drives only protect region settings through software. RPC-2 drives have a hardware protection that allows 5 changes only. It might be needed/recommended to upgrade the firmware to RPC-1 if you have a RPC-2 DVD drive. You can try finding firmware upgrades for your drive on the internet, this firmware forum may be a good starting point for your search. If there is no firmware upgrade available for your device, use the regionset tool to set the region code of your DVD drive (under Linux). Warning: You can only set the region 5 times.

4.3. VCD playback

For the complete list of available options, please read the man page. The Syntax for a standard Video CD (VCD) is as follows:

mplayer vcd://<track> [-cdrom-device <device>]

Example:

mplayer vcd://2 -cdrom-device /dev/hdc

The default VCD device is /dev/cdrom. If your setup differs, make a symlink or specify the correct device on the command line with the -cdrom-device option.

Note

At least Plextor and some Toshiba SCSI CD-ROM drives have horrible performance reading VCDs. This is because the CDROMREADRAW ioctl is not fully implemented for these drives. If you have some knowledge of SCSI programming, please help us implement generic SCSI support for VCDs.

In the meantime you can extract data from VCDs with readvcd and play the resulting file with MPlayer.

VCD structure.  A Video CD (VCD) is made up of CD-ROM XA sectors, i.e. CD-ROM mode 2 form 1 and 2 tracks:

  • The first track is in mode 2 form 2 format which means it uses L2 error correction. The track contains an ISO-9660 filesystem with 2048 bytes/sector. This filesystem contains VCD metadata information, as well as still frames often used in menus. MPEG segments for menus can also be stored in this first track, but the MPEGs have to be broken up into a series of 150-sector chunks. The ISO-9660 filesystem may contain other files or programs that are not essential for VCD operation.

  • The second and remaining tracks are generally raw 2324 bytes/sector MPEG (movie) tracks, containing one MPEG PS data packet per sector. These are in mode 2 form 1 format, so they store more data per sector at the loss of some error correction. It is also legal to have CD-DA tracks in a VCD after the first track as well. On some operating systems there is some trickery that goes on to make these non-ISO-9660 tracks appear in a filesystem. On other operating systems like GNU/Linux this is not the case (yet). Here the MPEG data cannot be mounted. As most movies are inside this kind of track, you should try vcd://2 first.

  • There exist VCD disks without the first track (single track and no filesystem at all). They are still playable, but cannot be mounted.

  • The definition of the Video CD standard is called the Philips "White Book" and it is not generally available online as it must be purchased from Philips. More detailed information about Video CDs can be found in the vcdimager documentation.

About .DAT files.  The ~600 MB file visible on the first track of the mounted VCD is not a real file! It is a so called ISO gateway, created to allow Windows to handle such tracks (Windows does not allow raw device access to applications at all). Under Linux you cannot copy or play such files (they contain garbage). Under Windows it is possible as its iso9660 driver emulates the raw reading of tracks in this file. To play a .DAT file you need the kernel driver which can be found in the Linux version of PowerDVD. It has a modified iso9660 filesystem (vcdfs/isofs-2.4.X.o) driver, which is able to emulate the raw tracks through this shadow .DAT file. If you mount the disc using their driver, you can copy and even play .DAT files with MPlayer. But it will not work with the standard iso9660 driver of the Linux kernel! Use vcd:// instead. Alternatives for VCD copying are the new cdfs kernel driver (not part of the official kernel) that shows CD sessions as image files and cdrdao, a bit-by-bit CD grabbing/copying application.

Chapter 5. Frequently Asked Questions