|
Extended options and controls |
Copyright 2000-2006 MPlayer team
Table of Contents
libcaca - Color ASCII Art librarylibavcodec
codec familyXviD
codecx264 codecVideo For Windows codec familyIf 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.
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
libavcodec
VBR MP3 audio
VBR MP3 audio doesn't always play nicely on windows players!
Planned features
MPlayer and MEncoder can be distributed under the terms of the GNU General Public License Version 2.
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.
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.
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.
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?
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:
GD 7548: present on-board and tested in Compaq Armada 41xx notebook series.
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.
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.
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.
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.
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.ttffor 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
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.
MPlayer has a completely user definiable OSD Menu interface.
the Preferences menu is currently UNIMPLEMENTED!
Installation
start MPlayer by the following example:
$ mplayer -menu file.avi
There are three timing methods in MPlayer.
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.
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 5movie1.avimovie2.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 3The 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.mpgmplayer vcd://2-cdrom-device/dev/hdcmplayer -afm 3/mnt/DVDtrailers/alien4.vobmplayer dvd://1-dvd-device/dev/hdcmplayer -abs 65536 -delay -0.4 -nobps~/movies/test.avi
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
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:
secsec seconds.
Can be negative. The value is added to movie's time position counter.
RATE0-100If 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 -fpssubtitles_fps-subfpsavi_fps-subsubtitle_filenamedummy.avi
About DVD subtitles, read the DVD section.
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.
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.
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.
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.
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 -
It is also recommended to enable -cache when playing from the network:
wget ftp://micorsops.com/something.avi -O - | mplayer -cache 8192 -
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:
mplayerhttp://217.71.208.37:8006-dumpstream -dumpfilestream.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.
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.
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).
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.
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).
Include the -edl <filename> flag when you run MPlayer, with the name of the EDL file you want applied to the video.
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.
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.
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:0See the section on channel copying for an explanation.
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.
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
***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:
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
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
stereo
quadraphonic
surround 4.0
surround 5.0
surround 5.1
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.
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
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.
Decide how many output channels you need. This is the first suboption.
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
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.
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:
In order to provide an output channel for each of the two speakers, the first suboption must be "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.
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.
There is actually a much easier way to use the channels filter for playing the left channel in both speakers:
mplayer filename -af channels=1The 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.
Another common operation is to duplicate the front channels and play them back on the rear speakers of a quadraphonic setup.
There should be four output channels. The first suboption is "4".
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".
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
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.
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.
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.
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.
Here is yet another example for playing the left channel in two speakers. Follow the steps above:
pan should output two channels, so the first suboption is "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:0If the right channel is desired instead of the left, the suboptions to pan will be "2:0:0:1:1".
As with channels, there is a shortcut that only works with the left channel:
mplayer filename -af pan=1:1Since 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.
MPlayer's decoder for 6-channel PCM is not capable of downmixing. Here is a way to downmix PCM using pan:
The number of output channels is 2, so the first suboption is "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:1The percentages listed above are only a rough example. Feel free to tweak them.
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:
Since pan needs to examine all six channels, specify -channels 6 so liba52 decodes them all.
pan outputs to only five channels, the first suboption is 5.
Six input channels and five output channels means six sets of five suboptions.
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
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 300The -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=10This 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.
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.
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.
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.
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):
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.
cached key: MPlayer looks for already cracked title keys which are stored in the ~/.mplayer/DVDKeys directory (fast ;).
key: If no cached key is available, MPlayer tries to decrypt the disk key with a set of included player keys.
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).
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.
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.
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.
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.