TheAcharya / MarkersExtractor

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

Add clip metadata manifest fields #39

Closed IAmVigneswaran closed 5 months ago

IAmVigneswaran commented 1 year ago

@samplue Sam Pluemacher suggest -

The CSV includes the clip name, but I would love to see the "Reel" information as well. For me the Reel information is even more important than the clip name.

@orchetect Can we add "Reel" "Scene" & "Take" columns as well? This enhancement links and circles back to #36 & #7

We would now have Clip Name, Clip Source Filename, Reel, Scene & Take columns.

Clip Name = It would be name of Multicam, Synchronize clips or Compound within FCP.

I believe it can get rather complex when we have Multicam, Synchronize clips or Compound. If a marker is placed on a Multicam clip, we can print the name of the Multicam clip for the Clip Name column and extract the metadata of that Multicam clip for Reel, Scene & Take information associate with these type of special clips.

Maybe there is some logic where if clips are Multicam, Synchronize clips or Compound types, Clip Source Filename columns would be empty or print it as Skipped or Not Parsed? With Multicam, Synchronize clips or Compound types, there can be umpteen number of source clips nested deep in these types. It may not make sense to print Source Filenames for Multicam, Synchronize clips or Compound types.

samplue commented 1 year ago

An option to include Start Source Timecode and End Source Timecode as well as Media Duration for the clips would be a nice & welcome addition.

orchetect commented 10 months ago

Clip In and Clip Out Timecode as well as Clip Type should be easy to do.

However I ran into a funny issue when investigating the clip and camera metadata.

Final Cut Pro only seems to export this data for clips that use actual video assets. It doesn't export it for things like Titles or Clouds generator (even though it allows you to enter text for its Reel, Scene, Take, Camera Angle, and Camera Name).

I suppose that doesn't matter that much since users probably only care about this metadata for actual video clips any how.

IAmVigneswaran commented 10 months ago

I suppose that doesn't matter that much since users probably only care about this metadata for actual video clips any how.

Yes. It should not matter for those Titles. Motion Templates and Generators. Those fields can be empty in our csv file for these assets/Clip Type.

orchetect commented 10 months ago

I just realized that for the same reason why we should remove Clip Filename (#65) from the output manifest, Media Duration is not a viable field. As you mention in the original post of this thread, sync clips, compound clips, and multicam clips can contain more than one clip of different lengths and reference more than one media file. In those cases it would be ambiguous what data should populate the field and may end up being half-useful at best and confusing at worst.

Clip Duration is viable however, and is already a part of the output manifest.

IAmVigneswaran commented 10 months ago

Noted!

IAmVigneswaran commented 8 months ago

Hopefully in subsequent build, we can add, Reel, Scene, Take, Clip In and Clip Out fields.

update-output-manifest
orchetect commented 5 months ago

Just to be clear, for our purposes, Clip In and Clip Out timecodes will be absolute timecodes (based on main project timeline) and not the local media's timeline.

IAmVigneswaran commented 5 months ago

Just to be clear, for our purposes, Clip In and Clip Out timecodes will be absolute timecodes (based on main project timeline) and not the local media's timeline.

I believe that is what the users might be expecting. Clip In and Clip Out values based on the range used from the main project timeline.

orchetect commented 5 months ago

Yes, but I only mention it because within Final Cut Pro's clip inspector, clip start and end timecodes are shown in relation to the its own media's timeline, as it can have its own arbitrary start timecode and frame rate even. It of course makes more sense for us to use the main (absolute) timeline context.

IAmVigneswaran commented 5 months ago

To bring awareness to the user, I can add a small column info (i) to both Clip In and Clip Out.

Notion - Clip In
orchetect commented 5 months ago

Probably not necessary, since absolute timecode is intuitively obvious in our case. But you could add something to the wiki docs for MarkersExtractor and Marker Data that clarifies this if you want.

orchetect commented 5 months ago

It took most of today to build out the metadata parser but it's mostly done. With any luck, populating the fields should be fairly straightforward. I'll try to get it implemented in the next day or so.

IAmVigneswaran commented 5 months ago

Thank you! 🙏

orchetect commented 5 months ago

Side note: when new fields are implemented, they automatically become available as thumbnail image --label burn-in options.

orchetect commented 5 months ago

Ok - now implemented, and seems to be working as expected in my limited testing. Will be in 0.3.6.

FCP project:

timeline inspector

Manifest output:

manifest
orchetect commented 5 months ago

@IAmVigneswaran new alpha build for testing:

https://github.com/TheAcharya/MarkersExtractor/releases/tag/0.3.6-alpha3

IAmVigneswaran commented 5 months ago

Thanks for the test build!

Just tested using Sam's sample project; seems to extract all the desired metadata.

@samplue do test it out at your end with any of your more complex projects. Thanks.

samplue commented 5 months ago

Thanks a lot, it's working on one of the more complex timelines! What I've noticed though, is that it will not extract the Reel information for Multicam clips. That would be important for me. It should read the active MC angle data and not the MC container information. Here's the .csv and fcpxml for further inspection.

Generally speaking: it should always use the source media clip timecode and not the container timecodes. Or at least make this optional.

BRS_LOCKED6_20210521 - 01 Opening Scene.csv BRS_LOCKED6_20210521 - 01 Opening Scene_00000000.fcpxmld.zip

IAmVigneswaran commented 5 months ago

@orchetect Would it be possible or does it makes sense to have --use-active-multicam-metadata?

When enabled, it would use the metadata from Multicam's active angle.

orchetect commented 5 months ago

It makes more sense just to use angle metadata as default behavior. Grabbing metadata from the multicam container wasn't intentional, it's just the first round of naive parsing that needs to be improved.

There may be other clip types that need tweaks, I only tested basic clips. Especially check ref-clips, sync-clips and audition clips as well.

orchetect commented 5 months ago

I believe the best approach is to first grab the angle's media metadata, then grab the angle's metadata and overlay it on the container's, replacing the container's keys with the angle's metadata if there are any duplicate keys. From my observations, it's rare (if not impossible) to have the same metadata key in both places, but I would take this approach in any event.

In the XML, the angle tends to contain the reel, scene, and shot (take):

<mc-angle name="A" angleID="+L5xmXXnRXOGdjFq1Eo7EQ">
    <gap name="Gap" offset="0s" start="86400314/24000s" duration="90090/24000s"/>
    <asset-clip ref="r3" offset="90090/24000s" name="Cam 1" duration="5801796/24000s" tcFormat="NDF" audioRole="dialogue">
        <adjust-colorConform enabled="1" autoOrManual="manual" conformType="conformNone" peakNitsOfPQSource="1000" peakNitsOfSDRToPQSource="203"/>
        <marker start="233233/8000s" duration="1001/24000s" value="Marker in Multicam Clip on Angle A"/>
        <metadata>
            <md key="com.apple.proapps.studio.reel" value="Cam 1 Reel"/>
            <md key="com.apple.proapps.studio.scene" value="Cam 1 Scene"/>
            <md key="com.apple.proapps.studio.shot" value="Cam 1 Take"/>
            <md key="com.apple.proapps.studio.angle" value="A"/>
        </metadata>
    </asset-clip>
</mc-angle>

The angle's media tends to contain the camera information like cameraName, cameraISO, etc.:

<asset id="r3" name="Cam 1" uid="1EA25267F6D3D42BB06493C883B080F2" start="0s" duration="21756735/90000s" hasVideo="1" format="r1" hasAudio="1" videoSources="1" audioSources="1" audioChannels="2" audioRate="48000">
    <media-rep kind="original-media" sig="1EA25267F6D3D42BB06493C883B080F2" src="file:///Users/user/Movies/Cam%201.mp4"/>
    <metadata>
        <md key="com.apple.proapps.mio.cameraName" value="Cam 1 Camera Name"/>
        <md key="com.apple.proapps.studio.rawToLogConversion" value="0"/>
        <md key="com.apple.proapps.studio.cameraISO" value="0"/>
        <md key="com.apple.proapps.studio.cameraColorTemperature" value="0"/>
        <md key="com.apple.proapps.mio.ingestDate" value="2022-09-13 17:57:22 -0700"/>
    </metadata>
</asset>
IAmVigneswaran commented 5 months ago

We don't need the camera information like cameraName, cameraISO. Those seems a little excessive and not entirely pertains to editorial.

orchetect commented 5 months ago

I'm not adding them, this is for my own reference.

The parser is gathering all known metadata and filtering out the ones it needs.

orchetect commented 5 months ago

Ok multicam metadata is now fixed. Will be in next build.

Still need to test other complex clip types which I think will also require special handling.

orchetect commented 5 months ago

Generally speaking: it should always use the source media clip timecode and not the container timecodes. Or at least make this optional.

@samplue do you mind clarifying this?

orchetect commented 5 months ago

New alpha for testing:

https://github.com/TheAcharya/MarkersExtractor/releases/tag/0.3.6-alpha5

samplue commented 5 months ago

Generally speaking: it should always use the source media clip timecode and not the container timecodes. Or at least make this optional.

@samplue do you mind clarifying this?

Please ignore that comment, I was mixing this up with something else.

Regarding alpha5, happy to confirm this will now correctly pull the Reel, Scene, etc metadata for Multicam clips on my complex test timeline.

IAmVigneswaran commented 5 months ago

I think we can safely release 0.3.6.