OpenTilmelineIO

GitHub : ‣

Academy Software Foundation(ASWF) :

Academy Software Foundation - ASWF

References

.otio files

https://github.com/darbyjohnston/otio-oc-examples

reference guid

Welcome to OpenTimelineIO’s documentation! — OpenTimelineIO 0.15.0 documentation

GitHub:OpenTimelineIO viewer

https://github.com/OpenTimelineIO/raven

https://github.com/OpenTimelineIO/raven

Python test code

OpenTimelineIO for Python

PyPi : https://pypi.org/project/OpenTimelineIO/

Python:

※ どこかのバージョンでfind_clips()など無くなってtracksに変わった??

import opentimelineio as otio

timeline = otio.adapters.read_from_file("foo.aaf")
for clip in timeline.find_clips():
  print(clip.name, clip.duration())

There are more code examples here: https://github.com/AcademySoftwareFoundation/OpenTimelineIO/tree/main/examples

Also, looking through the unit tests is a great way to see what OTIO can do: https://github.com/AcademySoftwareFoundation/OpenTimelineIO/tree/main/tests

OTIO includes a viewer program as well (see the quickstart section for instructions on installing it):

Python Examples:

# EDIT_FILE = 'tst_v0001.edl'
# EDIT_FILE = 'tst_v0001.xml'
# EDIT_FILE = 'tst_v0001.aaf'
EDIT_FILE = 'tst_v0001.otio'

def load_timeline(spp):
    """ Load Timeline """    
    timeline = otio.adapters.read_from_file(EDIT_FILE)
    print(timeline)

    """ Read Tracks """
    tracks = timeline.video_tracks()

    for track in tracks:
        for item in track:
            if isinstance(item, otio.schema.Clip):
                print('#---------------------------')
                print(f'name = {item.name}')
                print('#---------------------------')
                print(item)
                print(f'clipin = {item.source_range.start_time.value}')
                print(f'clipout = {item.source_range.end_time_inclusive().value}')
                print(item.duration())

timeline

from pprint import pprint
import opentimelineio as otio

edl = r'vfx_v0001.edl'

timeline = otio.adapters.read_from_file(edl)
pprint(dir(timeline))

# Result
['__class__',
 '__copy__',
 '__deepcopy__',
 '__delattr__',
 '__dict__',
 '__dir__',
 '__doc__',
 '__eq__',
 '__format__',
 '__ge__',
 '__getattribute__',
 '__gt__',
 '__hash__',
 '__init__',
 '__init_subclass__',
 '__le__',
 '__lt__',
 '__module__',
 '__ne__',
 '__new__',
 '__reduce__',
 '__reduce_ex__',
 '__repr__',
 '__setattr__',
 '__sizeof__',
 '__str__',
 '__subclasshook__',
 '_dynamic_fields',
 'audio_tracks',
 'children_if',
 'clip_if',
 'clone',
 'deepcopy',
 'duration',
 'each_child',
 'each_clip',
 'from_json_file',
 'from_json_string',
 'global_start_time',
 'is_equivalent_to',
 'is_unknown_schema',
 'metadata',
 'name',
 'range_of_child',
 'schema_name',
 'schema_version',
 'to_json_file',
 'to_json_string',
 'tracks',
 'video_tracks']
video_tracks = timeline.video_tracks()

for track in video_tracks:
    print(track)
for clip in timeline.find_clips():
    print(clip.name, clip.duration())
ideo_tracks = timeline.video_tracks()

for track in video_tracks:
		name = track.name
		duration = track.duration()
		frame_count = duration.value

    print(name, duration, frame_count)

Clip schema

['DEFAULT_MEDIA_KEY',
 '__class__',
 '__copy__',
 '__deepcopy__',
 '__delattr__',
 '__dict__',
 '__dir__',
 '__doc__',
 '__eq__',
 '__format__',
 '__ge__',
 '__getattribute__',
 '__gt__',
 '__hash__',
 '__init__',
 '__init_subclass__',
 '__le__',
 '__lt__',
 '__module__',
 '__ne__',
 '__new__',
 '__reduce__',
 '__reduce_ex__',
 '__repr__',
 '__setattr__',
 '__sizeof__',
 '__str__',
 '__subclasshook__',
 '_dynamic_fields',
 'active_media_reference_key',
 'available_image_bounds',
 'available_range',
 'clone',
 'deepcopy',
 'duration',
 'each_clip',
 'effects',
 'enabled',
 'from_json_file',
 'from_json_string',
 'is_equivalent_to',
 'is_unknown_schema',
 'markers',
 'media_reference',
 'media_references',
 'metadata',
 'name',
 'overlapping',
 'parent',
 'range_in_parent',
 'schema_name',
 'schema_version',
 'set_media_references',
 'source_range',
 'to_json_file',
 'to_json_string',
 'transformed_time',
 'transformed_time_range',
 'trimmed_range',
 'trimmed_range_in_parent',
 'visible',
 'visible_range']