This forum has been archived. All content is frozen. Please use KDE Discuss instead.

automated timeline clip insertion - arrangement

Tags: None
(comma "," separated)
zukaaz
Registered Member
Posts
4
Karma
0
I'm creating a python script to automate the insertion and arrangement of clips on the timeline.

Currently if you have a loads of clips in a project, when you select them all and drag / drop into the timeline - it inserts them all into one track back to back with no transitions.

I find it time consuming to rearrange all the clips and add transitions after dropping them into the timeline.

The script I created automatically scans a project, finds all the video clips and arranges them into video 1 / video 2 track with overlap and a dissolve transition between the video clips.

Am I reinventing the wheel or do other people find this useful?
zukaaz
Registered Member
Posts
4
Karma
0
I have this working but sometimes the video clip length is off by one frame, when compounded by multiple clips near the end of the project the total error is several frames. The error is happening when trying to match video transitions to video clip start / endpoints automatically.

The problem comes from the following:

Code: Select all
<producer id="2" in="0" out="1169">
  <property name="length">00:00:39;00</property>
  <property name="resource">video.mov</property>
 </producer>


I'm using in and out to calculate the number of frames. There seems to be some rounding error the xml file reports 1169 frames but in the UI it reports 1170 frames sometimes. The difference is noticeable between different length video clips.

Does anybody know if internally kdenlive uses frames or time for calculating length of videos?
vpinon
KDE Developer
Posts
708
Karma
6
OS
Kdenlive is sort of an UI to MLT media framework. There is a python binding for MLT (used by OpenShot 1.x & Flowblade) you could use directly.
I believe MLT uses frames only for editing.
Is your project 25/30/50/60fps or does it use a fractional frame rate (29.97/59.94)? The latter case can be your problem in frame counting…
zukaaz
Registered Member
Posts
4
Karma
0
my clips were all the same FPS and also matching the FPS of the kdenlive project.

I think found my problem and a solution that works:

in the kdenlive project XML file it reports the length as:
seconds + frames
00:00:04;17 = 4 seconds + 17 frames
at 29.97 FPS it comes out to 136.88 frames

the kdenlive project would calculate this as 136 frames by rounding down which is correct because you can't have a fraction of a frame (right?)

But in the cases where it rounded down like this it would always cause a blip on the transition if I used the exact frames in as in the "out" property of the producer element in the XML file.

If I rounded up 136.88 -> 137 for placing my automatic transitions would all be smooth.
zukaaz
Registered Member
Posts
4
Karma
0
I wanted to post a screenshot of the result and the code to share but I don't see any way to post attachment or image in this forum. the img tag seems it wants to refer to a URL instead of an attachment.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot], Yahoo [Bot]