Export Synology Video Station metadata (vsmeta) to .nfo files

Synology’s Video Station software is a great tool to organize and serve multimedia content, e.g, to DLNA clients. Sadly, Synology uses a proprietary format to save the metadata in .vsmeta files, with no further documentation available. So, directly re-using that metadata with different software requires additional tools, for example tinyMediaManager. Alternatively, it’s possible to export the metadata to a different format, e.g. .nfo files that can be used by other media server software like Emby, Serviio or Kodi.

Video Station doesn’t provide such an export feature, so access to the database itself is required. With the database accessible, only a few additional steps are required. Since .nfo files are essentially XML, it’s sufficient to export the SQL data as XML and transform it into the .nfo file structure.

Doing this requires some knowledge of SQL and XML/XSLT; the following steps were tested only on a Linux Mint system, they should work on any other current, debian-based Linux system.


  1. Export VideoStation metadata to a db dump, import it into a local PostgreSQL instance;
  2. Export the SQL metadata to XML (script for psql described below);
  3. Transform the resulting XML into the .nfo structure and write single .nfo files for each db record (XSLT described below).


1. Prepare SQL data – export from DS into a local PostgreSQL db

First, i’s required (!) to export the complete metadata. Reason: PostgreSQL on DSM 6.x was compiled without libxml support, so the query to export the SQL data as XML won’t work when executed directly on the Synology box. To do so, follow the steps to export the Video Station database as described in the Synology forums „Migrate Video Station Database“ , import it into a local PostgreSQL instance (e.g.

pg_restore -U YOUR_PG_USERNAME -c -d video_metadata /PATH/TO/videostation.dump

), and proceed with the following steps using that local data.

2. Export SQL to XML

In short:


To convert the metadata to XML, you can use the built-in XML features of PostgreSQL, especially the query_to_xml() function. Writing the result to a XML file should be done using psql and the \copy command. Since this will add ugly \n characters in the output, rendering the resulting XML not well-formed, you’ll have to remove those \n characters first. On a Linux system, this can easily be done using sed.

Putting all this together may result in the following \copy command to execute with psql. This will export the „home_video“ files with separate fields for the id, genre (concatenated), summary and filename, to a single, big xml file. To add more fields, e.g. actor, additional JOIN clauses would be required. The output file name and path is defined in the last line:

(yes, it’s „gnere“… – and please note: There are no double quotes – it’s single quotes, twice to mask the quotes inside the first argument of the query_to_xml() function…)

The SQL query result will also contain the path to the media files. This is useful since it eases putting the resulting .nfo files in the corresponding media directories. Most metadata scrapers expect the .nfo files in the same directory as the media itself.

3. Transform and „tokenize“ .xml to .nfo

In short:

  • grab the XSLT file https://gist.github.com/tohuuuuu/11fb13a5697e377161de11b5a5fe02e6 (see below for details) and save it as /tmp/transform_vsmeta.xslt
  • run the transformation: java -cp /usr/share/java/saxonb.jar net.sf.saxon.Transform -ext:on videodata.xml transform_vsmeta.xslt


We need a XSLT engine that’s capable to handle the xsl:result-document element, so it has to be able to process a XSLT 2 stylesheet. The following stylesheet will take the output of our SQL-to-XML Query, writing each single „row“ element to a single .nfo file. It takes the filename of the video file as base of the .nfo file name, creating a file structure according to the structure of the Video Station video library. This is useful since if a directory contains more than one video file, the related .nfo file has to be named the same way as the video file (expect the file type extension) and it has to be placed in the same directory as the video file.

To apply that style sheet to the XML data exported from Synology, the following command should do the trick on a Linux box with Saxon-B installed. It expects both the XML and the XML in the current dir. The variable outpathprefix sets the output root directory.

Finally, just copy the resulting .nfo files into the appropriate media directories. Now, Emby or Serviio should use that metadata when scraping the media libraries.

2 Gedanken zu “Export Synology Video Station metadata (vsmeta) to .nfo files

  1. hi,
    Do you think is it possible to export poster and backdrop from pg_largeobject and identified by lo_oid ?

    • To be honest – i don’t know. I think it should work, but i didn’t include those data in my own export mechanism since i didn’t use that elements (poster and backdrop). I assume it would require some additional steps, since (AFAIK) those elements aren’t embedded into nfo files but stored separately. If my assumption is wrong an nfo allows for embedding posters and backdrops, it may work out-of-the-box, but i’m not expert for nfo structure.
      If those elements are stored also inside the .vsmeta files, tools like tinyMediaManager may be able to extract them, so it would be no need to extract them from the pg database.

Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:


Du kommentierst mit Deinem WordPress.com-Konto. Abmelden /  Ändern )

Google Foto

Du kommentierst mit Deinem Google-Konto. Abmelden /  Ändern )


Du kommentierst mit Deinem Twitter-Konto. Abmelden /  Ändern )


Du kommentierst mit Deinem Facebook-Konto. Abmelden /  Ändern )

Verbinde mit %s