Quantum

Writing metadata to media files

CatDV’s ethos is non-destructive metadata management, i.e. metadata is stored in the CatDV database so there is no possibility that CatDV could damage source footage.

At the same time there may be times when it is necessary to write CatDV metadata back to the original files. This tutorial describes how to do this using a third party, open source tool: exiftool.

Please note that there are risks involved with changing the original media files. It is your responsibility to ensure you have adequate confidence in this kind of workflow and/or suitable backups in case of media corruption.

Pre-requisites

This tutorial uses the CatDV worker to control exiftool, an excellent piece of software available at: http://www.sno.phy.queensu.ca/~phil/exiftool/ for Mac and Windows.

This tutorial is based on Mac OSX using CatDV Worker 5.0.7 and the exiftool 9.5. The approach on Windows is the same and this tutorial covers both platforms

Overview

In this tutorial we shall set up CatDV to be able to update EXIF, XMP and ICMP metadata, then use a server query in the CatDV Worker to trigger exiftool to write the metadata back to the file.

1. Install exiftool

Follow the instructions at http://www.sno.phy.queensu.ca/~phil/exiftool/  to install exiftool. To test the installation, type ‘exiftool’ into a terminal window / command prompt and some help pages should appear showing that the installation was successful and exiftool is accessible.

Advice to windows users would be to put the renamed exiftool in a folder within the program files directory eg “C:\Program Files (x86)\exiftool\exiftool.exe”

2. Setup CatDV to edit exif metadata

In CatDV Preferences choose Field Definitions, then press the Metadata Columns button. Ensure the “Enable Metadata columns” and “Allow editing of ‘read-only’ metadata” are both checked:

WritingExipf1

Then set up a CatDV Details Panel to show the required metadata columns (including xmp:CreatorTool for this tutorial). See here for instructions on creating a Details Panel.

3. Set up a field to trigger the worker action

In the CatDV Preferences choose Field Definitions and add a user-defined field that will trigger the worker action. In this case called “Write Metadata To File” as a radio button with the only value available ‘yes’:

WritingExif2

4. Set up a Worker action to write the metadata

Set up a worker action: as a server query triggered by the Write Metadata To File field being ‘yes’. Ensure the workflow only runs on online files (ie the media is accessible at the time) that ‘allow polling’ is set (so that the same workflow can run multiple times for the same asset) and that ‘allow sequences and metaclips’ is not set.

Then use the exiftool command line to write the metadata to the file. In this example we will write the CatDV notes field ${NT} to the album notes field (xmp:Notes), we shall also update some built in metadata for xmp:CreatorTool. The command required in the worker is:

exiftool -xmp:Notes=${NT} -xmp:CreatorTool=${@xmp:CreatorTool} $b

or for windows users

“C:\Program Files (x86)\exiftool\exiftool.exe” -xmp:Notes=${NT} -xmp:CreatorTool=${@xmp:CreatorTool} $b

This sets the metadata fields in the file to CatDV metadata:

${NT} is the CatDV notes field

${@xmp:CreatorTool} is CatDV’s (editable) version of the file’s Creator Tool field

$b is the original file path of the asset

Your workflow will no doubt want to update different metadata fields. Press the help button in the worker or see the worker documentation for more information about the fields and data available to worker commands. Note that for exif, xmp style metadata (ie fields that originated outside CatDV) an @ can be used to reference the fields per the example above.

Note that mis-setting some of this metadata (for example the codec or compression type) may corrupt the media so care should be taken here. The exiftool by default creates a backup of the original media when it updates a file. However if metadata is written multiple times, old backups will be overwritten so this should not be relied upon. More sophisticated workflows that copy the original file etc could be created to mitigate risk.

Finally on the Publish tab, don’t forget to update the Write Metadata To File field to something other than ‘yes’ to indicate that the clip has now been processed (and the workflow can be run again if necessary). As below:

Write metadata eg

WritingExif7

WritingExif5

WritingExif6

 5. Test the action

In CatDV set the Write Metadata To File field to say ‘yes’ for an asset and publish changes to the CatDV Server (ctrl/cmd-s). This will trigger the Worker job which will complete. To check that metadata has been written correctly: in CatDV either reimport the source media or use the Tools – Reanalyse Media command which will update the exif, xmp etc data from the information stored in the file.

aspera_upload-TConversion

Update the Status of the Clip

The asset can now be updated to show that the upload has happened. On the Publish tab, update the “Aspera_Upload” field to say “Uploaded”.

aspera_upload-Watch-Action1

Example Aspera Upload Script

The following script is supplied to illustrate how it is possible to automate the Upload. The script is free to use and modify but are provided for use at your own risk. Please consult a systems administrator if you are in any doubt about shell /  batch scripts. Knowledge of scripting will be needed to adapt these scripts to suit a specific environment or business needs.

This tutorial is focused on Windows   environments but  the ASCP command syntax is standard across platforms so the scripts can  be repurposed as shell scripts for OSX.

There are comments in each script to help indicate what each section does and suggestions on where modifications can be made.

Windows Batch script

copy and  paste  the  text between the ####### sections into a text file and save it as Catdv_asperaUP.bat in a folder called c:\bats

alternatively  download the file here and rename the extension to .bat   Catdv_asperaUP.txt

##################################################################################

REM Example CatDV Aspera server Upload Script

REM Usage Call Catdv_asperaUP.bat in the Execute Command 1 Section of the Worker watch action Conversions TAB

REM Triggered By a a server query on user field Aspera_upload = Upload_File

REM use Publish section to update user field Aspera_upload = Uploaded

REM syntax Path to batch file Variable_1 ( source file path )

REM eg c:\bats\Catdv_asperaUP.bat $i

REM set the Aspera password alternatively this could be supplied as a variable from a user field in CatDV

set ASPERA_SCP_PASS=demoaspera

REM call ascp path to the executable -QT disables encryption and -l 100m sets max transfer rate to 100Mbps -P preservers file time stamp 33001 is the aspera control port %1 substitutes the first variable supplied by CatDV worker ( source file-path)

REM [email protected]:/Upload is the account to log in to and the upload directory

"C:\Program Files (x86)\Aspera\Aspera Connect\bin\ascp.exe" -QT -l 100m -P 33001 %1 [email protected]:/Upload/sbstest/

REM Scope for further development - supply the aspera login name and PWD from within CatDV as user fields so usage would become

REM syntax Path to batch file Variable_1 ( source file path ) Variable_2 ( aspera user-name U16 ) Variable_3 ( aspera PWD U17 ) Variable_3 ( aspera PWD U18 )

REM eg c:\bats\Catdv_asperaUP.bat $i $U16 $U17

REM substituting %3 for demoaspera in the set ASPERA_SCP_PASS string above and %2 for [email protected] to set the aspera user and :/%4 to set the upload path

REM there are also many other options governing the behaviour of the Aspera transfer that could be managed through modification of the batch command syntax either directly or by supplying user Fields as variables through the worker

REM syntax help for ascp http://download.asperasoft.com/download/docs/ascp/3.0/html/index.html

##################################################################################