Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only one clip added to track when they have the same duration #1796

Open
stephanedebove opened this issue Sep 11, 2024 · 7 comments
Open

Only one clip added to track when they have the same duration #1796

stephanedebove opened this issue Sep 11, 2024 · 7 comments

Comments

@stephanedebove
Copy link

Required:


[ x] I believe this isn't a duplicate topic
[ x] This report is not related to an adapter (I’m not sure, it might now be related to an adapter, but I had this problem in the previous OpenTimelineIO versions, before I was using the fcp_xml adapter)

Select One:

[x ] Incorrect Functionality or bug

Description

I’m using a python script to generate a timeline exported to an xml file. I think I’ve encountered a bug: when I add two clips of the same duration on the same track on my timeline, only one of them is added to my xml file. For instance, this timeline is exported correctly, with two distinct <clipitem> generated in the xml:

Timeline(
    "TimeLine1", 
    Stack(
        tracks, [
            otio.schema.Track(
                name='Video track 1', 
                children=[
                    otio.schema.Clip(
                        name='file.mp4', 
                        media_reference=otio.schema.ExternalReference(
                            target_url='C:\\file.mp4'
                        ), 
                        source_range=otio.opentime.TimeRange(
                            start_time=otio.opentime.RationalTime(value=0, rate=25), 
                            duration=otio.opentime.RationalTime(value=50, rate=25)
                        ), 
                        metadata={}
                    ), 
                    otio.schema.Clip(
                        name='file.mp4', 
                        media_reference=otio.schema.ExternalReference(
                            target_url='C:\\file.mp4'
                        ), 
                        source_range=otio.opentime.TimeRange(
                            start_time=otio.opentime.RationalTime(value=0, rate=25), 
                            duration=otio.opentime.RationalTime(value=75, rate=25)
                        ), 
                        metadata={}
                    )
                ], 
                source_range=None, 
                metadata={}
            )
        ], 
        None, 
        {}
    )
)

(notice both clips have a different duration)

But this timeline is NOT exported correctly, I get only one <clipitem> in my xml file (the behavior I’m expecting is two clips of the same duration following each other on video track 1. Both clips are made from the same file):

Timeline(
    "TimeLine1", 
    Stack(
        tracks, [
            otio.schema.Track(
                name='Video track 1', 
                children=[
                    otio.schema.Clip(
                        name='file.mp4', 
                        media_reference=otio.schema.ExternalReference(
                            target_url='C:\\file.mp4'
                        ), 
                        source_range=otio.opentime.TimeRange(
                            start_time=otio.opentime.RationalTime(value=0, rate=25), 
                            duration=otio.opentime.RationalTime(value=50, rate=25)
                        ), 
                        metadata={}
                    ), 
                    otio.schema.Clip(
                        name='file.mp4', 
                        media_reference=otio.schema.ExternalReference(
                            target_url='C:\\file.mp4'
                        ), 
                        source_range=otio.opentime.TimeRange(
                            start_time=otio.opentime.RationalTime(value=0, rate=25), 
                            duration=otio.opentime.RationalTime(value=50, rate=25)
                        ), 
                        metadata={}
                    )
                ], 
                source_range=None, 
                metadata={}
            )
        ], 
        None, 
        {}
    )
)

I simply export the timeline with

otio.adapters.write_to_file(timeline, file.xml)

Optional


Environment

Operating System: Windows
Python version if appropriate: 3.10.14
OpentimelineIO version: opentimelineio-0.17.0 (but I was having the same problem with 0.16)

@apetrynet
Copy link
Contributor

Hi, @stephanedebove

Could you please try to add available_range to your media references?
And since it's the same file I believe you can create a shared media reference for both of them.

@stephanedebove
Copy link
Author

Hi @apetrynet ,
thanks for the answer.
From what I see available_range is already there. It’s not showing when I do print(timeline) but I can see it in print(f"Available Range: {media_reference.available_range}"):

Available Range: TimeRange(RationalTime(0, 25), RationalTime(250, 25))

@apetrynet
Copy link
Contributor

Does the otio file itself display the two clips as expected in otioview or another app supporting otio natively?

@stephanedebove
Copy link
Author

Unfortunately I don’t have any other app supporting otio and I was not able to make otioview work, even following these instructions (otioview mytimeline.otio does not output anything, no error message, nothing): https://opentimelineio.readthedocs.io/en/latest/tutorials/quickstart.html#run-otioview

But it looks like when I export in .otio, the two clips are present (two clips of duration 75 each):

{
    "OTIO_SCHEMA": "Timeline.1",
    "metadata": {
        "fcp_xml": {
            "media": {
                "video": {
                    "format": {
                        "samplecharacteristics": {
                            "anamorphic": "FALSE",
                            "fielddominance": "none",
                            "height": "1080",
                            "pixelaspectratio": "square",
                            "rate": {
                                "ntsc": "TRUE",
                                "timebase": "25"
                            },
                            "width": "1920"
                        }
                    }
                }
            },
            "rate": {
                "ntsc": "TRUE",
                "timebase": "25"
            }
        }
    },
    "name": "TimeLine1",
    "global_start_time": null,
    "tracks": {
        "OTIO_SCHEMA": "Stack.1",
        "metadata": {},
        "name": "tracks",
        "source_range": null,
        "effects": [],
        "markers": [],
        "enabled": true,
        "children": [
            {
                "OTIO_SCHEMA": "Track.1",
                "metadata": {},
                "name": "Video track 1",
                "source_range": null,
                "effects": [],
                "markers": [],
                "enabled": true,
                "children": [
                    {
                        "OTIO_SCHEMA": "Clip.2",
                        "metadata": {},
                        "name": "file.mp4",
                        "source_range": {
                            "OTIO_SCHEMA": "TimeRange.1",
                            "duration": {
                                "OTIO_SCHEMA": "RationalTime.1",
                                "rate": 25.0,
                                "value": 75.0
                            },
                            "start_time": {
                                "OTIO_SCHEMA": "RationalTime.1",
                                "rate": 25.0,
                                "value": 0.0
                            }
                        },
                        "effects": [],
                        "markers": [],
                        "enabled": true,
                        "media_references": {
                            "DEFAULT_MEDIA": {
                                "OTIO_SCHEMA": "ExternalReference.1",
                                "metadata": {},
                                "name": "",
                                "available_range": {
                                    "OTIO_SCHEMA": "TimeRange.1",
                                    "duration": {
                                        "OTIO_SCHEMA": "RationalTime.1",
                                        "rate": 25.0,
                                        "value": 250.0
                                    },
                                    "start_time": {
                                        "OTIO_SCHEMA": "RationalTime.1",
                                        "rate": 25.0,
                                        "value": 0.0
                                    }
                                },
                                "available_image_bounds": null,
                                "target_url": "C:\\file.mp4"
                            }
                        },
                        "active_media_reference_key": "DEFAULT_MEDIA"
                    },
                    {
                        "OTIO_SCHEMA": "Clip.2",
                        "metadata": {},
                        "name": "file.mp4",
                        "source_range": {
                            "OTIO_SCHEMA": "TimeRange.1",
                            "duration": {
                                "OTIO_SCHEMA": "RationalTime.1",
                                "rate": 25.0,
                                "value": 75.0
                            },
                            "start_time": {
                                "OTIO_SCHEMA": "RationalTime.1",
                                "rate": 25.0,
                                "value": 0.0
                            }
                        },
                        "effects": [],
                        "markers": [],
                        "enabled": true,
                        "media_references": {
                            "DEFAULT_MEDIA": {
                                "OTIO_SCHEMA": "ExternalReference.1",
                                "metadata": {},
                                "name": "",
                                "available_range": {
                                    "OTIO_SCHEMA": "TimeRange.1",
                                    "duration": {
                                        "OTIO_SCHEMA": "RationalTime.1",
                                        "rate": 25.0,
                                        "value": 250.0
                                    },
                                    "start_time": {
                                        "OTIO_SCHEMA": "RationalTime.1",
                                        "rate": 25.0,
                                        "value": 0.0
                                    }
                                },
                                "available_image_bounds": null,
                                "target_url": "C:\\file.mp4"
                            }
                        },
                        "active_media_reference_key": "DEFAULT_MEDIA"
                    }
                ],
                "kind": "Video"
            }
        ]
    }
}

whereas when I export in xml, only one clip is added:

<xmeml version="4">
    <project>
        <name>TimeLine1</name>
        <children>
            <sequence id="sequence-1">
                <media>
                    <video>
                        <format>
                            <samplecharacteristics>
                                <anamorphic>FALSE</anamorphic>
                                <fielddominance>none</fielddominance>
                                <height>1080</height>
                                <pixelaspectratio>square</pixelaspectratio>
                                <rate>
                                    <ntsc>TRUE</ntsc>
                                    <timebase>25</timebase>
                                </rate>
                                <width>1920</width>
                            </samplecharacteristics>
                        </format>
                        <track>
                            <clipitem frameBlend="FALSE" id="clipitem-1">
                                <file id="file-1">
                                    <pathurl>C:\file.mp4</pathurl>
                                    <name>file.mp4</name>
                                    <rate>
                                        <timebase>25</timebase>
                                        <ntsc>FALSE</ntsc>
                                    </rate>
                                    <duration>250</duration>
                                    <timecode>
                                        <rate>
                                            <timebase>25</timebase>
                                            <ntsc>FALSE</ntsc>
                                        </rate>
                                        <string>00:00:00:00</string>
                                        <frame>0</frame>
                                        <displayformat>NDF</displayformat>
                                    </timecode>
                                    <media>
                                        <video />
                                        <audio />
                                    </media>
                                </file>
                                <name>file.mp4</name>
                                <rate>
                                    <timebase>25</timebase>
                                    <ntsc>FALSE</ntsc>
                                </rate>
                                <rate>
                                    <timebase>25</timebase>
                                    <ntsc>FALSE</ntsc>
                                </rate>
                                <duration>75</duration>
                                <start>0</start>
                                <end>75</end>
                                <in>0</in>
                                <out>75</out>
                            </clipitem>
                            <clipitem id="clipitem-1" />
                        </track>
                    </video>
                    <audio />
                </media>
                <name>TimeLine1</name>
                <duration>150</duration>
                <rate>
                    <timebase>25</timebase>
                    <ntsc>FALSE</ntsc>
                </rate>
            </sequence>
        </children>
    </project>
</xmeml>

so that would mean it’s an adapter problem? Should I move my bug report somewhere else?

@apetrynet
Copy link
Contributor

Yeah, sounds like we might be in adapter territory.
You can submit an issue here for the fcp adapter.

Just out of curiosity, what happens if you add a gap or another clip between the two "twin clips"?

@stephanedebove
Copy link
Author

Same thing: the twin clip appearing last on the track is not displayed.
Thanks I’ll post there.

@apetrynet
Copy link
Contributor

OK, thanks for checking.

Unless anyone else suspects this is an otio core thing I guess we can close this issue as you've opened one in the adapter repo?

I'll let the TSC make the call in the upcoming meeting.

Thanks for submitting @stephanedebove

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants