Search:  
Gentoo Wiki

MPlayer

Wikipedia has an article on:
MPlayer

Contents

About

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. This guide explains how to setup MPlayer on your Gentoo system. This page provides some documentation for the most common uses and covers some lesser-known features that may come in handy. Feel free to add your own tips and tricks. Examples are also welcome.

Before installing MPlayer, it's important to see what USE flags you have set, because they will in large part determine the functionality of MPlayer. Some codecs and options are only installed with certain USE flags.

Compiling MPlayer

A guide to compiling MPlayer and MEncoder from source, can be found here: MPlayer and MEncoder (DVD/Movie/Video/MP3 Player and Encoder for Linux) (MPlayer-1.0rc2)

List of all supported USE flags

To see a list of USE options recognised by mplayer:

emerge -pv mplayer

The following lists the most important of these flags.

Audio and video codecs

Audio and video output

Hardware support

Optional features

Choosing your USE flags

A reasonable question might be: which USE flags do I want to install? The answer depends on your situation.

We'll start with something simple first. Let's say you want to avoid the hassle, and enable support for all the most common video codecs that MPlayer has. These are the USE flags you would use: a52 aac dts live mp3 quicktime real theora vorbis.

Audio/video USE flags

You probably already have your audio USE flags setup, so for most general uses, there's not much to be said here.

For video output, we have here some generic flags to add for a generally safe setup: X opengl sdl xv.

MPlayer has several ways to output video to the screen, using 'mplayer -vo'. Xv is the fastest and will be the default.

If you enjoy watching movies on the console (no X session), then these are the optional flags you would want to enable: directfb fbcon svga.

Each one actually adds support for a different framebuffer library. DirectFB and fbcon will need framebuffer support enabled in the kernel, while svga requires an external module, svgalib_helper (svgalib). See MPlayer on Framebuffer for more information.

If you want to watch videos in the terminal without a framebuffer, you can enable these flags: aalib libcaca.

AAlib and Libcaca will both output video to the terminal. Libcaca is in color but AAlib is not.

DVD support

If you have a DVD-ROM or DVD-RW in your computer, then make sure to add these flags: a52 dts dvd.

Most DVDs use AC3 audio (Dolby Digitial), and playback support is provided by liba52. Some DVDs will also provide DTS as well, but is not as common.

Alternately, use the follow recommendation to enable menu navigation support: http://wonkabar.org/archives/405

MPlayer GUI

MPlayer will play in GNOME with it's own UI. You can also install graphical program called GMPlayer which is a gtk application. Just add gtk to your mix of USE flags.

Note: GMplayer has been deprecated by upstream, and will likely be removed from the ebuild or unsupported by Gentoo in the future. There are a few other frontends if you would like to try them as well: gnome-mplayer, kmplayer and smplayer

Hardware USE flags

You can greatly improve MPlayer's performances (in my experience, by up to +40%!) by recompiling it with appropriate CPU-related USE flags. Run mplayer without any parameters, and look for something like this:

Code: $ mplayer
CPU: Advanced Micro Devices Athlon 4 /Athlon MP/XP Palomino 1541 MHz (Family: 6, Stepping: 2)
Detected cache-line size is 64 bytes
MMX supported but disabled
MMX2 supported but disabled
SSE supported but disabled
3DNow supported but disabled
3DNowExt supported but disabled
CPUflags:  MMX: 0 MMX2: 0 3DNow: 0 3DNow2: 0 SSE: 0 SSE2: 0
Compiled for x86 CPU with extensions:

As you can see in this case none of the supported CPU-features have been enabled; so let's recompile MPlayer with the following USE flags: mmx, mmxext, sse, 3dnow and 3dnowext.

Note: The mplayer build system will automatically detect your CPU settings if you allow it. Therefore, the safest thing to do is enable all of the optimization USE flags and let the script detect them. If you disable the use flags, then it will forcibly disable support for that optimization, and possibly break your build. In other words, add mmx, mmxext, sse, sse2, ssse3, 3dnow and 3dnowext to your use flags for *this* ebuild, and if your box supports it, it will work automatically.

Codecs

If you haven't noticed already, mplayer has a dependency on win32codecs, which is a collection of codecs originally designed for 32-bit Windows systems. MPlayer can use these codecs to playback formats such as Windows Media Video, RealPlayer, and QuickTime. There is a much longer list of codecs that are also supported, but are not as common or well-known. win32codecs will install the "all" codec package. For more information, see Binary Codecs for MPlayer.

win32codecs also has an optional quicktime USE flag that you can enable, if you want to be able to playback most QuickTime movies.

Note: In recent mplayer versions, win32codecs is not a dependency anymore since every codec provided by this build now have a linux native equivalent.

It's important to note that there is already native support for most of these codecs in MPlayer already, and most people will not need win32codecs installed for the majority of their basic video playback needs.

For those using amd64, there is a binary package of 64-bit binary codecs for some Real codecs, packaged in amd64codecs.

Emerge MPlayer

mplayer is probably the package with more compile time options than any other.

Since most of these USE options only concern mplayer it makes sense to put them in /etc/portage/package.use as an entry for mplayer rather than adding them to /etc/make.conf as you would for system wide options.

Once you've chosen all your USE options, make sure everything looks alright, then emerge the package.

# emerge mplayer

XvMC

XvMC output can be used to reduce CPU usage while playing MPEG2 videos. It needs to be supported by the graphics hardware and driver, one driver supporting this is the nvidia binary driver.

The file /etc/X11/XvMCConfig should exist and its contents should point to your libXvMC, for example in the case of nvidia's binary driver this should be libXvMCNVIDIA_dynamic.so.1:

File: /etc/X11/XvMCConfig
/usr/lib/libXvMCNVIDIA_dynamic.so.1

You can "emerge -av eselect-xvmc" and use 'eselect xvmc' to correctly set yours.

XvMC can now be used like this:

$ mplayer dvd:// -vo xvmc -vc ffmpeg12mc
Note: So far, nVidia is the only driver that supports this playback method --void
Note: A list of supported drivers http://www.mythtv.org/wiki/index.php/XvMC#Introduction

Subpages

Links

Retrieved from "http://www.gentoo-wiki.info/MPlayer"

Last modified: Sun, 21 Sep 2008 04:10:00 +0000 Hits: 85,100