How to Make any Media Player the Default Audio/Video Player in Ubuntu 12.10 & 12.04 ?

‘Unity’ desktop comes with a utility that lets us set the default application for opening certain file types. For example, by using this tool, one can change the default Web browser, Text editor, Image viewer, Audio player, Video player etc.

Now most programs, while installing, if they are related to one of those available categories, they automatically add themselves, and thus, we can easily make them the default application for opening those file types. However, this does not always work.

For example, when installing, ‘mplayer’ (the command-line based one) does not add itself to this list. This is understandable, as it is a command-line based one and most users won’t be using as the default media player.

Change-the-Video-player-using-Default-Applications-utility-Ubuntu-12.10

Nevertheless, by using a simple trick, one can easily add ‘mplayer’, or any other player that does not add itself into this list. In this article, I’m concentrating on adding a new program for handling audio/video categories only.

Step 1:

In Unity (including Gnome & KDE), applications that have desktop or menu entries, rely on a configuration file, as specified by ‘freedesktop’, for achieving that.

Now as you know, the default media player in Ubuntu is called ‘Totem”. And by using its existing desktop entry file, called ‘totem.desktop’ (stored in ‘/usr/share/applications’), I have created a custom desktop entry file, that can be used to add any media player into the default application list for Audio and Video formats.

In other words, you can use this file to set a desired application as the default one for opening all the audio/video files, easily.

So, first of all, download the configuration file from here (it is compressed, once the download completes, make sure to extract the file into your ‘Home’ folder).

Step 2:

Now open ‘Gedit’ text editor and open the extracted file (‘custom-media-player.desktop’) using it.

Step 3:

Now all you have to do is;

1: Give a name under the ‘Name‘ field. You can enter any name here (it does not have to be the name of the program), and it will be used as the entry name listed on the ‘Default Applications’ (the tool that lets us change the default applications) menu.

2: Under the ‘Exec‘ field, enter the command of the program, do not change the ‘%U’ argument.

For example, if I wanted to execute ‘mplayer’, then I’ll replace the ‘enter-the-exact-name-here’ text field with ‘mplayer’ and the output will look like below.

mplayer %U

3: If you want an icon to be displaced on the menu entry, then simply enter its path under the ‘Icon‘ field, or else, leave it blank.

Editing-the-custom-media-player.desktop-entry-file

When you are done, make sure to save the changes and then close the editor.

Step 4:

Now, assuming the file is in your ‘Home’ folder, enter the below command to move it into the ‘/usr/share/applications’ folder.

sudo mv custom-media-player.desktop /usr/share/applications

For the newly added ‘desktop entry’ to be added into the ‘Default Applications’ utility, we have to update the ‘desktop entry cache’. For that, use the below command.

sudo update-desktop-database

That is it.

Note: You can open-up the ‘Default Applications’ dialog box by going over to: ‘System Settings’ -> ‘Details’ -- ‘Default Applications’ (once this is clicked, you should see your newly added program under the drop-down list of ‘Audio’ and ‘Video’ options).

An RHCE, 'Linux' user with 14+ years of experience. Extreme lover of Linux and FOSS. He is passionate to test every Linux distribution & compare with the previous release to write in-depth articles to help the FOSS community.

8 thoughts on “How to Make any Media Player the Default Audio/Video Player in Ubuntu 12.10 & 12.04 ?”

  1. Hi Gayan,

    I feel I must point out that the ultimate os, AntiX, comes with a program to make and install desktop files. As AntiX started from Mepis, I assume Mepis does too.

    Ubuntu might catch up, some day ๐Ÿ™‚

    Reply
  2. I have been looking for directions for this for a while. I use Ubuntu 14.04, so wasn’t sure that this would work. But the directions you gave were simple to follow, and it works like a charm! Thanks.

    Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Shares
Tweet
Share
Share
Pin