Comments (10)
File locators are always on a SourceMob's EssenceDescriptor, its pretty easy extract them.
import aaf2
with aaf2.open("/path/to/file.aaf") as f:
for mob in f.content.sourcemobs():
for loc in mob.descriptor.locator:
print(loc['URLString'].value)
you can make the paths prettier with urllib
I would no recommend trying to get them out with regex expressions as a AAF file is basically a Fat32 filesystem. Some sectors of the file could be marked FREE but still contain previous data and not zeroed out.
from pyaaf2.
yes, pyaaf2 includes a mxf parser.
from aaf2 import mxf
path = "/path/to/file.mxf"
m = mxf.MXFFile(path)
m.dump()
The parser is used internally to make it really easy to link to external mxf files.
import aaf2
with aaf2.open(out_file, 'w') as f:
path = "/path/to/file.mxf"
mobs = f.content.link_external_mxf(path)
from pyaaf2.
sorry, i should have been more clear- i have a .aaf file and i am trying to parse out all of the .mxf paths so i can pass them to a copy tool.
a co-worker wrote some regex up to try and parse out the binary and piece the paths together- it works most of the time :P
from pyaaf2.
Hi Mark,
i would be interested in such a method either. I am specifically searching for a way to get paths to audio material for certain Mobs.
Kind Regards,
Randolf
from pyaaf2.
Interestingly -- for a show with MXF files on a nexis, the sourcemob descriptor.locator turns out to often be the location of the original source media rather than the MXF media actually used within the edit.
I'm running this code:
with aaf2.open(sys.argv[1], "r") as f:
for mobby in f.content.sourcemobs():
#test whether locator attribute exists before accessing it to avoid error
if hasattr(mobby.descriptor, 'locator'):
for loc in mobby.descriptor.locator:
file_location = unquote(loc['URLString'].value.encode('utf-8'))
file_location = file_location.replace('file:///','/Volumes/')
file_location = file_location.replace('file://nexispro/','/Volumes/')
print(file_location)
And the result of that code includes lots of entries like this one, which points to the mxf media on our SFX volume that I'd like to copy:
/Volumes/SFX/Avid MediaFiles/MXF/zMike_L.1/A02.D871DD8B_18A2A18A2A20BA.mxf
And also a bunch like this:
/Volumes/Avid_HD/Users/user/Desktop/S_070352_001.mp3
--These point to original file locations from which an editor probably imported a piece of media, and this original location info is of no use to me -- I've checked and the sequence in media composer is using mxf files in the SFX volume, not an AMA-link to an actual mp3 file that was once on someone's desktop (the horror).
I wonder if there's some actual media location metadata hiding in the AAF file for such clips? I'm not finding it, yet.
from pyaaf2.
Checking the Descriptor class type could help filter out those. The Mp3 file is probably from a ImportDescriptor which sounds like you don't care about. The aaf would only contains the mxf path at time of export.
from pyaaf2.
Hi,
I have the same problem, I can't seem to find a way to filter out just the actual media paths (Avid structure). Has someone managed to solve this?
Thanks!
Igor
from pyaaf2.
Above code works a treat for me, assuming I add in a filter for import descriptors.
if hasattr(mob.descriptor, 'locator') and not isinstance(mob.descriptor, aaf2.essence.ImportDescriptor)
Some of the source mobs don't seem to have correlative file on disk, but they appear to be unecessary for a successful relink in AVID.
(edit for spelling)
from pyaaf2.
Hi Mark!
i have an aaf file that I can successfully import into Resolve. If I take that same file, open it, do no editing and just save it out, I get this error when importing:
Error: No timeline detected in the given file, operation failed.
This is the save I am doing:
with aaf2.open(aaf_file, 'w') as f:
f.save()
I was just testing out a very basic save to give to someone - I did also try the example in your docs (writing out a new mob with an mov and a wav file) and that also failed when I tired to import.
from pyaaf2.
@steccino I think your problem is you need to open the file as 'rw'. opeing 'w' will create a new file overwriting the old file.
from pyaaf2.
Related Issues (20)
- Error on walk() with returned Sequence HOT 2
- Creating AAF using WAV file HOT 5
- export must be in mono not in stéréo. HOT 2
- Exporting embedded essence AAFs are tricky to open in other software HOT 3
- Confused on how to add a new track HOT 4
- Destructive (in-place) change of MXF files HOT 3
- AAF create timeline of cuts with group clip HOT 1
- How to preserve link to source files after downloading an aaf from the server? HOT 1
- Create video essence from image sequence HOT 1
- 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
- Changing creation time in aaf and creating empty sequence file HOT 4
- Error when opening aaf file HOT 2
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.