opentimelineio.adapters package

Expose the adapter interface to developers.

To read from an existing representation, use the read_from_string and read_from_file functions. To query the list of adapters, use the available_adapter_names function.

The otio_json adapter is provided as a the canonical, lossless, serialization of the in-memory otio schema. Other adapters are to varying degrees lossy. For more information, consult the documentation in the individual adapter modules.


Return a string list of the available adapters.


Guess the adapter object to use for a given filepath.

“foo.otio” returns the “otio_json” adapter.

Fetch the adapter object by the name of the adapter directly.

opentimelineio.adapters.read_from_file(filepath, adapter_name=None, media_linker_name='__default', media_linker_argument_map=None, **adapter_argument_map)

Read filepath using adapter_name.

If adapter_name is None, try and infer the adapter name from the filepath.

For example:
timeline = read_from_file(“example_trailer.otio”) timeline = read_from_file(“file_with_no_extension”, “cmx_3600”)
opentimelineio.adapters.read_from_string(input_str, adapter_name='otio_json', media_linker_name='__default', media_linker_argument_map=None, **adapter_argument_map)

Read a timeline from input_str using adapter_name.

This is useful if you obtain a timeline from someplace other than the filesystem.

raw_text = urlopen(my_url).read() timeline = read_from_string(raw_text, “otio_json”)
opentimelineio.adapters.suffixes_with_defined_adapters(read=False, write=False)

Return a set of all the suffixes that have adapters defined for them.

opentimelineio.adapters.write_to_file(input_otio, filepath, adapter_name=None, **adapter_argument_map)

Write input_otio to filepath using adapter_name.

If adapter_name is None, infer the adapter_name to use based on the filepath.

otio.adapters.write_to_file(my_timeline, “output.otio”)
opentimelineio.adapters.write_to_string(input_otio, adapter_name='otio_json', **adapter_argument_map)

Return input_otio written to a string using adapter_name.

raw_text = otio.adapters.write_to_string(my_timeline, “otio_json”)


opentimelineio.adapters.adapter module

Implementation of the OTIO internal Adapter system.

For information on writing adapters, please consult: # noqa
class opentimelineio.adapters.adapter.Adapter(name=None, execution_scope=None, filepath=None, suffixes=None)

Bases: opentimelineio.plugins.python_plugin.PythonPlugin

Adapters convert between OTIO and other formats.

Note that this class is not subclassed by adapters. Rather, an adapter is a python module that implements at least one of the following functions:

write_to_string(input_otio) write_to_file(input_otio, filepath) (optionally inferred) read_from_string(input_str) read_from_file(filepath) (optionally inferred)

…as well as a small json file that advertises the features of the adapter to OTIO. This class serves as the wrapper around these modules internal to OTIO. You should not need to extend this class to create new adapters for OTIO.

For more information: # noqa


return true if adapter supports feature_string, which must be a key of the _FEATURE_MAP dictionary.

Will trigger a call to self.module(), which imports the plugin.

read_from_file(filepath, media_linker_name='__default', media_linker_argument_map=None, **adapter_argument_map)

Execute the read_from_file function on this adapter.

If read_from_string exists, but not read_from_file, execute that with a trivial file object wrapper.

read_from_string(input_str, media_linker_name='__default', media_linker_argument_map=None, **adapter_argument_map)

Call the read_from_string function on this adapter.


File suffixes associated with this adapter.

write_to_file(input_otio, filepath, **adapter_argument_map)

Execute the write_to_file function on this adapter.

If write_to_string exists, but not write_to_file, execute that with a trivial file object wrapper.

write_to_string(input_otio, **adapter_argument_map)

Call the write_to_string function on this adapter.

opentimelineio.adapters.cmx_3600 module

OpenTimelineIO CMX 3600 EDL Adapter

class opentimelineio.adapters.cmx_3600.ClipHandler(line, comment_data, rate=24)

Bases: object

class opentimelineio.adapters.cmx_3600.CommentHandler(comments)

Bases: object

comment_id_map = {'ASC_SAT': 'asc_sat', 'ASC_SOP': 'asc_sop', 'FROM CLIP': 'media_reference', 'FROM CLIP NAME': 'clip_name', 'FROM FILE': 'media_reference', 'LOC': 'locator', 'M2': 'motion_effect', '\\* FREEZE FRAME': 'freeze_frame'}
regex_template = '\\*?\\s*{id}:?\\s*(?P<comment_body>.*)'
class opentimelineio.adapters.cmx_3600.DissolveEvent(a_side_event, transition, b_side_clip, tracks, kind, rate, style)

Bases: object


Example output:

Cross dissolve… 002 Clip1 V C 00:00:07:08 00:00:07:08 00:00:01:21 00:00:01:21 002 Clip2 V D 100 00:00:09:07 00:00:17:15 00:00:01:21 00:00:10:05 * FROM CLIP NAME: Clip1 * FROM CLIP: /var/tmp/clip1.001.exr * TO CLIP NAME: Clip2 * TO CLIP: /var/tmp/clip2.001.exr

Fade in… 001 BL V C 00:00:00:00 00:00:00:00 00:00:00:00 00:00:00:00 001 My_Clip V D 012 00:00:02:02 00:00:03:04 00:00:00:00 00:00:01:02 * TO CLIP NAME: My Clip * TO FILE: /var/tmp/clip.001.exr

Fade out… 002 My_Clip V C 00:00:01:12 00:00:01:12 00:00:00:12 00:00:00:12 002 BL V D 012 00:00:00:00 00:00:00:12 00:00:00:12 00:00:01:00 * FROM CLIP NAME: My Clip * FROM FILE: /var/tmp/clip.001.exr

exception opentimelineio.adapters.cmx_3600.EDLParseError

Bases: opentimelineio.exceptions.OTIOError

class opentimelineio.adapters.cmx_3600.EDLParser(edl_string, rate=24, ignore_timecode_mismatch=False)

Bases: object

add_clip(line, comments, rate=24)
add_transition(clip_handler, transition, data)
parse_edl(edl_string, rate=24)
class opentimelineio.adapters.cmx_3600.EDLWriter(tracks, rate, style)

Bases: object

get_content_for_track_at_index(idx, title)
class opentimelineio.adapters.cmx_3600.Event(clip, tracks, kind, rate, style)

Bases: object

Example output:
002 AX V C 00:00:00:00 00:00:00:05 00:00:00:05 00:00:00:10 * FROM CLIP NAME: test clip2 * FROM FILE: S:vartmptest.exr
class opentimelineio.adapters.cmx_3600.EventLine(kind, rate)

Bases: object

opentimelineio.adapters.cmx_3600.read_from_string(input_str, rate=24, ignore_timecode_mismatch=False)

Reads a CMX Edit Decision List (EDL) from a string. Since EDLs don’t contain metadata specifying the rate they are meant for, you may need to specify the rate parameter (default is 24). By default, read_from_string will throw an exception if it discovers invalid timecode in the EDL. For example, if a clip’s record timecode overlaps with the previous cut. Since this is a common mistake in many EDLs, you can specify ignore_timecode_mismatch=True, which will supress these errors and attempt to guess at the correct record timecode based on the source timecode and adjacent cuts. For best results, you may wish to do something like this:

>>> try:
...     timeline = otio.adapters.read_from_string("mymovie.edl", rate=30)
... except EDLParseError:
...    print('Log a warning here')
...    try:
...        timeline = otio.adapters.read_from_string(
...            "mymovie.edl",
...            rate=30,
...            ignore_timecode_mismatch=True)
...    except EDLParseError:
...        print('Log an error here')
opentimelineio.adapters.cmx_3600.write_to_string(input_otio, rate=None, style='avid')

opentimelineio.adapters.fcp_xml module

OpenTimelineIO Final Cut Pro 7 XML Adapter.


opentimelineio.adapters.otio_json module

This adapter lets you read and write native .otio files

opentimelineio.adapters.otio_json.write_to_file(input_otio, filepath)