Leave a comment

Mplayer as default DVD player in KDE 4

I got a thing for MPlayer. There’s a good number of video players in Linux but the simplicity of MPlayer has always made it what I like to use. I like to use MPlayer without the GUI because once I learned the keybindings it makes for fast and bare-bones video player (to learn a little more about setting up MPlayer settings, look at this page). To be able have MPlayer as your default video player in KDE 4 you’ll have to do change mime associations and add MPlayer to the ‘Open with’ dialog.

Changing mime Associations

If you install MPlayer with a GUI, you can skip this step because it should install an icon and .desktop file (file for displaying in the Application menu and listing associated file types). If you install MPlayer without a GUI, likely it will not have one. Here’s a ‘mplayer.desktop’ file you can use:

[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=MPlayer
GenericName=Multimedia player
Comment=Multimedia player
Comment[de]=Multimedia-Player
Comment[es]=Reproductor multimedia
Comment[fr]=Lecteur multim├ędia
Comment[it]=Lettore multimediale
Icon=/home/todd/.local/share/pixmaps/mplayer.svg
Exec=mplayer %F
Terminal=false
Categories=AudioVideo;Audio;Video;Player;TV;
MimeType=application/ogg;application/ram;application/sdp;application/smil;application/vnd.rn-realmedia;application/x-extension-m4a;application/x-extension-mp4;application/x-flac;application/x-flash-video;application/x-matroska;application/x-netshow-channel;application/x-ogg;application/x-quicktime-media-link;application/x-quicktimeplayer;application/x-shorten;application/x-smil;application/xspf+xml;audio/3gpp;audio/ac3;audio/AMR;audio/AMR-WB;audio/basic;audio/midi;audio/mp4;audio/mpeg;audio/mpegurl;audio/ogg;audio/vnd.rn-realaudio;audio/x-ape;audio/x-flac;audio/x-it;audio/x-m4a;audio/x-matroska;audio/x-mod;audio/x-mp3;audio/x-mpeg;audio/x-mpegurl;audio/x-ms-asf;audio/x-ms-asx;audio/x-ms-wax;audio/x-ms-wma;audio/x-musepack;audio/x-pn-aiff;audio/x-pn-au;audio/x-pn-realaudio;audio/x-pn-realaudio-plugin;audio/x-pn-wav;audio/x-pn-windows-acm;audio/x-realaudio;audio/x-real-audio;audio/x-sbc;audio/x-scpls;audio/x-tta;audio/x-wav;audio/x-wavpack;audio/x-vorbis;audio/x-xm;image/vnd.rn-realpix;image/x-pict;misc/ultravox;text/google-video-pointer;text/x-google-video-pointer;video/3gpp;video/dv;video/fli;video/flv;video/mp4;video/mp4v-es;video/mpeg;video/msvideo;video/quicktime;video/vivo;video/vnd.divx;video/vnd.rn-realvideo;video/vnd.vivo;video/x-anim;video/x-avi;video/x-flc;video/x-fli;video/x-flic;video/x-m4v;video/x-matroska;video/x-mpeg;video/x-ms-asf;video/x-msvideo;video/x-ms-wm;video/x-ms-wmv;video/x-ms-wmx;video/x-ms-wvx;video/x-nsv;video/x-ogm+ogg;video/x-theora+ogg;

Place this file in the application menu folder:

mv mplayer.desktop ~/.local/share/applications/

And the icon that goes with it:

mplayer icon

mv mplayer.svg ~/.local/share/pixmaps

Open ‘System Settings’ (or whatever your distribution calls it), click on the Advanced tab and choose File Associations. Then select video in ‘Known types’. Go through videos you’d like MPlayer to open as default and place MPlayer at the top of the list then ‘Apply’. Note, you may have to wait a minute after doing the previous action before the mime types get registered. Now videos that you have saved on you hard drive can be clicked and loaded with MPlayer.

Mplayer in ‘Open with’ Dialog

Adding to Device Actions in System Settings

It may be faster and quicker to copy and paste the configuration file I post in the next step. I put this method up is case you want to learn how to add and configure special device actions.

Open ‘System Settings’ and go to the Advanced tab and click on Device Actions. ‘Add’ a new action named ‘MPlayer’. Add a new action like: ‘mplayer dvdnav://’. Most distributions compile MPlayer with DVD navigation now so this should work. Remove ‘The device must be of the type Storage Volume’ and ‘The devices property Storage.Volume.ignored must equal false’ properties. Select ‘All of the contained conditions must match’ then click ‘Add’.

  Requirement type: Contains Other Requirements
  Requirement type: Is A Requirement

Select ‘All of the contained conditions must match’ then ‘Add’:

  Requirement type: Is A Requirement
  Restriction type: Compare Value To
  Device type:      Storage Volume
  Value name:       Ignored
  Equals:           false

Add another to ‘All of the contained conditions must match’ and add this to recognize you DVD disk:

  Requirement type: Is A Requirement
  Restriction type: Compare Value To
  Device type:      Optical Disk
  Value name:       Avaliable Content
  Equals:           'Data|VideoDvd'

Save the configuration and you should see the ‘Open with’ dialog display MPlayer. For me this didn’t though and I ended up creating the configuration manually and only then did it show up after I rebooted. Rebooting should be necessary though and likely this step would have worked if I had just logged out and back in again. I had been playing with the configuration a bit before I learned how to do this and likely this is a bug in system settings. If this doesn’t work for you look at the alternative below.

Using a Pre-made Configuration

Use this pre-built configuration if you don’t want to do the above and put it in the right directory to have MPlayer appear in the ‘Open with’ dialog:

[Desktop Entry]
X-KDE-Solid-Predicate=[[ StorageVolume.ignored == false AND OpticalDisc.availableContent == 'Data|VideoDvd' ] OR [ StorageVolume.ignored == false AND OpticalDisc.availableContent == 'Data|VideoDvd' ]]
Type=Service
Actions=open;

[Desktop Action open]
Name=Open with Video Player (Mplayer)
Exec=mplayer dvdnav://
Icon=/home/todd/.local/share/pixmaps/mplayer.svg

Now move it to the right directory:

cp Mplayer.desktop ~/.kde4/share/apps/solid/actions/Mplayer.desktop

Again, you may have to login/logout before it becomes available (reboot worked for me but shouldn’t be necessary).

And you should be good. Enjoy MPlayer!

About these ads

About Gen2ly

<3's linux

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 51 other followers

%d bloggers like this: