Make VLC the default media player for video and audio filetypes

To make VLC the default media player for most video and audio formats …
(obviously you’ll need to have VLC installed first)

First backup your current users ~/.local/share/applications/mimeapps.list by opening a terminal (Ctrl+Alt+T), and run:

cp -vf ~/.local/share/applications/mimeapps.list ~/.local/share/applications/mimeapps.list.backup

Ok now lets add the mimetypes for audio:

grep "^MimeType=" /usr/share/applications/vlc.desktop | cut -d "=" -f 2 | xargs -d ';' -n 1 | grep -e "^audio/" -e "^x-content/audio" | xargs -n 1 -I '{}' xdg-mime default vlc.desktop '{}'

and now for video:

grep "^MimeType=" /usr/share/applications/vlc.desktop | cut -d "=" -f 2 | xargs -d ';' -n 1 | grep -e "^video/" -e "^x-content/video" | xargs -n 1 -I '{}' xdg-mime default vlc.desktop '{}'

There may be a few filetypes that were missed, but those can be added in the normal way -
Right-click on the file, select “Open With”, select VLC, and tick the box “Set as default”.
But those commands will add all VLC’s defaults (as gleaned from the vlc.desktop file) :slight_smile:


If anything goes wrong … you can undo this by running:

cp -vf ~/.local/share/applications/mimeapps.list.backup ~/.local/share/applications/mimeapps.list

Now this I can use!

Very nifty.
I would have gone straight to ~/.local/share/applications/mimeapps.list and manually edited it, but hey I am for simple solutions.
This is to go into my toolbox. :wink: