Sneak preview: How to Use Export Templates for Tailored Output

By Isak - February 21, 2016

In Vidispine 4.5, we have added a new function called Export Templates. Export Templates extend the current export functionality by adding programmatic support for tailoring the output to distribution standards.

In Vidispine 4.4 and earlier, you can export an item, collection or library to a location specified by a URI. (Pro tip: use export locations to save export URIs.) When exporting, you can specify that you would like the content in a certain format (shape tag), and if you would like to export metadata as well. For metadata, you are limited to XML sidecar files, although you can apply projections.

Export templates greatly extends the options for export. The export template defines a tree for how the export is performed. The tree nodes can perform several actions, including creating compressed archives (tar, zip), producing any type of sidecar file, render a sequence, etc.

Example of a template:

<ExportTemplateDocument xmlns="http://xml.vidispine.com/schema/vidispine">
  <item>
    <shape>
      <componentfile path="{{item.id()}}.mp4">
        <tag>mp4file{{item.id()}}</tag>
      </componentfile>
      <shapeTag>__mp4</shapeTag>
      <generate>true</generate>
    </shape>
    <text path="{{item.id()}}.md5sum">
      <dependency>mp4file{{item.id()}}</dependency>
      <content>{{checksum.tag("mp4file"+item.id(),"MD5")}}</content>
    </text>
  </item>
</ExportTemplateDocument>

What does this template do?

First of all, it operates on a number of items. If the template is called on a number of items, such as a collection or a library, the item element is applied multiple times.

The shape element references a specific shape of the item in scope. In this example, the shape that has shape tag __mp4. If no such shape exists, it will be automatically created, as generated=true. When the shape is exported, it will have the file name “item id”.mp4. The text inside {{ }} is actually JavaScript code, item.id() evaluates to the id of the item in scope.

The text element simply creates a file with any content. In this case, it is JavaScript that computes the checksum of the exported mp4 file.

There are two more tags that we have not mentioned yet. The tag/dependency pair tells the export template engine that the shape element has to be executed first. Otherwise there will not be any mp4 file to compute checksum of! With the tag/dependency pair, the shape and text elements could appear in any order of of the document.

In 4.5, the export templates are added in a beta version. We hope that you will appreciate the flexibility of this new features, and we would really like to get your feedback for the final version! For more information, see the API documentation on Export Templates.