Dugan Chen's Homepage

Various Things

MPlayer Settings

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

stop-xscreensaver=1
ao=alsa
vo=xv
ass=true
ass-hinting=3
embeddedfonts=true

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:

#!/bin/bash

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

case $VCODEC in
	ffh264)
		mplayer -vo vdpau -vc ffh264vdpau $*
		;;
	ffodivx)
		mplayer -vo vdpau -vc ffodivxvdpau $*
		;;
	ffmpeg2)
		mplayer -vo vdpau -vc ffompeg12dpau $*
		;;
	ffmpeg1)
		mplayer -vo vdpau -vc ffompeg12dpau $*
		;;
	ffwmv3)
		# The current mplayer builds list this as having "problems"
		# mplayer -vo vdpau -vc ffwmv3vdpau $*
		mplayer $*
		;;
	ffvc1)
		# The current mplayer builds list this as having "problems"
		# mplayer -vo vdpau -vc ffvc1vdpau $*
		mplayer $*
		;;
	*)
		mplayer $*
		;;
esac

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