markreidvfx / pyaaf

Python Bindings for the Advanced Authoring Format (AAF)
http://markreidvfx.github.io/pyaaf
MIT License
49 stars 9 forks source link

Make it easy to link to external mxf file #8

Open markreidvfx opened 9 years ago

markreidvfx commented 9 years ago

Need to figure out how to link to external mxf files and write a good example

ingex does this

From my understanding a NetworkLocator is not enough, MobID of the sourceMob needs to match the UMID of FilePackage of mxf and the CDCIDescriptor need to match.

Recent patches added to ffmpeg expose the file_package_uuid as metadata so I'm hoping to use PyAV to gather the necessary information.

stabacco commented 9 years ago

I was given this example by avid a few months ago when i had to do the same thing.

https://github.com/evanboyd/Avid-Interplay-AAF

NetworkLocators are not enough yeah, the main UID you are interested in is something called 'Physical package UID' ( avidmxfinfo displays that ). the sourceClip.mob_id must match those ones.

markreidvfx commented 9 years ago

Perfect! Thanks for the example, thats way more straight forward then the ingex example.

stabacco commented 9 years ago

Have you gone any further on this? i still struggle linking the correct ids from the mxf with the matching AAF package

i currently have a sourceMob with a tape descriptor and i set its mobID to match the match to the physicalPackageUID of the mxf

and a file mob (sourceMob with a CDCIDescriptor) and i set the mobID to match the filePackageUID of the mxf

It seems to work but then, whenever i try to check in the aaf into interplay i get an 1102 error. Thanks for your help, Ste

markreidvfx commented 9 years ago

I have a interplay example that a user supplied for there baselight workflow, thats working for them.

https://github.com/markreidvfx/pyaaf/blob/dev/example/baselight_multiaaf.py

and that was based on my current work in progress, if you want to take a look. https://github.com/markreidvfx/pyaaf/blob/dev/example/link_external_mxf.py

Sometimes just the file_package_umid and CDCIDescriptor is enough ( I think its if the clip is already in the bin) and sometimes you need full tape descriptor or import descriptor. I haven't had much time to really dig into this issue.

rahulbisen commented 8 years ago

I needed to create AAF without with cut only info ie. creating/embedding media. This is to quickely be able to generate AAF with cut only info.

I tried using MasterMob.create_essence as opposed to MasterMob.import_video_essence, which did not embed the media bytes into the AAF. The issue I face with this is; Avid shows the clip/cut info but complains of missing clips upon AAF import and raises PMM_INSUFFICIENT_MEDIA exception during playback. Is there a way to tell Avid that the media is offline(or does not exist) so it doesn't look for it.

I am now exploring the 'linking external mxf files' (I can use previously generated media as the playback in Avid is not critical). I would rely on the fact that non-existing linked files will not cause an issue in Avid during AAF import and playback. It should still playback empty frames and consider it 'media offline'

@markreidvfx , in the previous comment you mention about the file_package_umid and CDCIDescriptor vs full tape descriptor or import descriptor issue. Did you get time to look into it further? Or do you have a more recent version of "link_external_mxf.py"

rahulbisen commented 8 years ago

Hey Mark, a question: Can we link '.dnxhd' or '.mov' external files through a NetworkLocator? And in that case, what should be the container_format and compression values to be set on the Descriptor. I was trying to follow the example in tests/test_create.test_external_mob. The goal is to be able to create AAFs with linked media that can be launched with AVID.

rahulbisen commented 8 years ago

I was able to create an AAF with linking to an external .mfx file using a locator, following the example in tests/test_create.test_external_mob. But avid is snot able to find the clip, even if it exists on disk and is accessible through the URL in a browser. getting following issues:

I have set, 'desc.container_format = "AAFKLV"' as shown in the test/example, avid is not able to import the clip. Upon AAF import it shows the popup saying 'Failed ti import the clip'

Below is ffprobe output for my .mxf file

Metadata: uid : adab4424-2f25-4dc7-92ff-29bd000b0000 generation_uid : adab4424-2f25-4dc7-92ff-29bd000b0001 company_name : FFmpeg product_name : OP1a Muxer product_version : 54.63.104 product_uid : adab4424-2f25-4dc7-92ff-29bd000b0002 modification_date: 0-01-01 00:00:00 timecode : 00:00:00:00 Duration: 00:00:08.76, start: 0.000000, bitrate: 121451 kb/s Stream #0:0: Video: dnxhd, yuv422p, 1920x1080, 25 fps, 25 tbr, 25 tbn, 25 tbc "streams": [ { "index": 0, "codec_name": "dnxhd", "codec_long_name": "VC3/DNxHD", "codec_type": "video", "codec_time_base": "1/25", "codec_tag_string": "[0][0][0][0]", "codec_tag": "0x0000", "width": 1920, "height": 1080, "has_b_frames": 0, "sample_aspect_ratio": "0:1", "display_aspect_ratio": "0:1", "pix_fmt": "yuv422p", "level": -99, "r_frame_rate": "25/1", "avg_frame_rate": "25/1", "time_base": "1/25", "start_pts": 0, "start_time": "0.000000", "duration_ts": 219, "duration": "8.760000", "disposition": { "default": 0, "dub": 0, "original": 0, "comment": 0, "lyrics": 0, "karaoke": 0, "forced": 0, "hearing_impaired": 0, "visual_impaired": 0, "clean_effects": 0, "attached_pic": 0 } } ], "format": { "filename": "edl-par_seq-previs-v003.mxf", "nb_streams": 1, "nb_programs": 0, "format_name": "mxf", "format_long_name": "MXF (Material eXchange Format)", "start_time": "0.000000", "duration": "8.760000", "size": "132988973", "bit_rate": "121451116", "probe_score": 100, "tags": { "uid": "adab4424-2f25-4dc7-92ff-29bd000b0000", "generation_uid": "adab4424-2f25-4dc7-92ff-29bd000b0001", "company_name": "FFmpeg", "product_name": "OP1a Muxer", "product_version": "54.63.104", "product_uid": "adab4424-2f25-4dc7-92ff-29bd000b0002", "modification_date": "0-01-01 00:00:00", "timecode": "00:00:00:00" } } }

Do I need to set the container_format (ContainerDef) to something else? When I create/export a linked(media not embeded) AAF from avid, I see that the ContainerFormat is aaf.define.ContainerDef MXF as opposed to aaf.define.ContainerDef ContainerDef_AAFKLV that we manually set in the test/example.

PS: I have added other ode to the test_external_mob test to create a valid composition mob so I could import the AAF in avid.