HOWTO MPlayer

Contents

[hide]

<script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>

[ edit]

Introduction

MPlayer is a high quality media player with a rich set of options that can playback almost every media file you can throw at it.

For more information see MPlayer Features and the quite extensive mplayer documentation.

This guide will attempt to explain how to setup MPlayer on your Gentoo system, provide some documentation for the most common uses, and cover some lesser-known features that may come in handy.

Feel free to add your own tips and tricks. Examples are also welcome.

[ edit]

Emerge MPlayer

Complete instructions on how to emerge MPlayer and what USE flags to use can be found in HOWTO Emerge MPlayer.

[ edit]

Command-Line Arguments

MPlayer has a lot of options for playback. See man mplayer if you're ambitious. :)

Note: If you have Konqueror installed, you can read the manpage in the browser by opening the URL man:/mplayer

As a general rule, the order of the arguments you pass to mplayer won't matter. If you've seen some examples before, you can switch around the options in any order, and things will work fine.

So, something like this:

mplayer dvd://5 -chapter 12 -ao oss -vo svga

would be the same as this:

mplayer -chapter 12 -vo svga dvd://5 -ao oss

The examples included in this guide will try to display them in a logical and consistent presentation so you can more easily distinguish which options are being passed

[ edit]

Configuration Files

MPlayer stores per-user config files in the ~/.mplayer directory. For mplayer, you want to modify the file ~/.mplayer/config

Arguments that you would normally pass with mplayer would be put in the config file in format argument=option,option. If an argument has suboptions, each one is separated with a colon.

For example, if we always wanted to use these playback options:

mplayer dvd:// -vo xv -ao alsa -channels 4 -alang=en,es

this is what your ~/.mplayer/config would include:

File: ~/.mplayer/config
vo=xv
ao=alsa
channels=4
alang=en,es

and you would then get the same result when running this command:

mplayer dvd://
[ edit]

Watching Videos

Once you have MPlayer installed, you're ready to watch something! All you will need to do is run mplayer, and then the file you want to watch.

mplayer movie.avi
[ edit]

Keyboard Navigation

For those of you who don't like looking through MAN pages, here are some of the keys to control playback:

  • <- and -> seeks backward/forward 10 seconds
  • up and down seeks backward/forward 1 minute
  • pgup and pgdown seeks backward/forward 10 minutes
  • < and > backward and forward in playlist
  • p or spacebar pause / unpause
  • q or ESC stop playing and quit
  • / and * or 9 and 0 to decrease/increase volume
  • m mutes sound
  • # cycles through available audio tracks
  • f toggles fullscreen (see also -fs)
  • T toggles stay-on-top (see also -ontop)
  • b and j toggles through available subtitles
[ edit]

General Playback Options

Once again, these are only a few of the many options available that most people might be looking for. See the MAN page for more details. Almost all of these descriptions are taken straight from the man.

  • -quiet to display less console output
  • -v or -verbose to display more console output
  • -loop <number> loops movie playback <number> times. 0 means forever.
  • -playlist <filename> plays a filelist. May be required for some streaming video.
  • -cache <kBytes> sets "how much memory (in kBytes) to use when precaching a file or URL. Especially useful on slow media."
  • -cache-min <percentage> - "Playback will start when the cache has been filled up to <percentage> of the total."
  • -channels <number> changes the number of playback channels. See the man for a lengthier explanation on how this one works.
    • 2 - stereo (default)
    • 4 - surround
    • 6 - full 5.1
  • -forceidx - "Force index rebuilding. Useful for files with broken index (A/V desync, etc). This will enable seeking in files where seeking was not possible."
  • -srate <Hz> - "Selects the output sample rate to be used (of course sound cards have limits on this)."
  • -ss <time> - "Seek to given time position." In other words, starts playback at the specified time index.

Seeks to 56 seconds:

 mplayer movie.avi -ss 56

seeks to 1 hour 10 minutes:

 mplayer movie.avi -ss 01:10:00
[ edit]

Video Out Drivers

MPlayer has a lot of video out options. This will cover some of the more basic ones.

First of all, when you installed mplayer, there are a number of video output drivers you can use. You can see your list of possibilities by running mplayer -vo help

For example, if you compiled it with X in your USE flags, then you will see x11 in the list.

In each option below, if you want to use that video-out option, use -vo on the command line, or add vo=<value> to your config file.

Here is a short explanation on some of the video output options.

  • x11 is the most basic of video out options for display on X11 displays (your window manager). From the man page, "Shared memory video output driver without hardware acceleration that works whenever X11 is present."
  • xv is the next step up if did want to use hardware acceleration, and your video card supports it, and you installed mplayer with the xv USE flag. "If you cannot use a hardware specific driver, this is probably the best option." If unsure, use this option as your default.
  • sdl goes through the libsdl layer. SDL stands for Simple Directmedia Layer and is actually just a wrapper library that will use probably your best options anyway, assuming you installed the SDL libraries with the correct USE flags. You can always use this one if you want, and let SDL decide on the best output device to use for you.

See the man page for more options specific to using SDL.

  • gl and gl2 use the OpenGL video output driver. "Intended to work even with the most simple OpenGL implementations." see the man for more options specific to this driver.
  • There are also a few framebuffer output devices: fbcon for using /dev/fb0, vesa for any VESA VBA 2.0 compatible card, svga for using the svga library, and directfb for using DirectFB.
  • If you don't want to output any video at all (for whatever reason), just use the null driver.
  • aa and caca for ASCII art and color ASCII, respectively, which actually look pretty good sometimes.

There are still a few more drivers, but most desktop users will want to use one of the above.

[ edit]

Video Out Options

Along with a wide selection of output drivers, MPlayer also offers you lots of ways to tweak the visual experience as well. Here are a few of the more common options available. Please note that some of these are only available while using certain video output drivers. See the man page for details.

  • -display <name> (X11 only)

"Specify the hostname and display number of the X server you want to display on." The default will, of course, use the display you are already in.

  • -fs enables fullscreen playback.
  • -ontop keeps MPlayer playback on top of other windows.

"Supported by video output drivers which use X11, except SDL, as well as directx and gl2."

  • -panscan <0.0-1.0> for pan and scan playback.

"Enables pan-and-scan functionality (cropping the sides of e.g. a 16:9 movie to make it fit a 4:3 display without black bands). The range controls how much of the image is cropped. Only works with the xv, xmga, mga, gl, quartz and xvidix video output drivers."

  • -rootwin plays the movie in the desktop background.

"Desktop background images may cover the movie window, though. Only works with the x11, xv, xmga, xvidix, quartz and directx video output drivers."

  • -stop-xscreensaver (X11 only)

"Turns off xscreensaver at startup and turns it on again on exit."

If you want to add any of these options to your ~/.mplayer/config just add =1 to the option.

 stop-xscreensaver=1
[ edit]

Watching DVDs

If you installed MPlayer with support for DVD playback, then you have a few more options.

First, playing a DVD:

mplayer dvd://

MPlayer will look for the longest title on the DVD and playback that file. In most cases the longest title will be the actual movie (on a DVD movie), and it will show that video.

If you want to play a different title other than the default one, you can specify it as a number after the dvd:// option. This example will play title three:

mplayer dvd://3

Most DVDs that are movies will also be split up into chapters. You can specify a chapter for playback by passing the -chapter argument. This example will play the default title, and the second chapter:

mplayer dvd:// -chapter 2
[ edit]

DVD Audio Languages

A lot of movie DVDs these days come with more than one audio track in different languages.

Si quieres escuchar a tu disco favorito in castellano, es ray facil! Si el disco lo apoya, claro. :)

MPlayer will (usually) default to first audio language track (I think), but if you need to change it, you can use the -alang argument along with the language code.

This example will always play the English audio track:

mplayer dvd:// -alang en

Este ejemplo usa la lengua española:

mplayer dvd:// -alang es

You can also pass more than one language with the argument, so if the first is not available, it will fall back to the second, and then the next available:

mplayer dvd:// -alang hu,en,es

For more information about languages, see Demuxer/Stream Options in the man page.

[ edit]

DVD Surround Sound

As you are probably aware, a lot of DVDs have their audio stream in surround sound stereo, or more than two channels. By default, MPlayer will downplay all the extra channels to stereo (two channel). This can be changed by using the -channels argument.

This example is the same as the default -- play a DVD in 2-channel stereo mode:

mplayer dvd:// -channels 2

For surround sound, change the number to four:

mplayer dvd:// -channels 4

For full 5.1 surround sound, change the number to six:

mplayer dvd:// -channels 6

For more information about how MPlayer handles channels, see Demuxer/Stream Options in the man page.

For help with sending the audio stream straight to your receiver, see HOWTO Dolby Digital Out (AC3, SPDIF)

[ edit]

Regional Support

If you get errors like this when watching DVDs:

libdvdread: Invalid IFO for title 2 (VTS_02_0.IFO).
Cannot open the IFO file for DVD title 2.

then you can install regionset:

emerge regionset

Run it and follow the prompts to set your player's region code correctly (note there is a hardware limitation on your drive how many times you can change the region code, just running regionset will show you this information):

Code: regionset
regionset version 0.1 -- reads/sets region code on DVD drives
Current Region Code settings:
RPC Phase: II
type: NONE
vendor resets available: 4
user controlled changes resets available: 5
drive plays discs from region(s):, mask=0xFF
Would you like to change the region setting of your drive? [y/n]:y
Enter the new region number for your drive [1..8]:2
New mask: 0xFFFFFFFD, correct? [y/n]:y
Region code set successfully!

See http://linvdr.org/projects/regionset/ for more information.

[ edit]

Misc. Tips and Tricks

[ edit]

Get File Details

Use midentify to see some details about your media file.

midentify movie.avi

For some more generic info, you can also run:

file movie.avi
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值