Could you explain a bit further?
I mean:
1. Create profile: p
2. Create producer: video1 (with profile p)
3. Create producer: video2 (with profile p)
4. Read the frame sizes
5. Create a new profile with the size of both videos stacked vertically
6. Create the consumer with that new profile
So far I am getting funny sizes.
I declared the following function:
1. Creates a new profile
2. Resize the profile with the size of both videos
3. Creates a new tractor and adds the videos as two separated tracks.
4. I use an affine filter and applies "oy=height1" to the second track.
5. I apply the transition "addition" in order to make both videos visible.
proc stackVertically( v1,v2:Producer ):tuple[tr:Tractor; p:Profile] =
# Get an appropriate profile
var profile = newProfile()
var frame1 = v1.getFrame(0)
var (width1,height1) = frame1.getImage()
var frame2 = v2.getFrame(0)
var (width2,height2) = frame2.getImage()
profile.setWidth(width1 + width2)
profile.setHeight(height1 + height2)
# Create the tractor
var tr = newTractor()
tr.connect( v1, 0 ) # We use the playlist as track0
tr.connect( v2, 1 )
var aff = newFactoryFilter(profile, "affine")
aff["transition.oy"] = height1
tr.plant(aff, 1)
var compose = profile.newFactoryTransition("frei0r.addition")
tr.plant(compose, 0, 1)
return (tr, profile)
In order to use this function I do the following:
1. Read two videos (in this case I use the same video)
2. stack them vertically: the result is the tractor as a producer and the
new profile
3. I create an SDL2 base on the new profile
4. Connect the tractor to SDL
proc main =
var f = initFactory()
var p = newProfile("hdv_720_50p")
var v1 = p.newMedia("./resources/big_buck_bunny_720p_2mb.mp4")
var v2 = p.newMedia("./resources/big_buck_bunny_720p_2mb.mp4")
var (newProducer, profile) = stackVertically( v1,v2 )
# Consumer
var sdl = profile.newFactoryConsumer( "sdl2" )
sdl["terminate_on_pause"] = 1
# From tractor to SDL2
#v1.attach(aff1)
newProducer > sdl
# Start the consumer
sdl.run
The result is: https://i.imgur.com/eESDdJg.jpg
El mié, 5 ene 2022 a las 18:28, Dan Dennedy (<[email protected]>) escribió:
>
> On Wed, Jan 5, 2022 at 9:22 AM José María García Pérez <
> [email protected]> wrote:
>
>> What is the proper way of stacking videos vertically?
>>
>> For example:
>> video1
>> ---------
>> video2
>>
>> so that I can later scale it and move it around in the profile.
>>
>> Right now I am using affine (scaling down and then positioning it
>> vertically). But the result is something like:
>> video1 | black
>> ------------------
>> video2 | black
>>
>> Basically I am looking how to get a new video which is: (width) x
>> (2*height)
>>
>> You need to make a custom profile.
>
_______________________________________________
Mlt-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mlt-devel