MPlayer with DVDs
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.
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:
Section "Monitor" Identifier "Monitor0" Gamma 0.86 0.85 0.87 EndSection
Gamma values are in RGB order. Restart the X server to have the gamma values permanently applied.
[default] # driver and codecs vo=vdpau:deint=2,gl:yuv=2:force-pbo,xv, vc=ffh264vdpau,ffmpeg12vdpau,ffwmv3vdpau,ffvc1vdpau,coreavc,dummy, ao=oss,alsa srate=48000 #mixer-channel="Master" # options mc=1 # keeps video and sound in sync heartbeat-cmd="qdbus org.freedesktop.ScreenSaver /ScreenSaver SimulateUserActivity" # disable screensaver #fs=1 # full-screen #dr=1 # direct rendering # Picture settings contrast=24 brightness=12 saturation=-14 hue=-8 [protocol.dvd] profile-desc="profile for dvd:// streams" alang=en af=volnorm=1 # increase amplitude for movies because of wide dynamic range #vf=yadif=3,hqdn3d=3:2.8:1:3 # for deinterlacint (tv shows) [protocol.dvdnav] profile-desc="profile for dvdnav:// streams" profile=protocol.dvd mouse-movements=yes nocache=yes fs=1
Selecting Video and Audio Output Devices
MPlayer defaults will work on just about any media. If you want to test MPlayer, try:
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:
mplayer -vo gl:yuv=2:force-pbo -dr -framedrop -fs dvd://1 mplayer -vo xv -dr -framedrop -fs -cache 8192 dvd://1
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.
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:
mplayer -vo gl:yuv=2:force-pbo -dr -framedrop -fs \ -vf yadif=3,hqdn3d dvd://1
Yadif is a good deinterlacer and hqdn3d will help to smooth the picture. I find that hqdn3d produces a bit too blurred image so I’ve reduced it to:
mplayer -vo gl:yuv=2:force-pbo -dr -framedrop -fs \ -vf yadif=3,hqdn3d=3:2.8:1:3 dvd://1
For movies that aren’t interlaced MPlayer won’t use the yadif filter.
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:
mplayer -vo gl:yuv=2:force-pbo -dr -framedrop -fs \ -vf yadif=3,hqdn3d=3:2.8:1:3 -noaspect dvd://1
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:
mplayer -vo gl:yuv=2:force-pbo -dr -framedrop -fs \ -vf yadif=3,hqdn3d=3:2.8:1:3 -noaspect \ -contrast 14 -brightness 8 -saturation -9 dvd://1
If you’re using the xv driver, you can use the software equalizer to enable the ability to adjust these values:
mplayer -vo xv -dr -framedrop -fs -cache 8192 \ -vf yadif=3,hqdn3d=3:2.8:1:3,eq2 -noaspect -contrast 14 \ -brightness 8 -saturation -9 dvd://1
mplayer -vo xv -dr -framedrop -fs -cache 8192 \ -vf yadif=3,hqdn3d=3:2.8:1:3,eq2=1:1.14:0.08:0.91 -noaspect \ -contrast 14 -brightness 8 -saturation -9 dvd://1
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:
mplayer -vo gl:yuv=2;force-pbo -dr -framedrop -fs \ -vf yadif=3,hqdn3d=3:2.8:1:3 -noaspect \ -contrast 14 -brightness 8 -saturation -9 dvdnav://
You can also add support for being able to choose DVD menu items with the mouse:
mplayer -vo gl:yuv=2;force-pbo -dr -framedrop -fs \ -vf yadif=3,hqdn3d=3:2.8:1:3 -noaspect \ -contrast 14 -brightness 8 -saturation -9 \ -mouse-movements dvdnav://
If using MPlayer with DVD menu support make sure you do not to have caching on or MPlayer won’t work properly.
That’s it! You should now have a great DVD player for you Linux.
Sometimes selections in DVD menus don’t get recognized. I found that pressing 5 will bring them up again.
MPlayer uses keyboard presses for input. A basic reference of commonly used keys:
- F – Fullscreen toggle
- Q – Quit
- P – Pause
- ← – Backward 10 seconds
- → – Forward 10 seconds
- ↑ – Forward 1 minute
- ↓ – Backward 1 minute
- Pgup – Forward 10 minutes
- Pgdown – Backward 10 minutes
- !/@ – Backward/Forward Chapters
- Arrow Keys or Numpad Arrow Keys – DVD navigation
Because DVD navigation binds to the arrow keys, they cannot be used to skip while using DVD navigation.
Users of newer Nvidia cards might want to look at MPlayer support for VDPAU (Purevideo technology).
Lastly, thanks to electro for his hqdn3d values.