Search code examples
mlt

MLT Framework: How to add zomm animation to all the tracks?


I have three tracks as follow:

track0: [---------------------black-----------------------]  
track1: [-------------------in.mp4------------------------]  
track2: [-----][1.jpg][----------][1.jpg]

What I want to do is add a zoom animation to it, which means apply a zoomin or zoomout animation to the frame after being composited.

And I know The "affine" filter can be help me, So I tried this:

melt.exe   
color:black out=00:00:20.000 -track  
in.mp4 -track 
-blank out=00:00:2.000 1.jpg in=00:00:00.000 out=00:00:5.000 -attach-clip affine background=colour:0 transition.geometry="0.49%/53.29%:41.72%x46.35%" -blank out=00:00:1.000 1.jpg in=00:00:00.000 out=00:00:5.000 -attach-clip affine background=colour:0 transition.geometry="0.00%/30.13%:69.86%x69.86%"   
-filter affine transition.cycle=0 transition.geometry="0=0.00%/0.00%:100.00%x100.00%; 49=0.00%/0.00%:100.
00%x100.00%; 75=0.00%/-106.07%:206.07%x206.07%; 125=0.00%/-106.07%:206.07%x206.07%; 250=0.00%/-0.22%:100.22%x100.22%; 300=0.00%/-0.22%:100.22%x100.22%; 350=-31.34%/-31.64%:131.64%x131.64%"  
-transition mix:-1 always_active=1 a_track=0 b_track=1 sum=1  
-transition frei0r.cairoblend a_track=0 b_track=1 disable=0  
-transition mix:-1 always_active=1 a_track=0 b_track=2 sum=1  
-transition frei0r.cairoblend a_track=0 b_track=2 disable=0  
-consumer avformat:zoom.mp4 

Sorry for that very long command line.

But I have unexcepted results with the zoom animation effects only applyed to track2, in other words, only the 1.jpg has zoom animation effects. The frames in "in.mp4" have no animation effects.

what I want is to apply the zoom animation to all the tracks. And I know there must be something wrong with my command line. But I can't figure out how to do this with command line.

So how can I do this?


Solution

  • You should look at the melt documentation here: https://mltframework.org/docs/melt/

    The "-filter" parameter applies the filter to the track. So the results you see are expected. But there are other options to consider. "-attach" looks promising. You might need to move the filter later in the command. Read the section on "Attached Filters" for more details and examples.