When you add media to your Plex server, Plex will connect to the Internet to download information about the media. For a movie, Plex will download information such as actors, directors, ratings for the movie, while Plex will download artist information for music.
All the information Plex downloads for your media is called metadata, and the metadata is downloaded, it is stored locally on the Plex server.
So where is this metadata stored on the server? Depending on the metadata, Plex will store the metadata in two different locations. These locations are discussed below.
The metadata locations
Plex stores the metadata for all media files in one of two locations: on the server's file system and in the Plex database. A brief description of each location is as follows:
- [Plex data directory]/MetaData
- This directory contains the information files associated with the media. These files include movie posters and backgrounds, artist images, and TV show theme music. The metadata is separated by library type and then within subdirectories that contain unique identifiers that are used internally in Plex.
- The Plex database
- The information that Plex downloads and displays to the user, such as media summary, actors/artists, ratings, etc. are all stored in the Plex database.
The next two sections will provide a more detailed explanation on the two metadata locations.
The metadata directory
The metadata folder is complex to navigate because the names of the directories containing the metadata are unique identifier. The identifiers are managed internally in Plex. Also, the file names do not contain the traditional extensions for the file types, so you would need to use the parent folder name to determine the type of file.
For example, the art and posters subdirectories would contain JPEG files. So if you were to copy a file from one of those subdirectories, and then add a ".jpg" extension to the end of the copied file, you should be able to open it in an image editor to view the file.
Media files, such as TV shows, could also contain a "themes" directory, which contains the theme music for the show. You can copy files in this directory to a new folder, add the ".mp3" extension to the file and listen to the theme music from the TV show.
When you upload your own metadata-related files through Plex - such as custom movie posters - those files will be stored in the metadata directory on the server.
Where the metadata directory is located is also important and could be the reason for things such as movie posters not showing up in Plex.
Metadata in the Plex database
Plex stores most of the metadata for media in its database. The database is a SQLite database, so it can easily be opened for viewing, if you understand how databases are structured.
I don't recommend you open the Plex database, or change the data in the database manually, if you are curious as to how to view the metadata in the database, you can use the following steps :
- Download and install DB Browser for SQLite
- On the server, copy the "com.plexapp.plugins.library.db" file from the Plex database directory location to another directory. We will be opening a copy of the database.
- Run the DB Browser for SQLite.
- Click the Open Database button at the top, and then navigate to the location of the database copy you made in step 2.
- With the database structure shown, you can find the metadata for the media in the "metadata_items" table.
There are many tables in the database that store other types of metadata for each media file you have added to Plex. The "metadata_items" table mentioned above stores that information for each media file that is displayed to the user.
Two points to keep in mind when viewing the database:
- Always open a copy of the database to avoid corrupting the database that is being used by Plex.
- Never change the Plex database - either data or structure - outside of Plex.
The above two locations are where the Plex metadata is stored. While it may be helpful to know where the metadata is stored, you shouldn't create, update or delete the metadata outside of the Plex application.