MPlayer with DVDs

Update: 2012-08-21 – Because of MPlayer still having trouble playing DVDs, I’ve since moved to using cVLC.

There are plenty of movie players for Linux but my all time favorite is MPlayer. Not only is MPlayer quick and responsive but it can play almost anything. I’ve used MPlayer before but I realized that my movies weren’t playing just as I wanted them too – no menu support, picture quality wasn’t as I expected. If you’d like to play DVD’s with player, here’s a guide that can show you how to get good functional DVD player.

Calibrating Display

Presentation is a large part of a good movie experience. Movie companies and movie theaters put a good deal of consideration over how a movie looks and sounds. THX for example became a standard in the movie industry defining such. Therefore, how your display looks also will represent the quality of the movie you play with MPlayer. There are a couple things you can do to create good picture quality on your monitor but first a quick bit on colorschemes.

Windows and Mac OS both have built in colorschemes (also known as ICC profiling). Colorschemes define such things for the display as color balance and gamma. Linux by default does not have any colorschemes defined. Often new users will report that their display when first installed looks “too bright”. There is no way to define a colorscheme in Linux but most of this “too bright” reporting is because of gamma and there is something you can do about that.

The best option so far for Linux is if you got an nvidia card and use the standard nvidia drivers. If you do, it includes a tool called ‘nvidia-settings’. This program will allow, contrast, brightness, color and gamma change for the GUI. If not, you’ll have to look a program to discover the proper gamma for Linux like Monica. Use monica to calibrate your gamma. Calibrating Monica you’ll notice the whole display will change. Ignore this and just be sure your red, green, and blue gammas are set ok. When this is done, Monica will display an option to have Monica load at desktop startup. This can be done but it’s better to have the X server know the settings directly because if you play games (for instance) your gamma will be reset. The X server can be made aware of the gamma in the “/etc/X11/xorg” file. For example:

Note: Nowdays, I use the MPlayer configuration file to control MPlayer behavior, plus I use vdpau graphic acceleration (for nvidia cards) and dvdnav:// for dvd menu navigation. Using the config I’m able to set different options for different media I play and don’t need a seperate script to run my dvds. Here is my ‘~/.MPlayer/config’ for any that would like to use it. However, the information following could be useful if you want to learn about other configurations.

Selecting Video and Audio Output Devices

MPlayer defaults will work on just about any media. If you want to test MPlayer, try:

mplayer dvd://1

Track 1 almost always has something on it and you should get a good idea how MPlayers plays with the default settings. First thing you should do is decide what video output driver to use. Most people tend to use xv, this is the XVideo extension and has hardware accelerated playback. I however use the OpenGL driver because it give me slight better performance. For example:

For OpenGL you’ll have to use a proper yuv setting, look into “man MPlayer” for all the options. Adding the ‘-dr’ option to make sure direct rendering gets used and add ‘-framedrop’ because if a CPU intensive task starts in the background audio and video will get out of sync. Using -fs will start MPlayer in full screen-mode.

For xv make sure to use the ‘-cache’ option as xv video doesn’t play well without it.

For audio, I just allow use MPlayers default. I’ve tried setting ‘-ao alsa’ but occasionally I get skips with that and find the default (usually aoss) works better.

Filters

One of the things you’ll notice at this time is that their is a little noise to the picture quality. This is common because TV’s have built-in noise-reduction filters. You’ll also notice if you are playing a DVD recorded tv show that the picture appears “lined”(interlacing). TV’s produce pictures by displaying alternate lines. So a property called deinterlacing is used to produce a combined image. To add deinterlacing and a noise filter try this:

Aspect-Ratio

MPlayer may choose to alter the aspect-ratio which will result in a distorted picture. I think there is some legacy code in MPlayer that tries to scale based on screen size. Add ‘-noaspect’ to prevent this from happening:

Contrast, Brightness, and Saturation

Even for a properly monitor the picture isn’t going to look quite right because movies use a different colorspace that is designed for proper display on a television. While not perfect this too can be corrected to a good degree with brightness, contrast, and saturation values.

If you’re using the gl driver, you’ll be able to adjust contrast, brightness, hue, and saturation with 1 and 2, 3 and 4, 5 and 6, 7 and 8, respectively. To add the values to the command line:

DVD Menus

New versions of MPlayer (as of this writing MPlayer-28347-4) now include support for DVD menus. MPlayer will have to be compiled with “–enable-dvdnav” for DVD menus to work. From the command line, tell MPlayer to use DVD menus:

I don’t know how you can play a typical DVD at all without dvdnav. As ripping protection, all the movie DVDs I’ve seen have invalid sectors in them that have to be navigated around using instructions on the DVD. dvdnav:// knows how to follow those instructions; dvd:// apparently isn’t smart enough.

I just checked a current Debian Lenny Mplayer (based on Mplayer 1.0rc2) and dvd://1 just went into some kind of infinite loop reading the DVD, reporting “invalid navi packet”, and not even beginning to display.

Magnificent beat ! I would like to apprentice while you amend your website, how could i subscribe
for a blog site? The account aided me a acceptable deal.
I had been a little bit acquainted of this your broadcast provided bright
clear idea

Welcome to linuxtidbits.

linuxtidbits is a place for common bits of Linux knowledge. Linux is a good operating system with good people. Being part of Linux, to me, means being a part of something that everyone can contribute to.