AcademySoftwareFoundation / OpenTimelineIO

Open Source API and interchange format for editorial timeline information.
http://opentimeline.io
Apache License 2.0
1.46k stars 289 forks source link

Support for Image Sequence Reference in the FCPX adapter #1103

Open apetrynet opened 3 years ago

apetrynet commented 3 years ago

Feature Request

Like with issue #1092, it would be great if the Final Cut Pro X adapter supported ImageSequenceReference's

Description

As with FCP 7 XML, some research must be done on support for image sequences in the FCP-X XML format The videoSources attribute of an asset might be a good place to start experimenting(?)

Context

We should add support for all media reference types in OTIO adapters where possible. So far the ImageSequenceReference is implemented in the RV, cmx3600 and xges adapters.

KarthikRIyer commented 2 years ago

I was looking at this. It seems the videoSources attribute is just for psd files with multiple layers.

I tried importing an image sequence and them exporting an xml.

Simply exporting multiple images on the timeline does something like this:

<format id="r1" name="FFVideoFormat1080p2398" frameDuration="1001/24000s" width="1920" height="1080" colorSpace="1-1-1 (Rec. 709)"/>
<resources>
<asset id="r2" name="ezgif-frame-001" uid="9B893515C9378A42AD04C7EC7A3B3389" start="0s" duration="0s" hasVideo="1" format="r3">
            <media-rep kind="original-media" sig="9B893515C9378A42AD04C7EC7A3B3389" src="file:///Users/karthik/Movies/Untitled.fcpbundle/3-08-21/Original%20Media/ezgif-frame-001.jpg">
            </media-rep>
        </asset>
<asset id="r3" name="ezgif-frame-002" uid="9B893515C9378A42AD04C7EC7A3B3389" start="0s" duration="0s" hasVideo="1" format="r3">
            <media-rep kind="original-media" sig="9B893515C9378A42AD04C7EC7A3B3389" src="file:///Users/karthik/Movies/Untitled.fcpbundle/3-08-21/Original%20Media/ezgif-frame-002.jpg">
            </media-rep>
        </asset>
</resources>

<library location="file:///Users/karthik/Movies/Untitled.fcpbundle/">
        <event name="3-08-21" uid="5EC70E65-7820-4C4B-AECC-4F88BE4F02D6">
            <project name="Untitled Project" uid="1AC7F529-FF2C-4CED-9DA0-90AB84901094" modDate="2021-11-28 11:50:11 +0530">
                <sequence duration="5005/24000s" format="r1" tcStart="0s" tcFormat="NDF" audioLayout="stereo" audioRate="48k">
                    <spine>
                        <video name="ezgif-frame-001" offset="0s" ref="r2" duration="1001/24000s" start="86399313/24000s"/>
                        <video name="ezgif-frame-002" offset="1001/24000s" ref="r4" duration="1001/24000s" start="86399313/24000s"/>
                    </spine>
                </sequence>
            </project>
        </event>
    </library>

Making a compund clip from the images does something like this:

<format id="r1" name="FFVideoFormat1080p2398" frameDuration="1001/24000s" width="1920" height="1080" colorSpace="1-1-1 (Rec. 709)"/>
<resources>
<media id="r4" name="clip" uid="I+qhm7MlSIum5QTlk6ovjw" modDate="2021-11-28 11:51:33 +0530">
            <sequence duration="5005/24000s" format="r5" tcStart="0s" tcFormat="NDF" audioLayout="stereo" audioRate="48k">
                <spine>
                    <video name="ezgif-frame-001" offset="0s" ref="r2" duration="1001/24000s" start="86399313/24000s"/>
                    <video name="ezgif-frame-002" offset="1001/24000s" ref="r3" duration="1001/24000s" start="86399313/24000s"/>
                </spine>
            </sequence>
        </media>

<asset id="r2" name="ezgif-frame-001" uid="9B893515C9378A42AD04C7EC7A3B3389" start="0s" duration="0s" hasVideo="1" format="r3">
            <media-rep kind="original-media" sig="9B893515C9378A42AD04C7EC7A3B3389" src="file:///Users/karthik/Movies/Untitled.fcpbundle/3-08-21/Original%20Media/ezgif-frame-001.jpg">
            </media-rep>
        </asset>
<asset id="r3" name="ezgif-frame-002" uid="9B893515C9378A42AD04C7EC7A3B3389" start="0s" duration="0s" hasVideo="1" format="r3">
            <media-rep kind="original-media" sig="9B893515C9378A42AD04C7EC7A3B3389" src="file:///Users/karthik/Movies/Untitled.fcpbundle/3-08-21/Original%20Media/ezgif-frame-002.jpg">
            </media-rep>
        </asset>
</resources>

<library location="file:///Users/karthik/Movies/Untitled.fcpbundle/">
        <event name="3-08-21" uid="5EC70E65-7820-4C4B-AECC-4F88BE4F02D6">
            <project name="Untitled Project" uid="1AC7F529-FF2C-4CED-9DA0-90AB84901094" modDate="2021-11-28 11:51:33 +0530">
                <sequence duration="5005/24000s" format="r1" tcStart="0s" tcFormat="NDF" audioLayout="stereo" audioRate="48k">
                    <spine>
                        <ref-clip name="clip" offset="0s" ref="r4" duration="5005/24000s"/>
                    </spine>
                </sequence>
            </project>
        </event>
    </library>

There doesn't seem to be a specific image sequence tag. I'm not sure how we can distinguish an image sequence from a normal compound clip while parsing the xml.

I also tried exporting an image sequence from Resolve. It did something like this:

<resources>
        <format height="1080" name="FFVideoFormat1080p25" id="r0" frameDuration="1/25s" width="1920"/>
        <format height="360" name="FFVideoFormatRateUndefined" id="r1" frameDuration="1/25s" width="640"/>
        <asset name="ezgif-frame-[001-100].jpg" id="r2" duration="4/1s" start="0/1s" hasVideo="1" format="r1">
            <media-rep kind="original-media" src="file://Users/karthik/Downloads/walk/ezgif-frame-[001-100].jpg"/>
        </asset>
    </resources>
    <library>
        <event name="ezgif-frame-001 (Resolve)">
            <project name="ezgif-frame-001 (Resolve)">
                <sequence tcFormat="NDF" tcStart="0/1s" duration="4/1s" format="r0">
                    <spine>
                        <asset-clip ref="r2" tcFormat="NDF" name="ezgif-frame-001.jpg" duration="4/1s" start="0/1s" offset="0/1s" format="r1" enabled="1">
                            <adjust-transform scale="1 1" anchor="0 0" position="0 0"/>
                            <metadata>
                                <md key="com.apple.proapps.studio.reel" value="Importezgif-frame-001.jpg"/>
                            </metadata>
                        </asset-clip>
                    </spine>
                </sequence>
            </project>
        </event>
    </library>

But this doesn't work when importing the file in FCPX It doesn't detect it as an image sequence, and instead unsuccessfully, tries to find the file ezgif-frame-[001-100].jpg.

KarthikRIyer commented 2 years ago

What if we checked the extension of src files, and if it's an image, interpret it as an image sequence. We could check for formats supported by oiio, maybe?

apetrynet commented 2 years ago

Disclaimer.. I don't know much about fcpx an I haven't used fcp in a while.

How did you import the image sequence? Just dragging them in might not register as a sequence, but individual files like you mention. I seem to recall there being a checkbox in the import dialog toggling if images should be treated as a sequence or not. (Or was that premier?)

KarthikRIyer commented 2 years ago

Yes, I dragged in the images. I haven't used fcp before. Just premiere. I googled about importing image sequences in fcp, all sources talk about just dragging them in and setting the duration if each image = 1 frame.

Yes, the checkbox for image sequence is in premiere.