Usage Command line MPlayer utilizes a complex playtree. Options passed on the command line can apply to all files/URLs or just to specific ones depending on their position. For example mplayer -vfm ffmpeg movie1.avi movie2.avi will use FFmpeg decoders for both files, but mplayer -vfm ffmpeg movie1.avi movie2.avi -vfm dmo will play the second file with a DMO decoder. You can group filenames/URLs together using { and }. It is useful with option : 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 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: SubRip: MicroDVD: JACOsub: Sami: 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 options (full path optional). The option is like for DVDs, you can choose between subtitle tracks (languages) with it. In case that is omitted, MPlayer will try to use the languages given by the 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 (full path optional). Adjusting subtitle timing and placement: Delays subtitles by seconds. Can be negative. The value is added to movie's time position counter. Specify frame/sec rate of subtitle file (float number). 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 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. 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. 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 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. 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 Control from LIRC Linux Infrared Remote Control - use an easy to build home-brewed 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 switch to specify another file. Slave mode The slave mode allows you to build simple frontends to MPlayer. When run with the option MPlayer will read commands separated by a newline (\n) from stdin. The commands are documented in the slave.txt file. 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 - It is also recommended to enable when playing from the network: wget ftp://micorsops.com/something.avi -O - | mplayer -cache 8192 - Saving streamed content Once you succeed in making MPlayer play your favorite internet stream, you can use the option 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, RTSP, and so forth. CD/DVD驱动器 现代的CD-ROM驱动器能达到很高的速度,然而一些CD-ROM也可以在降低速度下运行。 有几条原因可能使你考虑改变CD-ROM的读盘速度: 有报告称告诉读取可产生错误,尤其是制作恶劣的CD-ROM。降低速度可以防止这些 情况下的数据丢失。 许多CD-ROM驱动器有很讨厌的噪音,低俗可以降低这些噪音。 Linux 你可以使用hdparmsetcdcdctl以减慢IDE CD-ROM的驱动器。使用方法如下: hdparm -E [speed] [cdrom device] setcd -x [speed] [cdrom device] cdctl -bS [speed] 如果你使用SCSI模拟,你必须把设置应用到真正的IDE驱动器,不是被 模拟的SCSI设备。 如果你有root权限,下面的命令也可能有帮助: echo file_readahead:2000000 > /proc/ide/[cdrom device]/settings 这将预读取的文件设置为2MB,这对有划痕的CD-ROM有帮助。如果你设置 的太大,驱动器会不断来回转动,极大降低性能。 推荐你使用hdparm调整你的CD-ROM: hdparm -d1 -a8 -u1 [cdrom device] 这开启了DMA读取,预读,以及IRQ遮盖(对于详细解释阅读 hdparmman页)。 请阅读 "/proc/ide/[cdrom device]/settings" 以很好调整你的CD-ROM。 SCSI驱动器没有统一设置参数的方法(你知道?告诉我们!),有一个工具 Plextor SCSI drives可参照。 FreeBSD speed: cdcontrol [-f device] speed [speed] DMA: sysctl hw.ata.atapi_dma=1 DVD回放 对于完整的可用选项,请阅读man页。 播放标准DVD的语法如下: mplayer dvd://<track> [-dvd-device <device>] 例如: mplayer dvd://1 -dvd-device /dev/hdc 如果你使用dvdnav支持编译MPlayer,语法是一样的,但你要用 dvdnav://而不用dvd://。 默认的DVD设备是/dev/dvd。如果你的设置不同,创建 个连接或者在命令行中用指定正确的设备。 对于DVD回放及解密,MPlayer使用 libdvdreadlibdvdcss 这两个库在 MPlayer的源码树中,你不必单独安装。你也可以使用 全系统可用的版本,但这种做法不被推荐,因为它能导致错误,库不兼容以及更慢的 速度。 对于DVD解码问题,尝试禁用supermount,或者其它相应特性。一些RPC-2驱动器 可能还需要设置区域代码。 DVD结构 DVD磁盘的每个簇有带有ECC/CRC的2048字节。每个轨上采用UDF文件格式,包含各种文 件(小的.IFO及.BUK文件以极大的(1GB)的.VOB文件)。它们是真正的文件能从被挂 载的未加密的DVD中复制/播放。 .IFO文件包含电影的浏览信息(章/标题/视角图,语言表等),它们被用于读及解析 .VOB的内容(影片)。.BUK文件是它们的备份。他们到处使用, 所以你需要指定光盘上真正的簇地址以完成DVD浏览或对内容进行解密。 DVD支持通过原始的对设备基于簇的访问。不幸的是,(在Linux中)要得到一个文件 的簇地址,你必须是超级用户。那就是我们不使用内核的文件系统的原因,我们在用 户层对此进行了重新实现。libdvdread 0.9.x完成了此项 工作。我们并不需要内核中的UDF文件系统驱动因为它们已经有了自己内置的UDF文件 有时/dev/dvd对用户不可读,所以 libdvdread的作者实现了一个模拟层,其实现了将簇地址 提交到文件名+偏移量中,以模拟在挂载的文件系统甚至是硬盘上的直接访问。 libdvdread对于直接访问甚至支持挂载点而不是设备名并 检查/proc/mounts以得到设备名称。其被开发在Solaris上, 在那系统上设备名是动态分配的。 DVD解密 DVD解密通过libdvdcss完成。这个方法可以通过 DVDCSS_METHOD环境变量设置,具体细节参考man页。 RPC-1 DVD驱动器只使用软件对区域设置进行保护。RPC-2驱动器有一个硬件保护,只准 许做5次更改。你可能需要或被推荐把firmware升级到RPC-1,如果你有个RPC-2 DVD驱动 器。你可以在因特网上寻找firmware的升级, 此firmware论坛 对你的搜索可能是个好起点。如果没有针对你的设备的firmware升级,使用 区域工具 来设置你DVD的区域码(在Linux下)。 警告:你只可以设置5次区域。 VCD回放 对于可用选项的详细列表,请阅读man页。对于标准视频CD (VCD)的语法如下: mplayer vcd://<track> [-cdrom-device <device>] 例如: mplayer vcd://2 -cdrom-device /dev/hdc 默认的VCD设备是/dev/cdrom。如果你的设置不同,建 立个连接或者在命令行通过选项指定正确设备。 至少Plextor及一些Toshiba SCSI CD-ROM驱动器对读取VCD有着恐怖的性能。这是因为 针对这些设备的CDROMREADRAW ioctl没有完成。如果你有 SCSI编程知识,请帮我们实现对SCSI VCD的支持。 同时,你可以通过 In the meantime you can extract data from VCDs with readvcd 从VCD提取数据并用MPlayer播放最终文件。 VCD结构 视频CD (VCD)由CD-ROM XA簇组成,例如CD-ROM 模式 2 表格1及2轨: 第一个轨道处于模式2表格2格式下,这意味着他使用L2错误恢复。此轨道含有 ISO-9660文件系统,其拥有2048字节/簇。此文件系统含有VCD属性数据信息, 以及经常用于菜单上的静态桢。对菜单的MPEG块也能存于这第一个轨道上,但 MPEG不得不被分散成一系列的150个簇的块。ISO-9660文件系统可以包含其它 对于VCD操作不重要的文件或程序。 第二及余下的轨道通常是原始的2324字节/簇的MPEG(影片)轨道,每个簇包含 一个MPEG PS数据包。这些处于模式2表格1格式,所以他们没簇存储更多数据, 损失了一些纠错。在一个VCD的第一个轨道后也包含CD-DA轨道也是合法的。在 一些操作系统中,有些技巧是这些非ISO-9660轨道出现在文件系统中。在另外 一些操作系统中如GNU/Linux,这还(未)被实现。在此,MPEG数据 不能被挂载。因为大部分电影在这种轨道 内,你应先试 还存在没有第一个轨道的VCD(单一轨道根本没有文件系统)。他们仍然是可 播放的,但不能被挂载。 视频CD的定义被称为Philips"白皮书",它通常并不出现在网上因为它要从 Philips购买。对于视频CD更详细的资料可从 vcdimager文档 获取。 关于.DAT文件 被挂载的VCD上处于第一个轨道上的~600MB的文件并不是真正的文件!它是所谓的ISO网 关,其被创建以便Windows处理这些轨道(Windows根本不允许应用程序直接访问原始设 备)。在Linux下你不能复制或播放这些文件(它们包含垃圾)。在Windows下,这是可 能的因为他的iso9660驱动模拟了在文件内直接读取轨道。要播放.DAT文件,你需要内核 驱动,岂可再PowerDVD的Linux版本中找到。其有一个更改的iso9660文件系统 (vcdfs/isofs-2.4.X.o)驱动,你可以通过MPlayer 复制甚至播放.DAT文件。但在Linux内核的标准的iso9660驱动上它不能工作!另外使用 使用。对于VCD复制另外的方法是内核新的 cdfs驱动(不是 官方内核的一部分)其将CD会话显示为镜像文件及cdrdao, 一个逐位的CD抓轨/复制程序。 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). Using an EDL file Include the flag when you run MPlayer, with the name of the EDL file you want applied to the video. 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 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. Surround/Multichannel playback 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 . 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 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. 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. AC-3/DTS Passthrough DVDs usually have surround audio encoded in AC-3 (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, or if you are passing audio over HDMI. If your audio equipment can decode both AC-3 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 AC-3 only, use For DTS only, use For both AC-3 and DTS, use To enable passthrough in the <application>MPlayer</application> configuration file: For AC-3 only, use For DTS only, use For both AC-3 and DTS, use Note that there is a comma (",") at the end of and . This will make MPlayer fall back on the codecs it normally uses when playing a file that does not have AC-3 or DTS audio. does not need a comma; MPlayer will fall back anyway when an audio family is specified. 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 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: http://electronics.howstuffworks.com/surround-sound5.htm http://www.extremetech.com/article2/0,1697,1016875,00.asp 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, 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 only works well with 5 or 6 channels. Also, 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 you must resample it: mplayer filename -channels 6 -af resample=48000,hrtf 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. Channel manipulation General information Unfortunately, there is no standard for how channels are ordered. The orders listed below are those of AC-3 and are fairly typical; try them and see if your source matches. Channels are numbered starting with 0. mono center stereo left right quadraphonic left front right front left rear right rear surround 4.0 left front right front center rear center front surround 5.0 left front right front left rear right rear center front surround 5.1 left front right front left rear right rear center front subwoofer The 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 to play a stereo MP3 file will still result in 2-channel output since the MP3 codec will not produce the extra channels. The 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. 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 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 filter and find the right value. For example: mplayer filename -af extrastereo=0,volume=5 Channel copying/moving The filter can move any or all channels. Setting up all the suboptions for the 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. 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: 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 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 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. 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 Channel mixing The filter can mix channels in user-specified proportions. This allows for everything the 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 and/or . Later examples will show when to use which. Decide how many channels to feed into (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 input channel. Each suboption within a set corresponds to an output channel. The number you specify will be the percentage of the input channel that gets mixed into the output channel. 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 with to enable clipping, but it is best to keep the values of 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: 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:0 If the right channel is desired instead of the left, the suboptions to will be "2:0:0:1:1". Example: left channel in two speakers shortcut As with , there is a shortcut that only works with the left channel: mplayer filename -af pan=1:1 Since 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 : 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 AC-3 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 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 : Since needs to examine all six channels, specify so liba52 decodes them all. outputs to only five channels, the first suboption is 5. 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 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 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 option specifies the maximum allowable output volume as a percentage of the original volume. For example, would allow the volume to be adjusted up to twice its original level. It is safe to specify a large value with ; 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 and/or specify if you need higher precision. The option works by controlling the audio filter. If you want to play a file at a certain volume from the beginning you can specify manually: mplayer quiet-file -af volume=10 This will play the file with a ten decibel gain. Be careful when using the 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, 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. TV input This section is about how to enable watching/grabbing from V4L compatible TV tuner. See the man page for a description of TV options and keyboard controls. Usage tips The full listing of the options is available on the manual page. Here are just a few tips: Make sure your tuner works with another TV software in Linux, for example XawTV. Use the option. An example: -tv channels=26-MTV1,23-TV2 Explanation: Using this option, only the 26 and 23 channels will be usable, and there will be a nice OSD text upon channel switching, displaying the channel's name. Spaces in the channel name must be replaced by the "_" character. Choose some sane image dimensions. The dimensions of the resulting image should be divisible by 16. If you capture the video with the vertical resolution higher than half of the full resolution (i.e. 288 for PAL or 240 for NTSC), then the 'frames' you get will really be interleaved pairs of fields. Depending on what you want to do with the video you may leave it in this form, destructively deinterlace, or break the pairs apart into individual fields. Otherwise you'll get a movie which is distorted during fast-motion scenes and the bitrate controller will be probably even unable to retain the specified bitrate as the interlacing artifacts produce high amount of detail and thus consume lot of bandwidth. You can enable deinterlacing with . Usually does a good job, but it can be matter of personal preference. See other deinterlacing algorithms in the manual and give it a try. Crop out the dead space. When you capture the video, the areas at the edges are usually black or contain some noise. These again consume lots of unnecessary bandwidth. More precisely it's not the black areas themselves but the sharp transitions between the black and the brighter video image which do but that's not important for now. Before you start capturing, adjust the arguments of the option so that all the crap at the margins is cropped out. Again, don't forget to keep the resulting dimensions sane. Watch out for CPU load. It shouldn't cross the 90% boundary for most of the time. If you have a large capture buffer, MEncoder can survive an overload for few seconds but nothing more. It's better to turn off the 3D OpenGL screensavers and similar stuff. Don't mess with the system clock. MEncoder uses the system clock for doing A/V sync. If you adjust the system clock (especially backwards in time), MEncoder gets confused and you will lose frames. This is an important issue if you are hooked to a network and run some time synchronization software like NTP. You have to turn NTP off during the capture process if you want to capture reliably. Don't change the unless you know what you are doing or your card/driver really doesn't support the default (YV12 colorspace). In the older versions of MPlayer/ MEncoder it was necessary to specify the output format. This issue should be fixed in the current releases and isn't required anymore, and the default suits the most purposes. For example, if you are capturing into DivX using libavcodec and specify in order to increase the quality of the captured images, the captured image will be actually later converted back into YV12 so the only thing you achieve is a massive waste of CPU power. There are several ways of capturing audio. You can grab the sound either using your sound card via an external cable connection between video card and line-in, or using the built-in ADC in the bt878 chip. In the latter case, you have to load the btaudio driver. Read the linux/Documentation/sound/btaudio file (in the kernel tree, not MPlayer's) for some instructions on using this driver. If MEncoder cannot open the audio device, make sure that it is really available. There can be some trouble with the sound servers like aRts (KDE) or ESD (GNOME). If you have a full duplex sound card (almost any decent card supports it today), and you are using KDE, try to check the "full duplex" option in the sound server preference menu. Examples Dummy output, to AAlib :) mplayer -tv driver=dummy:width=640:height=480 -vo aa tv:// Input from standard V4L: mplayer -tv driver=v4l:width=640:height=480:outfmt=i420 -vc rawi420 -vo xv tv:// A more sophisticated example. This makes MEncoder capture the full PAL image, crop the margins, and deinterlace the picture using a linear blend algorithm. Audio is compressed with a constant bitrate of 64kbps, using LAME codec. This setup is suitable for capturing movies. mencoder -tv driver=v4l:width=768:height=576 -oac mp3lame -lameopts cbr:br=64\ -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=900 \ -vf crop=720:544:24:16,pp=lb -o output.avi tv:// This will additionally rescale the image to 384x288 and compresses the video with the bitrate of 350kbps in high quality mode. The vqmax option looses the quantizer and allows the video compressor to actually reach so low bitrate even at the expense of the quality. This can be used for capturing long TV series, where the video quality isn't so important. mencoder -tv driver=v4l:width=768:height=576 \ -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=350:vhq:vqmax=31:keyint=300 \ -oac mp3lame -lameopts cbr:br=48 -sws 1 -o output.avi\ -vf crop=720:540:24:18,pp=lb,scale=384:288 tv:// It's also possible to specify smaller image dimensions in the option and omit the software scaling but this approach uses the maximum available information and is a little more resistant to noise. The bt8x8 chips can do the pixel averaging only in the horizontal direction due to a hardware limitation. Teletext Teletext is currently available only in MPlayer for v4l and v4l2 drivers. Implementation notes MPlayer supports regular text, graphics and navigation links. Unfortunately, colored pages are not fully supported yet - all pages are shown as grayscaled. Subtitle pages (also known as Closed Captions) are supported, too. MPlayer starts caching all teletext pages upon starting to receive TV input, so you do not need to wait until the requested page is loaded. Note: Using teletext with causes strange colors. Using teletext To enable teletext decoding you must specify the VBI device to get teletext data from (usually /dev/vbi0 for Linux). This can be done by specifying in your configuration file, like shown below: tv=tdevice=/dev/vbi0 You might need to specify the teletext language code for your country. To list all available country codes use tv=tdevice=/dev/vbi0:tlang=-1 Here is an example for Russian: tv=tdevice=/dev/vbi0:tlang=33 广播电台 电台输入 这一部分将说明如何从V4L兼容的电台调谐器收听电台广播。 请阅读手册中关于电台的可选项和键盘控制的描述。 编译 首先, 你需要重新编译MPlayer, 使用./configure带上选项 和(如果你想要支持捕捉) 确认你的电台调谐器可以和Linux的其他收音软件工作。 比如XawTV 使用技巧 可用选项的完整列表在手册中有列出。 这里只给出一些技巧: 使用选项。 例子: -radio channels=104.4-Sibir,103.9-Maximum 解释: 使用该选项, 则只可使用104.4和103.9电台。 在频道切换时, 将会有个不错的OSD文字, 显示频道的名字。 频道的名字中的空格必须替换成下划线("_")。 有好几种方法可以捕捉声音。 为捕捉音频, 你可以通过连接视频卡和音频输入的外接线用你的声卡捕捉, 也可以使用saa7134芯片内置的ADC。 在后一种情况下, 你要加载saa7134-alsasaa7134-oss驱动。 MEncoder不能用于音频捕捉, 因为它需要视频流才工作。 因此你可以, 或使用ALSA项目的arecord, 或者使用选项。 在后一种情况下, 你将听不到任何声音 (除非你用了输入线, 并且关闭了输入线静音)。 例子 从标准的V4L输入 (使用输入线, 捕捉开关关闭): mplayer radio://104.4 从标准的V4L输入 (使用输入线, 捕捉开关关闭, V4Lv1接口): mplayer -radio driver=v4l radio://104.4 播放频道列表中的第二个频道: mplayer -radio channels=104.4=Sibir,103.9=Maximm radio://2 把声音从收音卡的内置ADC传到PCI总线。 在这个例子中, 调谐器被用成是第二块声卡(ALSA device hw:1,0)。 对于基于saa7134的卡, 必须加载 saa7134-alsa 或 saa7134-oss 模块。 mplayer -rawaudio rate=32000 radio://2/capture \ -radio adevice=hw=1.0:arate=32000:channels=104.4=Sibir,103.9=Maximm 当使用ALSA设备名时, 冒号(:)必须替换成等号(=), 逗号(,)要替换成句点(.)