OpenClip XML Media Management Python Module
Openclip is a python abstraction of the openclip XML media classification format. It provides ORM-style access to "dotclip" data (file or generated) to make the life of a python developer much easier. This module is not meant to be a complete solution but rather a stable and standardized component of various other scripts, tools, guis, and software integrations.
About the OpenClip format
the following is adapted from the Autodesk documentation of the Gateway Clip specification...
.clip OpenClip XML format is an XML wrapper which points to single or multiple video and/or audio sources and wraps them in a single entity. The XML is built to reflect the structure of a complex clip, with the most atomic portions (paths to media) at the bottom of the hierarchy, and the clip at the top most entity.
An OpenClip XML structured file describes at least the following information:
- Physical location of files
- additional metadata information, such as timecode and keycode
- Clip versions
Structure of OpenClip
The following is a basic representation of the structure of an Open Clip:
- highest level wrapper entity
- comprises entire clip (Tracks, Versions)
- defines global options (Clip Name, Comments)
- found within
- all information about a single channel
- ChannelType (Video, Audio, Generic)
- Extended Channel Type (eg. Matte, Normals, Shadow)
- found within
- Track Version or "View"
- Distinguished by a Version Number
- Storage Format (bit-depth, resolution, etc.)
- found within
- Media (Image sequence or streaming media/container eg. QuickTime)
- Path(s) to media
clip, you have
tracks you have
feeds and within
This should be easy. You may need administrator priveleges depending on your system configuration.
Note: Some software have their own isolated python environment for a good reason - try at your own risk to integrate this library...
For the latest dev branch:
git clone https://github.com/robmoggach/python-openclip.git cd python-openclip python setup.py install
or for the latest (possibly stable?) release:
pip install openclip
Note: I prefer markdown for documentation but setuptools prefers restructuredText. For this reason the
setup.pyfile optionally requires package
pypandocwhich can be installed using
pip install pypandoc.
lxml.etree has been used in development for this project but it does have fallbacks for system xml element tree tools.
It's faster and produces cleaner xml so it's preferable but not implicitly required. If you don't want it, remove it from the
and you'll be good to go.
The documentation (non-existent) provides more on this but essentially you create an OpenClip object / class instance and that object has a number of built in methods for manipulating the data within.
Here's an example that creates a generic clip object. (no file specified)
>>> import openclip >>> oc = openclip.OpenClip() >>> oc.clip <openclip.elements.Clip object at 0x102529c90> >>> print oc.clip.xml <clip type="clip" version="3"><name type="string">OpenClip_20160108_120119_93</name></clip> >>> oc.clip.tracks <openclip.elements.Tracks object at 0x10252e910> >>> oc.clip.versions <openclip.elements.Versions object at 0x10252e950> >>> oc.clip.tracks.track_list  >>> oc.clip.versions.version_list 
Product Requirements (IMO) are (in order):
The following are my own requirements for this module, in no particular order. Some have already been satisfied.
- to model openclip xml in an atomic building block fashion using python classes
- to create working openclip xml documents from input or by parsing existing files
- to safely retain/backup metadata in potentially destructive write operations
- to have it intuitively and recursively create clip files from a tree using pyseq,lss,mls etc.
- to introspect existing clip files and allow interactive wizard-style editing
- to merge clip files
- to change paths on clip files
- to generate placeholder media for sequences that don't exist
- pluggable openclip module for use in maya, houdini, nuke, hiero, fcp?
- truly open format
- interactive wizard style component
tox for testing and Travis CI (a distributed continuous integration service used to build and test projects hosted at GitHub).
Running the tests should be as easy as typing:
(assuming you have tox and pytest installed of course.)
python-openclip uses a number of opensource packages.
- Parse is the opposite of the python
- PySeq finds groups of items that follow a naming convention containing a numerical sequence.
- timecode provides timecode manipulation functions.
- colorama provides cross-platform colored terminal text in Python.
- colorlog is a colored formatter for the python logging module.
- Munch (previously bunch) is a Python dictionary that provides attribute-style access.
The MIT License (MIT)
Copyright (c) 2016 Robert Moggach
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.