OpenTimelineIO icon indicating copy to clipboard operation
OpenTimelineIO copied to clipboard

Fixed reading of XML files exported from Hiero or NS

Open Eiken opened this issue 5 years ago • 17 comments

  • Previously only the first occurrence of a file with an id was properly added.

Eiken avatar Apr 30 '20 09:04 Eiken

We had issues reading XML files from Hiero and NS. Where clips magically disappeared. The issue boiled down to that otio was disregarding file elements with the same id.

This patch solves the problem but not being super familiar with XML or the code base I am not sure if it is solved in the correct way. Getting Foundry to fix their XML export seems like an impossible task so adding a workaround to otio seemed like the way to go.

Eiken avatar Apr 30 '20 09:04 Eiken

Hi @Eiken, thanks for the submission!

It looks like this update may have broken the unittests for this adapter, we'd need that resolved before merging. Also, do you happen to have a sample file you could provide that exhibits the issue? It would be great if we could add a test to make sure this doesn't happen.

The FCP XML spec talks about how to properly handle id attribute. If I'm reading what you're saying correctly, it sounds like the adapter may not be properly doing a lookup for a given id when it's reused - but I'd love to get an example EDL to validate.

Let me know if you can provide something, I'd love to help get this fixed!

reinecke avatar Apr 30 '20 18:04 reinecke

Yeah I saw the tests failing as well. Will dig them up and see if I can resolve them and make a small example file of the output.

Eiken avatar May 06 '20 09:05 Eiken

Example file. Renamed from xml to txt because github dont accept xml foobar.txt

Steps to reproduce:

  • Open blank project
  • Import random clip
  • Put in sequence
  • Split in two with slice
  • Export as xml

Result:

  • id for file in both clips are the same
  • Reading with the fcp_xml adapter disregards one of the clips

Eiken avatar May 06 '20 10:05 Eiken

@Eiken Thanks for providing the example file and the steps you used in Hiero, that kind of context is super helpful. I'll try and take a peek in the next day or two, I suspect it should be a pretty straightforward fix.

reinecke avatar May 06 '20 23:05 reinecke

@reinecke did you end up reproducing this?

jhodges10 avatar Jun 10 '20 04:06 jhodges10

@Eiken @jhodges10 Sorry for the delay in pulling this up. I loaded foobar.txt from above (renamed to foobar.xml in otioview and compared to what I see when I import to Premiere Pro (version 14.2 in this case).

See here: image

I'm sure I'm missing something here.

reinecke avatar Jun 10 '20 18:06 reinecke

@reinecke I'll check again tomorrow but what I was getting was just the clip before the cut. The other was thrown away by both otiocat and otioview

Eiken avatar Jun 14 '20 16:06 Eiken

Now I cant reproduce it anymore either. Must have been some glitch in the matrix or a venv with some old version. Closing the PR

Eiken avatar Jun 20 '20 08:06 Eiken

Thanks for following up!

reinecke avatar Jun 22 '20 22:06 reinecke

So this caused an issue again and I can reproduce it. If applying my fix it reads it correctly

Will try and write up more detailed reproduction steps soon

Eiken avatar Dec 15 '20 14:12 Eiken

The problem seems to stem from how Hiero/NS decides on the id for files. If you have a track in Hiero/NS that looks like attached picture then it will write out a xml with the same id for all files:

<file id="Juliet">

This causes all clips having mediareferences to file with id= "Juliet" to all have the same media_ref instead of unique.

media_ref = c.media_reference

media_ref will be the same for both clips from picture even tho they actually reference different files. Screenshot from 2020-12-16 13-10-19

Eiken avatar Dec 16 '20 12:12 Eiken

Got some days off next week so I'll check on getting the CI to complete successfully then and rebase on current main branch

Eiken avatar Dec 16 '20 12:12 Eiken

Dealing with out-of-spec files is always tricky. I'd love for the Foundry to address this case, but it would still be hard to address all the out-of-spec files floating around. Hopefully the solution I pitched may be helpful.

I'll throw an email to the foundry and see if they have any plans to follow the xml standard. If they are we can probably live with just having our hacky patch applied for a while until they do.

Eiken avatar Dec 16 '20 20:12 Eiken

I'll throw an email to the foundry and see if they have any plans to follow the xml standard. If they are we can probably live with just having our hacky patch applied for a while until they do.

Even better, maybe they could adopt writing OTIO directly and we can be one step closer to deprecating the entire FCP XML adapter, pragmatic patch and all! 😉

reinecke avatar Dec 16 '20 21:12 reinecke

I'll throw an email to the foundry and see if they have any plans to follow the xml standard. If they are we can probably live with just having our hacky patch applied for a while until they do.

Even better, maybe they could adopt writing OTIO directly and we can be one step closer to deprecating the entire FCP XML adapter, pragmatic patch and all!

I will for sure check the status on that as well. When I checked with em like a year ago it sounded like they where waiting for the C++ version but that is available now so they can't have that as an excuse anymore.

Eiken avatar Dec 16 '20 21:12 Eiken

@Eiken does the new OTIO integration in Nuke 13 mean that this PR is no longer needed? https://www.youtube.com/watch?v=autieMqcgSU

jminor avatar May 02 '22 23:05 jminor

Heiro and Nuke Studio both now have native OTIO support. I'm assuming that avoids this issue entirely, so I'm closing this PR. Feel free to re-open if this is still relevant.

jminor avatar Sep 12 '22 17:09 jminor