TheAcharya / MarkersExtractor

Extract Markers from Final Cut Pro FCPXML
MIT License
38 stars 2 forks source link

Support for Standalone Clips (When Project Not Present) #99

Closed samplue closed 6 months ago

samplue commented 6 months ago

One thing I'd love to see is drag-n-drop support for compound clips. We edit scenes and entires reels in compound clips instead of projects. Unfortunately MarkerData will throw out an error. Copy pasting the timeline into a project works fine, but I'd love to avoid this extra step.

IAmVigneswaran commented 6 months ago

@orchetect Right now we are using Project's FCPXML to perform extraction.

Are we able to support Compound Clip's FCPXML? User's can also utilise Compound Clip for extraction.

Compound-Clip
orchetect commented 6 months ago

Yeah that should be pretty straightforward.

IIRC, we're currently just taking the first project found in the FCPXML. Probably because that was the most common during our workflow and testing.

In later versions of the FCPXML format, it's possible to have a mixed variety of events, projects, and clips. For that reason I ensured the parser is already capable of finding them. It's just a matter of telling it what we want.

For MarkersExtractor, ideally it would autonomously determine its markers source based on what it finds in the FCPXML. I'd like to avoid having to require the user to tell it what the source is - and it may not be necessary any way for our needs.

I'm thinking the precedence for finding markers would be something like this:

  1. If a project is found in the FCPXML, use that project. If more than one project is found, use the first.
  2. Otherwise, check for a standalone clip. If more than one clip is found, use the first.
IAmVigneswaran commented 6 months ago

I'm thinking the precedence for finding markers would be something like this:

  1. If a project is found in the FCPXML, use that project. If more than one project is found, use the first.
  2. Otherwise, check for a standalone clip. If more than one clip is found, use the first.

We can try this approach.

Thank you.

orchetect commented 6 months ago

This is actually a lot more involved than it may have seemed.

  1. The notion of 'project' is pervasive in the source code and documentation, so I'm having to factor it out and replace it with the generic notion of a 'timeline'. That way a project or a clip or any conceivable timeline type can be used as the 'main timeline'. So it's involving code refactors but also changes to all the documentation to reflect that.

    For example:

    • projectTimecode naming mode will become timelineNameAndTimecode.
  2. Some ancillary good news is that it's also led to some refactors of the parser that will make handling timelines better.

Parser updates are done. It's now a matter of refactoring and updating MarkersExtractor to use the new 'timeline' nomenclature and paradigm.

IAmVigneswaran commented 6 months ago

I will also update Marker Data's documentation site respectively; from project to timeline.

orchetect commented 6 months ago

Yes, and really we are only really dealing with a single timeline regardless of what timeline it is. To the users, we blur this line by now inferring the timeline from a project or a standalone clip, etc.

orchetect commented 6 months ago

When FCPXML only contains a clip:

IAmVigneswaran commented 6 months ago

When FCPXML only contains a clip:

  • That means that our Event Name, Project Name and Library Name manifest fields will be empty, since Final Cut does not export that data to the XML file in that case.
orchetect commented 6 months ago

drag-n-drop support for compound clips

Are we able to support Compound Clip's FCPXML

Missed this question. Yes, dragging the clip directly from Final Cut Pro's browser will work. It creates intermediate FCPXML data containing just the clip. That's what I am using to unit test this as well.

orchetect commented 6 months ago

New alpha build for testing: https://github.com/TheAcharya/MarkersExtractor/releases/tag/0.3.7-alpha1

IAmVigneswaran commented 6 months ago

Thanks for the new alpha build. Will report back soon!

IAmVigneswaran commented 6 months ago

On initial test, I get.

No timelines (projects or clips) could be found in the FCPXML.
Error: Error extracting timeline context.

This is a Compound Clip with first level clips.

Marker Data Demo_V3 Clip CC.fcpxmld.zip

orchetect commented 6 months ago

Ah I think I figured it out.

For standalone clips, Final Cut exports the XML differently depending whether you:

  1. Select the clip in the browser then export XML via File → Export XML...

    This exports with this general structure:

    <fcpxml>
       <resources> ... </resources>
       <library ... >
           <event ... >
               <!-- single clip here, ie: ref-clip, sync-clip -->
           </event>
       </library>
    </fcpxml>
  2. Drag the clip from the browser and drop it outside of Final Cut (ie: as a text clipping on the desktop or an app that accepts FCPXML).

    This exports with this general structure:

    <fcpxml>
       <resources> ... </resources>
       <!-- single clip here, ie: ref-clip, sync-clip -->
    </fcpxml>
orchetect commented 6 months ago

Also note: If it's a clip, MarkersExtractor will now use the clip name (and not project name) to:

IAmVigneswaran commented 6 months ago

Noted!

orchetect commented 6 months ago

Ok, timeline parsing is more robust now, and from my initial testing, it should work as expected.

Try alpha2: https://github.com/TheAcharya/MarkersExtractor/releases/tag/0.3.7-alpha2

IAmVigneswaran commented 6 months ago

Just did a quick test! Seems to be working as expected! Thank you, Steffan!

We can safely release 0.3.7?