Bug 445214 - OpenTimelinIO Export/Import Fails: OTIO kdenlive/mlt adapter is out of date?
Summary: OpenTimelinIO Export/Import Fails: OTIO kdenlive/mlt adapter is out of date?
Status: RESOLVED DUPLICATE of bug 426942
Alias: None
Product: kdenlive
Classification: Applications
Component: Rendering & Export (show other bugs)
Version: 21.08.2
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Jean-Baptiste Mardelle
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-09 16:46 UTC by david.johannaber
Modified: 2022-01-16 18:24 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:
fritzibaby: Brainstorm+


Attachments
error dialog (72.91 KB, image/png)
2021-11-09 16:46 UTC, david.johannaber
Details

Note You need to log in before you can comment on or make changes to this bug.
Description david.johannaber 2021-11-09 16:46:41 UTC
Created attachment 143376 [details]
error dialog

SUMMARY
Based on the output from kdenlive OpenTimelineIO export dialog, and the referenced line in the adpaters.py file, it appears the support for kdenlive in OTIO is out of date. Is this the right place to raise this issue?


STEPS TO REPRODUCE
1. Set up a project; import footage
2. Assemble footage in timeline
3. Select File > OpenTimelinIO Export

OBSERVED RESULT
Project conversion failed:
Traceback (most recent call last):
  File "/usr/bin/otioconvert", line 33, in <module>
    sys.exit(load_entry_point('OpenTimelineIO==0.13.0', 'console_scripts', 'otioconvert')())
  File "/usr/lib/python3.9/site-packages/opentimelineio/console/otioconvert.py", line 226, in main
    result_tl = otio.adapters.read_from_file(
  File "/usr/lib/python3.9/site-packages/opentimelineio/adapters/__init__.py", line 140, in read_from_file
    return adapter.read_from_file(
  File "/usr/lib/python3.9/site-packages/opentimelineio/adapters/adapter.py", line 131, in read_from_file
    result = self._execute_function(
  File "/usr/lib/python3.9/site-packages/opentimelineio/plugins/python_plugin.py", line 174, in _execute_function
    return (getattr(self.module(), func_name)(**kwargs))
  File "/usr/lib/python3.9/site-packages/opentimelineio_contrib/adapters/kdenlive.py", line 76, in read_from_string
    for maintrack in maintractor.findall('track'):
AttributeError: 'NoneType' object has no attribute 'findall'


EXPECTED RESULT
fcpxml compatible xml file

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 21.08.2
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
The OTIO adapter script talks about a "global_feed" tractor which does not appear in the kdenlive xml file.

def read_from_string(input_str):
    """Read a Kdenlive project (MLT XML)
    Kdenlive uses a given MLT project layout, similar to Shotcut,
    combining a "main_bin" playlist to organize source media,
    and a "global_feed" tractor for timeline.
    (in Kdenlive 19.x, timeline tracks include virtual sub-track, unused for now)"""
    mlt, byid = ET.XMLID(input_str)
    profile = mlt.find('profile')
    rate = (float(profile.get('frame_rate_num'))
            / float(profile.get('frame_rate_den', 1)))
    timeline = otio.schema.Timeline(
        name=mlt.get('name', 'Kdenlive imported timeline'))

    maintractor = mlt.find("tractor[@global_feed='1']")
    for maintrack in maintractor.findall('track'):
Comment 1 laura 2021-11-27 13:14:00 UTC
I found the issue. The global_feed=1 tractor still exists, it just doesn't have that attribute any more. 

I have submitted a patch to the opentimelineio project, which can be found here: https://github.com/PixarAnimationStudios/OpenTimelineIO/pull/1160

The problem can also be worked around by opening the kdenlive project file in an editor and adding a `global_feed="1"` to the last `<tractor>` tag (which should be the one that includes all the other tractors). It should look like this:

<tractor title="your project name " id="tractorSOMENUMBER" global_feed="1" in="00:00:00.000" out="00:20:34.480">
  <track producer="black_track"/>
  <track producer="tractor0"/>
  ...
</tractor>

If the kdenlive team just added that attribute back in, that would also fix the issue of course :)
Comment 2 emohr 2021-12-06 19:19:45 UTC
Thank you for reporting. OpenTimelinIO is not really working at the moment. Let's see if the Developers have time to fix it.
Comment 3 Julius Künzel 2022-01-16 18:24:42 UTC
*** This bug has been marked as a duplicate of bug 426942 ***