Hello,
I have been experimenting with exporting very simple edits as OTIO files in order to open them in Davinci Resolve. Those edits are made of a single clip with a few cuts, and a sub clip moved above the rest (i.e. from track V1 to track V2).
When I import that timeline into DVR, the order of the video tracks is reversed: what should be above (on V2) is on V1 and what should be on V1 is on V2. In one instance thet test timeline had 3 video tracks, and all had been reveresed (original V1 had become new V3, V2 had stayed in place and original V3 was on V3).
The same happens when I export a timeline as OTIO from DVR: when imported in Kdenlive, the order of the video tracks is inversed.
I’m on Windows 11, CPU Ryzen 5 4600, GPU GTX 1650, Kdenlive 25.04.1 standalone freshly installed (all settings to default). I have two PC with the same specs, it happens on both.
*Note: even though both my desktop and laptop are of the same brand and have pretty much the same specs, on the desktop Kdenlive refuses to reopen the clips when importing an OTIO timemine, whereas on the laptop it imports normally (except for the order of the V tracks)
Solved. After spending yet another couple of hours, I learned that DVR and kdenlive don’t use the same ordering method. So a solution would be to run the .otio file through a Python script that changes the order of the video tracks. Let’s name it “invert_vids.py” and say we exported a “FromKdenlive.otio” file
Then, in a “cmd” window, type “python invert_vids.py FromDkenlive.oio ToDVR.otio”
Here’s the script (thx chatgpt):
import opentimelineio as otio
import sys
import os
def invert_video_tracks(input_path, output_path):
timeline = otio.adapters.read_from_file(input_path)
# Filtrer les pistes vidéo uniquement
video_tracks = [t for t in timeline.tracks if t.kind == otio.schema.TrackKind.Video]
non_video_tracks = [t for t in timeline.tracks if t.kind != otio.schema.TrackKind.Video]
# Inverser l'ordre des pistes vidéo
inverted_video_tracks = list(reversed(video_tracks))
# Créer une nouvelle timeline avec les pistes inversées
new_timeline = otio.schema.Timeline(name=timeline.name)
for track in inverted_video_tracks + non_video_tracks:
new_timeline.tracks.append(track.clone()) # <- CLONE ici
# Écrire le nouveau fichier OTIO
otio.adapters.write_to_file(new_timeline, output_path)
print(f"OK. Fichier corrigé écrit dans : {output_path}")
if name == “main”:
if len(sys.argv) != 3:
print(“Utilisation : python invert_video_tracks_otio.py input.otio output.otio”)
sys.exit(1)
input_file = sys.argv[1]
output_file = sys.argv[2]
if not os.path.exists(input_file):
print(f" Echec. Fichier introuvable : {input_file}")
sys.exit(1)
invert_video_tracks(input_file, output_file)
1 Like