Hello, I need multiple alpha-layered animations to be combined into a single MP4. Currently using the following script but it only successfully layers layer1 on top of the background .png. All animations are the same resolution. Does anyone know a good way to script this?
Code:"ffmpeg -i background.png -i layer1.mov -i layer2.mov -i layer3.mov -filter_complex 'overlay' + out.mp4"
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 7 of 7
Thread
-
-
Assuming you want an end distribution format like AVC, 4:2:0 , no audio, layered in that order where layer3 is the topmost layer, it would look something like this
Code:ffmpeg -r 24 -i background.png -i layer1.mov -i layer2.mov -i layer3.mov -filter_complex "[0:v][1:v]overlay[ov1], [ov1][2:v]overlay[ov2], [ov2][3:v]overlay[ov3], [ov3]scale=out_color_matrix=bt709,format=yuv420p[out]" -map [out] -c:v libx264 -crf 20 -an -shortest output.mp4
-
Where it says -r 24 (before -i background) , you should change that to the actual framerate of the video assets (layer1.mov etc...) . If they were 24/1 fps, then -r 24 is ok. But if they were 30/1 fps, then use -r 30 , otherwise you will get dropped/duplicated frames.
-
Hey, a follow up question here...do you know what the syntax would be if i need to stack multiple .pngs and THEN put the animations on?
HTML Code:ffmpeg -i background.png -i overlayimage1.png -i overlayimage2.png -i animation1.mov -i animation2.mov -filter_complex "?????????????, [ov1][2:v]overlay[ov2], [ov2][3:v]overlay[ov3], [ov3]scale=out_color_matrix=bt709,format=yuv420p[out]" -map [out] -c:v libx264 -crf 20 -an -shortest output.mp4
-
The same way - look at the pattern. Just add on 4:v and ov4 because you have 5 inputs instead of 4 . So there should be 4 overlays instead of 3 . You can use different names or labels instead of ov1, ov2, etc... They are just names for input/output nodes
0:v is the 1st video input
1:v is the 2nd video input
2:v is the 3rd video input
.
.
Code:-filter_complex "[0:v][1:v]overlay[ov1], [ov1][2:v]overlay[ov2], [ov2][3:v]overlay[ov3], [ov3][4:v]overlay[ov4], [ov4]scale=out_color_matrix=bt709,format=yuv420p[out]"
-
Just my preference but I use Avisynth because the timings for each overlay, position, and duration can be set. You can also mix and match Images/videos for different base file and mixed overlays. Below I have a image as the base file and overlay both image and video. Setup is shown below. Takes a little thought at first but may be of help to others.
Code:v1=imageSource("C:\Users\Bud\Desktop\diz.jpg",fps=30).converttoRGB32.LanczosResize(854,480) Image11=DirectShowSource("C:\Users\Bud\Desktop\test.mp4").converttoRGB32.LanczosResize(160,90).trim(0,49) Image12=DirectShowSource("C:\Users\Bud\Desktop\test.mp4").converttoRGB32.LanczosResize(160,90).trim(50,99) Image22=imageSource"("("C:\Users\Bud\Desktop\diz.jpg").converttoRGB32.LanczosResize(160,90).trim(0,49) Image23=imageSource"("("C:\Users\Bud\Desktop\diz.jpg").converttoRGB32.LanczosResize(160,90).trim(50,49) Image24=imageSource"("("C:\Users\Bud\Desktop\diz.jpg").converttoRGB32.LanczosResize(160,90).trim(50,99) Image33=DirectShowSource("C:\Users\Bud\Desktop\test.mp4").converttoRGB32.LanczosResize(160,90).trim(0,-1) Image34=DirectShowSource("C:\Users\Bud\Desktop\test.mp4").converttoRGB32.LanczosResize(160,90).trim(0,49) Image35=DirectShowSource("C:\Users\Bud\Desktop\test.mp4").converttoRGB32.LanczosResize(160,90).trim(50,99) Clip1=v1.trim(0,49).Overlay(image11, 10,10 ,Opacity=1.0,image11.ShowAlpha()) \ ++ v1.trim(50,99).Overlay(image12, 10,10 ,Opacity=1.0,image12.ShowAlpha()).Overlay(image22, 10,110 ,Opacity=1.0,image22.ShowAlpha()) \ ++ v1.trim(100,99).Overlay(image23, 10,110 ,Opacity=1.0,image23.ShowAlpha()).Overlay(image33, 10,210 ,Opacity=1.0,image33.ShowAlpha()) \ ++ v1.trim(100,149).Overlay(image24, 10,110 ,Opacity=1.0,image24.ShowAlpha()).Overlay(image34, 10,210 ,Opacity=1.0,image34.ShowAlpha()) \ ++ v1.trim(150,199).Overlay(image35, 10,210 ,Opacity=1.0,image35.ShowAlpha()) \ ++ v1.trim(200,0) return Clip1
[Attachment 61567 - Click to enlarge]
Similar Threads
-
VSDC - multiple movement animations not working in Export
By David328 in forum Newbie / General discussionsReplies: 3Last Post: 17th Oct 2021, 17:55 -
overlay some text with a black background/white text over one small section
By devdev in forum EditingReplies: 0Last Post: 16th Dec 2020, 12:27 -
Multiple vtt's to single srt
By qaqaqaq in forum SubtitleReplies: 3Last Post: 15th Sep 2019, 00:50 -
Swapping subtitles on multiple IFOs on a single dvd?
By nobodyhome in forum Authoring (DVD)Replies: 1Last Post: 5th Jul 2017, 15:25 -
Is there a guide to merging multiple DVD titles into a single output file?
By Lolipop Jones in forum DVD RippingReplies: 10Last Post: 11th Nov 2016, 19:19