본문 바로가기

Study/Linux

How to emerge mplayer

Introduction

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.

This guide will use mplayer-1.0_pre7 as an example.

[edit] 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.

[edit] Audio and video codecs

  • a52 decoding ATSC A/52 streams used in DVD. Needed for AC3.
  • aac enables FAAD2 (AAC) support
  • amr enables support for Adaptive Multi-Rate Audio encoding (required for playing files recorded by many mobile phones)
  • divx enables support for DivX playback
  • dts Enables libdts (DTS Coherent Acoustics decoder) support
  • live enables Live.com streaming media support
  • mad adds support for the MAD mp3 decoder
  • matroska adds support for playback of Matroska-container audio/video files
  • mythtv to play nuv files created by MythTV
  • real uses RealPlayer codecs for audio/video playback
  • theora to play Ogg Theora video files
  • win32codecs installs the binary codecs
  • xanim adds support for XAnim
  • xvid enables support for XviD encoding and playback

[edit] Audio and video output

  • aalib adds support for ASCII output (see libcaca for color)
  • alsa adds support for ALSA (Advanced Linux Sound Architecture) audio output/recording
  • arts adds support for audio output through aRts
  • dga Adds DGA Support (Xfree86) (DGA=Direct Graphic Access)
  • directfb adds framebuffer support through the DirectFB layer
  • esd adds support for audio output through EsounD
  • fbcon adds framebuffer output option for video
  • ggi adds support for the LibGGI graphics card drivers
  • gif lets you encode to and from gifs
  • jack enables JACK sound support
  • jpeg lets you encode to and from jpegs
  • libcaca adds support for color ASCII output (see aalib for non-color ASCII)
  • nas enables Network Audio System support
  • opengl lets you use OpenGL for video output
  • oss adds OSS audio output/recording support
  • png lets you encode to and from pngs
  • sdl adds SDL (Simple Direct Layer) as an audio and/or video output wrapper
  • svga adds framebuffer support through SVGAlib
  • xinerama adds support for dual-screen output (or something)
  • xv direct video output format

[edit] Hardware support

  • 3dfx Adds support for 3dfx video cards
  • 3dnow builds with 3DNow! support
  • 3dnowext builds with extended 3DNow! support
  • cdparanoia adds paranoia support when ripping/playing CDs (needed for cd-audio playing)
  • dvb to watch/record TV (see also v4l and v4l2)
  • dvd will let you rip/play DVDs
  • dvdread adds DVD support through the libdvdread library
  • i8x0 Enables support for the i8x0 xvmc video driver
  • joystick enables joystick support
  • lirc uses LIRC library for remote controls
  • matrox adds support for Matrox G200/G4x0/G550
  • mmx builds with MMX support
  • mmxext builds with MMX2 support
  • rtc adds support for RTC (/dev/rtc)
  • sse adds support for SSE
  • sse2 adds support for SSE2
  • ssse3 adds support for SSSE3
  • v4l and v4l2 to watch/record TV (see also dvb)
  • xvmc Enables X-Video Motion Compensation support

[edit] Optional features

  • bidi adds support for FriBiDi libraries
  • bl adds support for blinkenlights
  • doc
  • edl adds support for Edit Decision Lists
  • encode will install mencoder
  • gtk will also install an MPlayer gui (gmplayer)
  • ipv6 adds support for IPv6
  • lzo Enables LZO compression support
  • samba enables Samba input support
  • truetype enables FreeType font rendering support
  • xmms builds XMMS input plugin support (deprecated)

[edit] 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 all the video codecs that MPlayer has support for. These are the USE flags you would use: avi live matroska mpeg oggvorbis real theora xanim.

Even those USE flags are overly cautious (most people probably aren't going to need live, matroska, theora or xanim), but it's a good place to start. Just add those USE flags to your current ones, and you should be good to go.

[edit] 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, we have here some generic flags to add for a generally safe setup: X aac opengl sdl xv.

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 HOWTO 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.

[edit] DVD support

If you have a DVD-ROM or DVD-RW in your computer, then make sure to add these flags (again, playing safe): dts dvd dvdnav dvdread.

[edit] 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.

[edit] 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: Only enable those features which MPlayer claims to support!
Note: If you change between AMD and Intel processors or down/upgrade your hardware, some CPU features may no longer be supported or new ones may become available.

[edit] 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. win32codecs will install the "all" codec package. For more information, see Binary Codecs for MPlayer.

If you use the real USE flag with mplayer, it will install realplayer, which requires X. If you don't want to install RealPlayer, but still want to be able to playback some Real media files, add the real flag to your package.use file for win32codecs, and remove it for mplayer.

# echo "media-libs/win32codecs real" >> /etc/portage/package.use
# echo "media-video/mplayer -real" >> /etc/portage/package.use
FIXME: Above instructions do not work anymore (as of 2005-12-01 and mplayer-1.0_pre7-r1 or later). I made a post at Gentoo Forums explaining how to use mplayer to play realmedia videos without realplayer installed. Read here: [1].
FIXME: HOWTO Rip Streams With MPlayer#Codecs

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

It is also a good idea to emerge faad2 and use the aac flag when emerging mplayer so that you can play back m4a.

[edit] 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

[edit] 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.

After compiling mplayer with the xvmc USE flag, X needs to be restarted for it to work. Further, 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

XvMC can now be used like this:

$ mplayer dvd:// -vo xvmc -vc ffmpeg12mc


mplayer 설치가 끝났다면 환경설정을 해주자. 자막이나 소리 등 해줘야 할게 많타...
~/.mplayer/config 로 가서 다음을 입력 하자.

vo=sdl
fs=no
ao=alsa
unicode=1
font=/usr/share/fonts/alee-fonts/bandal.ttf
subcp=euc-kr
subfont-text-scale=4
subfont-outline=3


저장하고 reboot 한번 해준다.

'Study > Linux' 카테고리의 다른 글

파이어 폭스 설정에 관한 팁  (0) 2008.01.18
NcFTP 사용법  (0) 2008.01.18
Gnomem KDE 단축키  (0) 2008.01.18
MY System Infomation  (0) 2008.01.17
Gentoo Alsa guide  (0) 2008.01.17