Comments (1)
Ok, I've done some digging into this and have solved my own issue. I can create a sequence linked to source clips. Here's my code below:
from __future__ import (
unicode_literals,
absolute_import,
print_function,
division,
)
import dumper
import inspect
import aaf2
import os
os.system('cls') # for mac and linux os.system('clear')
source_files = ["Z:\\Avid MediaFiles\\MXF\\SFX_BBC_MXFs\\4Minute_BBA01.5E5D05003B53A.mxf",
"Z:\\Avid MediaFiles\\MXF\\SFX_BBC_MXFs\\4Minute_BBA02.5E5D05003CA7A.mxf"]
with aaf2.open("output.aaf", "w") as f:
# Firstly, add links to existing MXF OP-Atom files
# This creates mobs for each file, along with a MasterMob which links the individual stereo files.
print("Adding MXF files")
for source_file_path in source_files:
f.content.link_external_mxf(source_file_path)
# Get the MasterMob, so that we can use it.
master_mob = next(mob for mob in f.content.mobs if isinstance(mob, aaf2.mobs.MasterMob))
print("Creating a sequence")
# Create a new 24 fps timeline.
video_rate = " 24000/1001"
# A timeline is a CompositionMob with TimelineMobSlots per track (video and audio)
comp_mob = f.create.CompositionMob() # A sequence in Avid terminology
comp_mob.name = "Test sequence"
f.content.mobs.append(comp_mob)
v1_timeline = comp_mob.create_timeline_slot(video_rate) #TimelineMobSlot, a track on a sequence
a1_timeline = comp_mob.create_timeline_slot(video_rate)
a2_timeline = comp_mob.create_timeline_slot(video_rate)
# Each TimelineMobSlot has a segment property. This can hold a variety of different kinds of object, but the simplest
# is a Sequence, which just represents a Sequence of sequential elements.
v1_sequence = f.create.Sequence(media_kind="picture") #Sequence of elements
a1_sequence = f.create.Sequence(media_kind="sound") #Sequence of elements
a2_sequence = f.create.Sequence(media_kind="sound") #Sequence of elements
v1_timeline.segment = v1_sequence
a1_timeline.segment = a1_sequence
a2_timeline.segment = a2_sequence
# Now let's create 10 clips, and 10 spaces on each timeline
for i in range(10):
v1_clip = f.create.Filler('picture', 200)
v1_sequence.components.append(v1_clip)
# NOTE, a clip doesn't have a start timecode, and they are just placed sequentially.
v1_clip = f.create.Filler('picture', 100)
v1_sequence.components.append(v1_clip)
a1_clip = master_mob.create_source_clip(slot_id=1) #get the first track from the master_mob, and create a source clip from it.
a1_clip.start = 20 # Note, this is 20 edit_units in sequence units
a1_clip.length = 200 # Note, if you want the full clip, have to get the length
a1_sequence.components.append(a1_clip)
a1_clip_2 = f.create.Filler('sound', 100)
a1_sequence.components.append(a1_clip_2)
a2_clip = master_mob.create_source_clip(slot_id=2)
a2_clip.length = 200
a2_sequence.components.append(a2_clip)
a2_clip_2 = f.create.Filler('sound', 100)
a2_sequence.components.append(a2_clip_2)
print("---")
print("MXF File written")
from pyaaf2.
Related Issues (20)
- Combining segments from two AAF-files to create a new single AAF-file HOT 1
- I cant get this code to work - any tips would be appreciated: HOT 1
- Need help to get timeline TC of certain effects HOT 1
- Creating AAF with OperationGroup of type AudioWarp HOT 1
- Difference between group clips and sequences - both are composition mobs HOT 4
- packing signed/unsigned HOT 1
- Get Source Clip and put into new Timeline
- Manipulate an existing AAF's sequence timing HOT 1
- urlstring corruption above 254 character path. pyaaf2 or AMC? HOT 2
- AVX Parameter - Info HOT 2
- Help with setting Sequence start time HOT 1
- Added a property to Mobs.py - not sure of correct way to create pull request etc HOT 2
- AMA AAF from XAVC100 MXF op1a file
- Adding nested attributes to master mob attributes... HOT 1
- Bezier frame interpolation doesn't match Avid HOT 1
- Avid's keyframe values different from PyAAF2 interpolation with extreme bezier handles HOT 9
- Simple AAF with embedded WAV file won't open in Avid Media Composer
- Error opening aaf file HOT 3
- get_object() and get() using object name removed from StrongRefSetProperty
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyaaf2.