{"action":"created","issue":{"url":"https://api.github.com/repos/markreidvfx/pyaaf/issues/16","labels_url":"https://api.github.com/repos/markreidvfx/pyaaf/issues/16/labels{/name}","comments_url":"https://api.github.com/repos/markreidvfx/pyaaf/issues/16/comments","events_url":"https://api.github.com/repos/markreidvfx/pyaaf/issues/16/events","html_url":"https://github.com/markreidvfx/pyaaf/issues/16","id":99618952,"number":16,"title":"Setting start/end and mark In/Out on source clip","user":{"login":"ylathouris","id":10243681,"avatar_url":"https://avatars.githubusercontent.com/u/10243681?v=3","gravatar_id":"","url":"https://api.github.com/users/ylathouris","html_url":"https://github.com/ylathouris","followers_url":"https://api.github.com/users/ylathouris/followers","following_url":"https://api.github.com/users/ylathouris/following{/other_user}","gists_url":"https://api.github.com/users/ylathouris/gists{/gist_id}","starred_url":"https://api.github.com/users/ylathouris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ylathouris/subscriptions","organizations_url":"https://api.github.com/users/ylathouris/orgs","repos_url":"https://api.github.com/users/ylathouris/repos","events_url":"https://api.github.com/users/ylathouris/events{/privacy}","received_events_url":"https://api.github.com/users/ylathouris/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-07T09:59:44Z","updated_at":"2015-08-11T15:49:48Z","closed_at":null,"body":"Hello, \r\n\r\nWe are having some issues setting the source start/end and mark in/out for a clip in Avid. \r\n\r\nWe are trying to facilitate a workflow between Maya and Avid Media Composer. In Maya, an artist will create a 3D sequence using storyboards as reference material. The output from Maya is an EDL-like file and a set of shot-based image sequences. The image sequences are converted to raw DNxHD video streams and that is what we're using to build the AAF with the pyaaf library.\r\n\r\nThe start frame of each image sequence is usually some number greater than zero (i.e. frame range: 100-200). If possible, we would like to preserve the original frame ranges when creating the AAF. This is important because it allows us to update the Maya sequence after the editor has worked on it in Avid Media Composer. Is it possible to set the start/end of the source media, as well as the mark in/out when building an AAF using pyaaf? \r\n\r\nWe are considering embedding a start timecode in the raw DNxHD video streams but I am hoping there is another way. \r\n\r\nFor your reference, this is roughly the code we're using:\r\n\r\n```python\r\n\r\nframe_rate = 24\r\n\r\naaf_file = aaf.open('/foo/bar/baz.aaf', 'w')\r\n\r\nfactory = aaf_file.dictionary\r\nstorage = aaf_file.storage\r\n\r\ncomposition_mob = factory.create.CompositionMob('my_sequence')\r\nstorage.add_mob(composition_mob)\r\n\r\n# Build sequence.\r\nsequence = factory.create.Sequence('Picture')\r\n\r\n# Build track.\r\ntrack_number = 0\r\ncomposition_mob.append_new_timeline_slot(\r\n    frame_rate,\r\n    sequence,\r\n    slotID=track_number\r\n)\r\n\r\n# Build clip.\r\nmaster_mob = factory.create.MasterMob(clip.name)\r\nstorage.add_mob(master_mob)\r\n\r\n# Build essence.\r\nmaster_mob.import_video_essence('/foo/bar/baz.dnxhd', frame_rate)\r\n\r\n# Build source clip (i.e. frame range: 100-200).\r\ntimeline_mob_slot = master_mob.slots()[-1]\r\nslot_id = timeline_mob_slot.slotID\r\n\r\n# Set in/out (i.e. 8 frame handles)\r\ntimeline_mob_slot.mark_in = 108\r\ntimeline_mob_slot.mark_out = 193\r\n\r\nstart = 100\r\nduration = 101\r\nsource_clip = master_mob.create_clip(slot_id, duration, start)\r\n\r\nsequence.append(source_clip)\r\n```\r\n\r\nI'm pretty sure this actually results in an **Insufficient Media Error** in Avid Media Composer but hopefully it gives you an idea of what we are trying to achieve. \r\n\r\nCheers "},"comment":{"url":"https://api.github.com/repos/markreidvfx/pyaaf/issues/comments/129939433","html_url":"https://github.com/markreidvfx/pyaaf/issues/16#issuecomment-129939433","issue_url":"https://api.github.com/repos/markreidvfx/pyaaf/issues/16","id":129939433,"user":{"login":"ylathouris","id":10243681,"avatar_url":"https://avatars.githubusercontent.com/u/10243681?v=3","gravatar_id":"","url":"https://api.github.com/users/ylathouris","html_url":"https://github.com/ylathouris","followers_url":"https://api.github.com/users/ylathouris/followers","following_url":"https://api.github.com/users/ylathouris/following{/other_user}","gists_url":"https://api.github.com/users/ylathouris/gists{/gist_id}","starred_url":"https://api.github.com/users/ylathouris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ylathouris/subscriptions","organizations_url":"https://api.github.com/users/ylathouris/orgs","repos_url":"https://api.github.com/users/ylathouris/repos","events_url":"https://api.github.com/users/ylathouris/events{/privacy}","received_events_url":"https://api.github.com/users/ylathouris/received_events","type":"User","site_admin":false},"created_at":"2015-08-11T15:49:48Z","updated_at":"2015-08-11T15:49:48Z","body":"This is what I came up with:\r\n\r\n```python\r\n# Build essence.\r\nmaster_mob.import_video_essence('/foo/bar/baz.dnxhd', frame_rate)\r\n\r\n# Build source clip (i.e. frame range: 100-200).\r\ntimeline_mob_slot = master_mob.slots()[-1]\r\n\r\n# Add timecode slot to allow for non-zero source media start/end values.\r\ntimecode = factory.create.Timecode(\r\n    101,  # duration\r\n    8,  # mark in\r\n    frame_rate\r\n)\r\n\r\nmaster_mob.append_new_timeline_slot(frame_rate, timecode)\r\n```\r\n\r\nNot sure if this is the recommended way but this seems to work."}}