Simple video composition with kdenlive

I've just got an idea on how kdenlive could allow video composition effects in a way that would not be too hard (hopefully) to implement.

To implement video composition in a DAG fashion, as in Ramen HDR, would be too hard to implement, so I thought on how to do it more easily. My idea is: implement combining operations for 2 (only 2) videos. That simple.

The combining operations would be something like gimp's layer modes[1]. Most of them are easily implementable. So, everything the user would have to do is: select 2 clips (or better: tracks!) and apply a combining operation. That would leave a new clip (or track) with the combination of both clips (or tracks) for the chosen combining operation.

Combining only 2 videos would not be as practical (from a user point of view) as having a DAG as in Ramen HDR, but it is a lot easier to implement and would allow the user to do anything that a DAG-based image compositor allows. Recombining is enough to achieve amazing effects.

So, kdenlive devs, what do you think of my idea?

[1] http://docs.gimp.org/en/gimp-concepts-layer-modes.html

Ok, after taking a look at frei0r[1], I've seen that it has mixers for 2 and even 3 sources. So, why doesn't kdenlive benefits from this?

[1] http://git.dyne.org/index.cgi?url=frei0r/tree/src

The mixer2 filters are ordinary transitions (afaik). Many of the GIMP layer modes (grain extract, screen, multiply) are already there. Well, without fading :(
I agree that this area could benefit from some improvements. Are you a programmer?

For those interested: Ramen HDR

Simon

Ordinary transitions? That means they can't be chained up? I still think generating a new clip or track would be better.

And yes, I'm a programmer and I already made some contributions to Audacity[1] and some other projects. Currently I'm improving glade[2], so I have no spare time to contribute to kdenlive. Thats a bit sad since looking at the code of the frei0r effects gave me a feel that they simple to write.

[1] http://wiki.audacityteam.org/wiki/Developer_News
[2] https://bugzilla.gnome.org/show_bug.cgi?id=637835

At the moment it could be done this way:
Add the transition between two clips in a separate project and then import this project as a clip into your main project.
This process could be improved a lot if we had multiple timelines in one project and could use them in each other.
See this feature request:
http://kdenlive.org/mantis/view.php?id=1766

So the frei0r mixers aren't the problem here (since they are already available as "transitions") but a proper UI for reusing combined clips. And I think that multiple timelines are the way to go.

Do the frei0r mixers for 3 sources (currently there is only one) can also be used as transitions?

How complicated would it be to add an option to turn a transition between clips in a new clip?

I keep thinking that video clips in a track should be automatically composed over anything present below in the timeline, without any specific user intervention.
That'd be akin to the way layers in Photoshop/GIMP/Krita composite with each other: i.e. if the clip has alpha channel information, then it'd be used right away, additionally the user could choose any transfer/blend mode he wishes, like: Normal, Multiply, Add, Screen, etc.

This transfer/blend mode options would ideally be accessed as a property of the clip, and not require the user to add or adjust any transition to the clip.
Perhaps just make a right click over the clip and choose the desired Transfer Mode from a submenu, or there could be a Clip Properties widget/panel in Kdenlive, that'd show this kind of information when a clip is selected (like, Transfer Mode, usage of the Alpha Channel (Use it, Ignore it, Invert it, treat the alpha as Premultiplied [by a color] or as Straight, etc)

It's not about reinventing the wheel here, just apply the same idea currently used in so many programs of the field.

That said, I know I can't do it (I'm no programmer).
I know perhaps it'd take sometime to implement it this way, from where we are now.
But I definitely think this is the way to go to with respect to composition of clips in kdenlive.

Thanks for listening! :)

Apart from how it is done, a way to apply an "operation" in two (or more) clips/tracks and obtain a *new* one is still required. Being able to do that would allow the user to create arbitrary compositions.

frei0r mixers for 3 sources are not supported in MLT. It has a class for objects that take 1 input (filter) and 2 inputs (transition). There is no class for arbitrary number of inputs.
Automatic compositing could be done in Kdenlive if it wants to do that, OpenShot does. However, I suggest waiting for some planned rework on the composite transition that would allow a single instance of the transition per pair of tracks and takes the parameters from clip properties. Otherwise, there are are implementation details that would require too many transitions to be processed.

Are you suggesting that if Kdenlive did automatic compositing it would be too slow?
If that's the problem, then this seems to be one of the few reasons I can think of, for not doing it automatically.
Would it be that slow?

How does OpenShot handle its automatic transition feature?
Is it slow too?

Speed is only slightly impacted. The Composite already tries to optimize out a full or no overlay cases. More importantly is how it affects the stability because each transition is extending the call stack. You can test this today if you made a very full timeline and put a composite transition on every shot. This is basically what OpenShot does under the covers. We are seeing some Kdenlive users working with several hundreds of clips!