OpenTimelineIO icon indicating copy to clipboard operation
OpenTimelineIO copied to clipboard

FCP_XML adapter: for media start time timecode attribute, ignore if timecode rate not in prespecified known timecode list

Open pokey opened this issue 3 years ago • 3 comments

Feature Request

Modification to existing behaviour

Description

Currently, OpenTimelineIO throws an exception if the framerate of a video is not one a predefined set of allowed framerates: https://github.com/AcademySoftwareFoundation/OpenTimelineIO/blob/e2a8594a9a6b992ee1b7bb776b1281da8dbc090d/src/opentime/rationalTime.cpp#L42-L57 Unfortunately, QuickTime screen recording records videos at arbitrary framerates, depending on current system load.

I tried just removing the framerate check (https://github.com/pokey/OpenTimelineIO/commit/844d50b6ff00556be08c8675b1b5c64e609060d8), and everything seems to work fine.

Is there some reason that check needs to be there?

Context

N/A

pokey avatar Jul 11 '22 13:07 pokey

Those are the list of valid rates for timecode (e.g "01:00:00:12"). OTIO itself supports any rate. What was the context where you saw an exception?

jminor avatar Jul 11 '22 16:07 jminor

I called the function otio.adapters.read_from_file with the following xml. Notice the timecode of 44 in a couple of places:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xmeml>
<xmeml version="5">
    <sequence>
        <name>Timeline 1 (Resolve)</name>
        <duration>8008</duration>
        <rate>
            <timebase>30</timebase>
            <ntsc>FALSE</ntsc>
        </rate>
        <in>-1</in>
        <out>-1</out>
        <timecode>
            <string>01:00:00:00</string>
            <frame>108000</frame>
            <displayformat>NDF</displayformat>
            <rate>
                <timebase>30</timebase>
                <ntsc>FALSE</ntsc>
            </rate>
        </timecode>
        <media>
            <video>
                <track>
                    <clipitem id="Screen Recording 2022-07-08 at 11.15.03.mov 0">
                        <name>Screen Recording 2022-07-08 at 11.15.03.mov</name>
                        <duration>37686</duration>
                        <rate>
                            <timebase>30</timebase>
                            <ntsc>FALSE</ntsc>
                        </rate>
                        <start>0</start>
                        <end>2243</end>
                        <enabled>TRUE</enabled>
                        <in>210</in>
                        <out>2453</out>
                        <file id="Screen Recording 2022-07-08 at 11.15.03.mov 2">
                            <duration>55274</duration>
                            <rate>
                                <timebase>44</timebase>
                                <ntsc>FALSE</ntsc>
                            </rate>
                            <name>Screen Recording 2022-07-08 at 11.15.03.mov</name>
                            <pathurl>file:///Users/pokey/src/pokey_voice_coding_videos/data/raw/tutorial-part-i/clips/Screen%20Recording%202022-07-08%20at%2011.15.03.mov</pathurl>
                            <timecode>
                                <string>00:00:00:00</string>
                                <displayformat>NDF</displayformat>
                                <rate>
                                    <timebase>44</timebase>
                                    <ntsc>FALSE</ntsc>
                                </rate>
                            </timecode>
                            <media>
                                <video>
                                    <duration>55274</duration>
                                    <samplecharacteristics>
                                        <width>3072</width>
                                        <height>1920</height>
                                    </samplecharacteristics>
                                </video>
                                <audio>
                                    <channelcount>1</channelcount>
                                </audio>
                            </media>
                        </file>
                        <compositemode>normal</compositemode>
                        <filter>
                            <enabled>TRUE</enabled>
                            <start>0</start>
                            <end>37686</end>
                            <effect>
                                <name>Basic Motion</name>
                                <effectid>basic</effectid>
                                <effecttype>motion</effecttype>
                                <mediatype>video</mediatype>
                                <effectcategory>motion</effectcategory>
                                <parameter>
                                    <name>Scale</name>
                                    <parameterid>scale</parameterid>
                                    <value>100</value>
                                    <valuemin>0</valuemin>
                                    <valuemax>10000</valuemax>
                                </parameter>
                                <parameter>
                                    <name>Center</name>
                                    <parameterid>center</parameterid>
                                    <value>
                                        <horiz>0</horiz>
                                        <vert>0</vert>
                                    </value>
                                </parameter>
                                <parameter>
                                    <name>Rotation</name>
                                    <parameterid>rotation</parameterid>
                                    <value>0</value>
                                    <valuemin>-100000</valuemin>
                                    <valuemax>100000</valuemax>
                                </parameter>
                                <parameter>
                                    <name>Anchor Point</name>
                                    <parameterid>centerOffset</parameterid>
                                    <value>
                                        <horiz>0</horiz>
                                        <vert>0</vert>
                                    </value>
                                </parameter>
                            </effect>
                        </filter>
                        <filter>
                            <enabled>TRUE</enabled>
                            <start>0</start>
                            <end>37686</end>
                            <effect>
                                <name>Crop</name>
                                <effectid>crop</effectid>
                                <effecttype>motion</effecttype>
                                <mediatype>video</mediatype>
                                <effectcategory>motion</effectcategory>
                                <parameter>
                                    <name>left</name>
                                    <parameterid>left</parameterid>
                                    <value>0</value>
                                    <valuemin>0</valuemin>
                                    <valuemax>100</valuemax>
                                </parameter>
                                <parameter>
                                    <name>right</name>
                                    <parameterid>right</parameterid>
                                    <value>0</value>
                                    <valuemin>0</valuemin>
                                    <valuemax>100</valuemax>
                                </parameter>
                                <parameter>
                                    <name>top</name>
                                    <parameterid>top</parameterid>
                                    <value>0</value>
                                    <valuemin>0</valuemin>
                                    <valuemax>100</valuemax>
                                </parameter>
                                <parameter>
                                    <name>bottom</name>
                                    <parameterid>bottom</parameterid>
                                    <value>0</value>
                                    <valuemin>0</valuemin>
                                    <valuemax>100</valuemax>
                                </parameter>
                            </effect>
                        </filter>
                        <filter>
                            <enabled>TRUE</enabled>
                            <start>0</start>
                            <end>37686</end>
                            <effect>
                                <name>Opacity</name>
                                <effectid>opacity</effectid>
                                <effecttype>motion</effecttype>
                                <mediatype>video</mediatype>
                                <effectcategory>motion</effectcategory>
                                <parameter>
                                    <name>opacity</name>
                                    <parameterid>opacity</parameterid>
                                    <value>100</value>
                                    <valuemin>0</valuemin>
                                    <valuemax>100</valuemax>
                                </parameter>
                            </effect>
                        </filter>
                        <link>
                            <linkclipref>Screen Recording 2022-07-08 at 11.15.03.mov 0</linkclipref>
                        </link>
                        <link>
                            <linkclipref>Screen Recording 2022-07-08 at 11.15.03.mov 29</linkclipref>
                        </link>
                        <comments/>
                    </clipitem>
                    <enabled>TRUE</enabled>
                    <locked>FALSE</locked>
                </track>
                <format>
                    <samplecharacteristics>
                        <width>3072</width>
                        <height>1920</height>
                        <pixelaspectratio>square</pixelaspectratio>
                        <rate>
                            <timebase>30</timebase>
                            <ntsc>FALSE</ntsc>
                        </rate>
                        <codec>
                            <appspecificdata>
                                <appname>Final Cut Pro</appname>
                                <appmanufacturer>Apple Inc.</appmanufacturer>
                                <data>
                                    <qtcodec/>
                                </data>
                            </appspecificdata>
                        </codec>
                    </samplecharacteristics>
                </format>
            </video>
            <audio>
                <track>
                    <clipitem id="Screen Recording 2022-07-08 at 11.15.03.mov 29">
                        <name>Screen Recording 2022-07-08 at 11.15.03.mov</name>
                        <duration>37686</duration>
                        <rate>
                            <timebase>30</timebase>
                            <ntsc>FALSE</ntsc>
                        </rate>
                        <start>0</start>
                        <end>2243</end>
                        <enabled>TRUE</enabled>
                        <in>210</in>
                        <out>2453</out>
                        <file id="Screen Recording 2022-07-08 at 11.15.03.mov 2"/>
                        <sourcetrack>
                            <mediatype>audio</mediatype>
                            <trackindex>1</trackindex>
                        </sourcetrack>
                        <link>
                            <linkclipref>Screen Recording 2022-07-08 at 11.15.03.mov 0</linkclipref>
                        </link>
                        <link>
                            <linkclipref>Screen Recording 2022-07-08 at 11.15.03.mov 29</linkclipref>
                        </link>
                        <comments/>
                    </clipitem>
                </track>
            </audio>
        </media>
    </sequence>
</xmeml>

pokey avatar Jul 11 '22 20:07 pokey

@pokey Which piece of software generated this XML? As @jminor said, SMPTE timecode can only be specific rates so it appears whatever is generating this is doing something invalid. To make files like this work properly, we could ignore the invalid timecode element and instead use None for the MediaReference available_range.

reinecke avatar Jul 21 '22 17:07 reinecke