Comments (3)
The AAF Edit Protocol says relative paths are supported. If pro tools supports them is another story. I'm not entirely sure the syntax, the spec says to follow RFC 2396. Unfortunately I don't have access to pro tools to test.
from pyaaf2.
Hi, I try to necro-bump this issue, but I'm facing the same "problem".
I really hate that the AAF produced by Logic Pro has these damn absolute path... It's completely stupid: I'm saving the AAF to pass my project (song) to a guy using another DAW and the best I can do is a damn file not easily usable if moved from the original directory on the original computer used to export... It's a nonsense...
I also hate that Logic Pro is exporting all the wav files in a directory called "Audio Files" (let's start hating the use of the space...). Two songs exported? The second is "Audio Files 2". Completely idiot...
So I wrote a pyaaf2 script to change the AAF file to change this path.
It took a while but I managed to make it work (so now I can move and rename the dir with the wav files where I like) but I ended not being able to "relativify" the paths...
None of the commented ones are working:
path_in = "file:///Users/bozzo/Documents/Musica/GarageBand/NuvolaNera/Audio%20Files"
path_out = "file:///Users/bozzo/Documents/Musica/GarageBand/NuvolaNera/NuvolaNera_Files"
#path_out = "file://NuvolaNera_Files"
#path_out = "file://.NuvolaNera_Files"
#path_out = "file://./NuvolaNera_Files"
#path_out = "./NuvolaNera_Files"
There's something I miss in how I write the path?
Script attached (I had to add .txt...) and full code copied below if someone would need it.
aaf_editor.py.txt
Matteo
import aaf2
import chardet
source_file = "./NuvolaNera.AAF"
dest_file = "./NuvolaNera_edited.AAF"
path_in = "file:///Users/bozzo/Documents/Musica/GarageBand/NuvolaNera/Audio%20Files"
path_out = "file:///Users/bozzo/Documents/Musica/GarageBand/NuvolaNera/NuvolaNera_Files"
#path_out = "file://NuvolaNera_Files"
#path_out = "file://.NuvolaNera_Files"
#path_out = "file://./NuvolaNera_Files"
#path_out = "./NuvolaNera_Files"
path_in_enc = path_in.encode('utf-16le','strict')
path_out_enc = path_out.encode('utf_16le','strict')
def copy_mobs(a, b):
for mob in a.content.mobs:
if mob.mob_id not in b.content.mobs:
# copy the mob from file a into file b
mob_copy = mob.copy(root=b)
b.content.mobs.append(mob_copy)
def copy_essence_data(a, b):
for essence_data in a.content.essencedata:
if essence_data.mob_id not in b.content.essencedata:
# copy the essence data from file a into file b
essence_data_copy = essence_data.copy(root=b)
b.content.essencedata.append(essence_data_copy)
with aaf2.open(dest_file, "w") as f_dest:
with aaf2.open(source_file, "r") as f:
# f.dump()
# f.content.dump()
f_dest.dictionary.update(f.dictionary)
for mm in f.content.mobs:
print("name: ", mm.name)
if ".wav" in mm.name:
# mm.dump()
# print(mm.keys())
ed = mm.get("EssenceDescription")
# print(type(ed))
if ed is not None:
# print(" Ess.Descr. name: ", ed.name)
p1d = ed.propertydef
# print(" Prop.1.Def. name: ", p1d.name)
r1 = ed.value
# print(r1)
d1 = ed.data
# print(d1.decode())
# print(ed.object.keys())
ll = ed.object.get("Locator")
# print(ll.value)
nll = ll.value
nl = nll[0]
# print(nl.keys())
us = nl.get("URLString")
# print(type(us))
# print(type(us.data))
# print(us.data)
# the_encoding = chardet.detect(us.data)['encoding']
# print(the_encoding)
print(us.data.decode())
ss = us.data.decode('utf_16le','strict')
# print(type(ss))
# print("Len: ", len(ss))
ss = ss.replace(path_in, path_out)
# data_new = us.data.replace(path_in_enc, path_out_enc)
# ss_new = data_new.decode()
# print(ss_new)
print(ss)
us.data=ss.encode('utf_16le','strict')
print(mm.get("EssenceDescription").object.get("Locator").value[0].get("URLString").data.decode())
copy_mobs(f, f_dest)
copy_essence_data(f, f_dest)
from pyaaf2.
Just for reference.
On the AAF Edit Protocol document, pag 10:
The EssenceDescriptor::Locator property should include at least one NetworkLocator that complies with the following constraints:
- The NetworkLocator has a URI that complies with RFC 2396.
- It is an absolute or a relative URI.
- If it is an absolute URI, it conforms to the RFC1738 file URI scheme.
- If it is a relative URI, the base URI is determined from the URI of the AAF file itself.
When exporting an AAF file containing relative URIs, the exporting application should also export the target resources. If this is not possible, absolute URIs should be substituted or appended as additional NetworkLocators.
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
- Simple Timeline Example (with linked MXFs) 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 4
- 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.