Input Rules
Input Rules allow you to automatically tag clips on import based on their filename, extension, and path. Because there are no widely used standard naming conventions for media files, it is important for you to configure the rules to suit your needs.
The Input Rules are initialised from the File Rules section of the OCIO config for your project. Editing the Input Rules in the application makes a copy and applies the edits to the copy. From that point on, any changes that happen to the File Rules in the original config will not be used unless you reset the Input Rules. This may be done by using the Reset Rules button in the lower right of the Input Rules table. Alternatively, you may Reload the config and click Yes to delete your overrides.
Your edits to the File Input Rules are stored in the project overrides to the config, there is no modification to the source config itself. To reuse your edits, you may export a copy of the OCIO config with updated File Rules. Or when creating a new project you may initialise the OCIO config from the project with the modified rules.
Creating Input Rules
Create an Input Rule as follows:
- In the Colour Management Preferences, Input Rules tab, click Create Rule.
- Press and hold in the Input Colour Space field, and select the colour space to use for this rule.
- In the Pattern field, enter the text to search for in the file's name and path. Leave it as "*" to not consider the file's name and path for this rule.
- In the Extension (Type) field, enter the text to describe the file extension (do not include the dot). For example, entering "dpx" will match files that end in ".dpx". Leave it as "*" to not consider the file's extension for this rule.
- In the Rule Name field, enter a name for your rule.
- Use the Up and Down buttons to set the priority of this rule relative to the other rules.
Rules that are organized higher in the rules table take precedence over lower ones. The first rule that matches is the one that will be used. At the bottom of the table is the Default rule that will be used if no other rule matches. The Default rule may not be deleted and may not be moved up.
The Input Colour Space may be either a colour space or a named transform from the OCIO config file. If the File Rules in the OCIO config use a role name, this will be resolved to the actual colour space when shown in the Input Colour Space column.
Pattern syntax
The Extension and Pattern field strings use the Unix "glob" syntax. (There are many tutorials for this online.) The matching is case-sensitive for the Pattern, but not the Extension. For example, an Extension of "dpx" will match "dpx", "Dpx", "DPX", etc. To only match "dpx" you may use "[d][p][x]". Here are some more examples of "glob" syntax:
| String | Pattern | Example |
|---|---|---|
? |
Any one character. | ?pecular matches specular and Specular, as well as Xpecular and many others. |
* |
Zero or more characters. | *diffuse matches diffuse at the end of the name. diffuse* matches diffuse at the beginning of the name. *diffuse* matches diffuse anywhere in the name. |
[chars] |
Any one of the specified characters. | *[nN]ormal* matches normal or Normal anywhere in the name. |
[char1-char2] |
Any character in the range. | *[0-9] matches any name ending with a numeral. |
[!chars_or_range] |
Any character except those specified. | *[!0-9] matches any name that does not end with a numeral. |
\ |
Escapes the next character, that is, treats the next character as a literal, instead of part of the pattern matching syntax. | */[\*]* matches a pair of square brackets anywhere in the name. |
Regular Expression syntax
An alternative to using a Pattern and Extension is to use a Unix "regular expression", or "RegEx". An Input Rule may have either a Pattern and Extension, or a RegEx, but not both. The Unix regular expression syntax is more powerful than "glob" syntax, but more complicated. As an example, the RegEx to match an extension of either "TIFF" or "TIF" (but not "tiff" or "tif") is .*\.TIF?F. (Note that if you look in the OCIO config file, you will see the backslash character doubled in order to escape it for the YAML parsing: .*\\.TIF?F.) Similarly, the expression to match JPEG or JPG is .*\.JPE?G.
OCIO v1 style rule
This rule allows the use of the OCIO v1 style, where the path is searched for colour space names from the config. The position in the list prioritizes it with respect to the other rules. This rule may be created by setting the name to "ColorSpaceNamePathSearch".
Validating Input Rules
When you configure the Colour Management settings in the General tab when importing media, the Input Rules will be applied when you select the "From File or Rules" option from the Input Colour Space menu when you are in Auto Convert mode and the Tagged Colour Space menu when you are in Tag Only, View Transform, or Use LUT mode.
One way to test Input Rules, is to use List View in the MediaHub and enable the File Colour Space, Input Colour Space, and Clip Colour Space columns. See: Applying Colour Management on Import.
The File, Input, and Clip Colour Space are also shown in the MediaHub Preview panel Clip Info.
Usage of Named Transforms in Input Rules
An OCIO config may contain both named colour spaces and named transforms. (Named transforms often have the word "Curve" in the name, such as "ARRI LogC4 - Curve".) Both may be used as the Input Colour Space for Auto Convert, but only colour spaces may be used to tag media. As a result, if the Input Rules produce a named transform while in Tag Only mode, the application switches to Auto Convert mode using the named transform as the Input Colour Space and "From Project" as the Working Colour Space. If that fall-back is not possible, the clip will be tagged with the "Unknown" colour space.
Media That Has Previously Been Imported
When you import media using the "From File or Rules" option, the tagged colour space is computed and assigned at the time of import. If you later change your Input Rules, this does not change the colour space of media that was already imported. You will need to update the colour space of those clips manually, if desired. This may be done by going into the Pre-processing options in Timeline. Using the Colour Space column in the media list is a convenient way to check tagging. You may also search for media that uses a specific colour space. The Edit Colour Space option in the Timeline context menu is a convenient way to change the colour space of many sources at once.
