Adding Recognised Media Types

From LinuxMCE
Jump to: navigation, search

The Issue

In some cases, LMCE's media playing code is perfectly capable of playing a lesser used media type, but LMCE doesn't recognise these media type extensions and so does not enter the associated media files into the database.

An example of this was in the 0710 betas, .mkv Matroska video files although the Xine libraries can play these files. In the current 0710RC2, .m4a (MPEG4 audio layer, commonly used in the Apple world) files are played perfectly, however LMCE does not recognise them so they do not appear in the media browsers to be selected.

It is very easy to add any video or audio file type so that LMCE adds these to the database. There are two easy ways of doing this:

Method 1 (Command Line)

An example for video is given by Totallymaxed here [1] and for audio by colinjones here [2]

You can use a SQL command at a terminal on your core to issue a command that finds the correct MediaType table entry, then replaces the Extensions attribute with a new one.

mysql -u root -D pluto_main -N -e "UPDATE MediaType SET Extensions = 'mov,avi,mpeg,mpg,wmv,ts,tp,dvd,vdr,ogm,mkv' WHERE Extensions = 'mov,avi,mpeg,mpg,wmv,ts,tp,dvd,vdr,ogm'"

This very specifically replaces "mov,avi,mpeg,mpg,wmv,ts,tp,dvd,vdr,ogm" with "mov,avi,mpeg,mpg,wmv,ts,tp,dvd,vdr,ogm,mkv", and so will not work once LMCE's list of accepted media types expand in the future. Thus this command will need to be updated with the new lists. If so, it is likely that it will be easier for you to use Method 2 anyway.

To find the current list of extensions, for example from the "LinuxMCE Video File" media type, enter the following command.

mysql -u root -D pluto_main -N -e "select Extensions from MediaType WHERE Description = 'LinuxMCE Video File'"

To get a list of media types, enter the following command.

mysql -u root -D pluto_main -N -e "select Description from MediaType"

Method 2 (GUI)

Download and install the MySQL GUI Tools from the MySQL web site. Now start up MySQL Query Browser and point it at your core ( only from the internal LAN) and use a username of "root" and the password is blank. The port number for this connection is 3306.

In the right pane, expand the Pluto_Main database and find the MediaType table. Double click on it, then hit the big Execute button up the top. This will list all the rows in that table. Now you will see two rows called "pluto_StoredAudio" and "pluto_StoredVideo". In the relevant one, edit the Extensions field to include the new file types. NOTE: you will need to enable editing first by hitting the Edit button on the bottom status bar.

Finally, you will need to hit the Apply Changes button, next to the Edit button, and transfer the updates the the database. Now you can close the Query Browser.


Once the changes have been made - using either method - UpdateMedia will need to scan the files again before they are added to the database. Not sure if you can just let this happen on the next 2 mins cycle, or whether you need to force a full manual scan to ensure that it picks up the new files. Feel free to edit this with the answer!