Git Product home page Git Product logo

otio-fcp-adapter's Issues

otioconvert via 0.16.0.dev1 (from master) throws timecode error converting OTIO to fcp7 xml.

hi friends.

using this OTIO file : Ava.otio.zip

with the built in adaptor from 0.16.0.dev1 I get the following error:

otioconvert -i /private/var/folders/ln/0p1sqrvj1nz5k0lr1y78_b7m0000gn/T/Ava.otio -o ~/Ava.xml 
Traceback (most recent call last):
  File "/Users/vade/miniconda3/envs/otio/bin/otioconvert", line 8, in <module>
    sys.exit(main())
  File "/Users/vade/miniconda3/envs/otio/lib/python3.10/site-packages/opentimelineio/console/otioconvert.py", line 278, in main
    otio.adapters.write_to_file(
  File "/Users/vade/miniconda3/envs/otio/lib/python3.10/site-packages/opentimelineio/adapters/__init__.py", line 192, in write_to_file
    return adapter.write_to_file(
  File "/Users/vade/miniconda3/envs/otio/lib/python3.10/site-packages/opentimelineio/adapters/adapter.py", line 183, in write_to_file
    result = self.write_to_string(input_otio, **adapter_argument_map)
  File "/Users/vade/miniconda3/envs/otio/lib/python3.10/site-packages/opentimelineio/adapters/adapter.py", line 274, in write_to_string
    return self._execute_function(
  File "/Users/vade/miniconda3/envs/otio/lib/python3.10/site-packages/opentimelineio/plugins/python_plugin.py", line 142, in _execute_function
    return (getattr(self.module(), func_name)(**kwargs))
  File "/Users/vade/miniconda3/envs/otio/lib/python3.10/site-packages/otio_fcp_adapter/fcp_xml.py", line 2003, in write_to_string
    _build_sequence_for_timeline(
  File "/Users/vade/miniconda3/envs/otio/lib/python3.10/site-packages/otio_fcp_adapter/fcp_xml.py", line 1258, in wrapper
    elem = func(item, *args, **kwargs)
  File "/Users/vade/miniconda3/envs/otio/lib/python3.10/site-packages/otio_fcp_adapter/fcp_xml.py", line 1883, in _build_sequence_for_timeline
    _add_stack_elements_to_sequence(
  File "/Users/vade/miniconda3/envs/otio/lib/python3.10/site-packages/otio_fcp_adapter/fcp_xml.py", line 1941, in _add_stack_elements_to_sequence
    track_elements = _build_top_level_track(track, track_rate, br_map)
  File "/Users/vade/miniconda3/envs/otio/lib/python3.10/site-packages/otio_fcp_adapter/fcp_xml.py", line 1819, in _build_top_level_track
    _build_item(item, timeline_range, transition_offsets, br_map)
  File "/Users/vade/miniconda3/envs/otio/lib/python3.10/site-packages/otio_fcp_adapter/fcp_xml.py", line 1773, in _build_item
    return _build_clip_item(
  File "/Users/vade/miniconda3/envs/otio/lib/python3.10/site-packages/otio_fcp_adapter/fcp_xml.py", line 1258, in wrapper
    elem = func(item, *args, **kwargs)
  File "/Users/vade/miniconda3/envs/otio/lib/python3.10/site-packages/otio_fcp_adapter/fcp_xml.py", line 1645, in _build_clip_item
    clip_item_e.append(_build_file(clip_item.media_reference, br_map))
  File "/Users/vade/miniconda3/envs/otio/lib/python3.10/site-packages/otio_fcp_adapter/fcp_xml.py", line 1258, in wrapper
    elem = func(item, *args, **kwargs)
  File "/Users/vade/miniconda3/envs/otio/lib/python3.10/site-packages/otio_fcp_adapter/fcp_xml.py", line 1492, in _build_file
    tc_element = _build_timecode_from_metadata(
  File "/Users/vade/miniconda3/envs/otio/lib/python3.10/site-packages/otio_fcp_adapter/fcp_xml.py", line 1871, in _build_timecode_from_metadata
    return _build_timecode(
  File "/Users/vade/miniconda3/envs/otio/lib/python3.10/site-packages/otio_fcp_adapter/fcp_xml.py", line 1346, in _build_timecode
    tc_string = opentime.to_timecode(tc_time, tc_fps, drop_frame)
  File "/Users/vade/miniconda3/envs/otio/lib/python3.10/site-packages/opentimelineio/opentime.py", line 46, in to_timecode
    else rt.to_timecode(rate, drop_frame)
ValueError: invalid timecode rate

Some notes

My OTIO file comes from my very WIP AVFoundation-OTIO bridge. To build the RationalTime im using CMTime rational numerator and denominator values almost directly.

@reinecke in Slack mentions:

ll need to peek at the use case. CMTime -> RationalTime is a bit tricky because there is a bit of an implication that RationalTime.rate is the media frame rate and often is some non-integer value. CMTime is fps-ignorant and takes rates like 24000/1001 and multiplies them up into the numerator.

In all the usual time math, this works fine with OTIO - it’s just an issue when you have to quantize to frame counts (in the to_timecode or to_frames methods).

Both those methods provide rate args to handle this, but, unfortunately, there really isn’t a way to get that context down to the adapter without curating the rate fields on your RationalTime

Aside from all that, I think there is a way for the adapter to handle this more gracefully - like not trying to set the start timecode value on the file element when it doesn’t know how to convert a MediaReference.available_source_range into timecode.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.