Dugan Chen's Homepage

Various Things

MPlayer Settings

Been playing with MPlayer. Here are some decent config file settings:


The above should be correct for any Linux distribution where you’re supposed to play audio directly through ALSA and not through Pulseaudio. That is, any Linux distribution that I would consider using. The “ass=true” parameter, in particular, is needed to properly show the subtitles in most anime fansubs.

If you have an NVidia card and a version of MPlayer built for vdpau support, then use the following script to launch MPlayer:


VCODEC=`mplayer -identify -frames 0 ${!#} 2> /dev/null | grep ID_VIDEO_CODEC | cut -c 16-25`

case $VCODEC in
		mplayer -vo vdpau -vc ffh264vdpau $*
		mplayer -vo vdpau -vc ffodivxvdpau $*
		mplayer -vo vdpau -vc ffompeg12dpau $*
		mplayer -vo vdpau -vc ffompeg12dpau $*
		# The current mplayer builds list this as having "problems"
		# mplayer -vo vdpau -vc ffwmv3vdpau $*
		mplayer $*
		# The current mplayer builds list this as having "problems"
		# mplayer -vo vdpau -vc ffvc1vdpau $*
		mplayer $*
		mplayer $*

Save it in as /usr/local/bin/vmplayer. When you use it to play a file, it will detect whether mplayer can use vdpau to play it, and set MPlayer’s options accordingly.

If the video looks like a bunch of horizontal lines, then you need to deinterlace it. If MPlayer is not using vdpau to play it, then launch mplayer with -vf yadif. Either way, once you’re playing the video you can press D on the keyboard to toggle deinterlacing.

If you’re using Slackware, building a more full-featured version of MPlayer is easy. Just download the MPlayer source directory. Then build it with the following command:

USE_PATENTS=YES TAG=dc VERSION=20110628 ./MPlayer.SlackBuild

The tag is your initials. The version is the current date.

It will detect and take advantage any optional dependencies you have installed, including libvdpau.

(Today, you first have to edit the SlackBuild and remove the –enable-large-files switch first.)