Placing clips according to a pictureΒΆ

So how do you do some complex compositing like this ?

It takes a lot of bad taste, and a segmenting tool

In this script we will use this image (generated with Inkscape):


We will find the regions of this image and fit the different clips into these regions:

from moviepy.editor import *
from import findObjects

# Load the image specifying the regions.
im = ImageClip("../../ultracompositing/motif.png")

# Loacate the regions, return a list of ImageClips
regions = findObjects(im)

# Load 7 clips from the US National Parks. Public Domain :D
clips = [VideoFileClip(n, audio=False).subclip(18,22) for n in
     [ "../../videos/",

# fit each clip into its region
comp_clips =  [c.resize(r.size)
               for c,r in zip(clips,regions)]

cc = CompositeVideoClip(comp_clips,im.size)

# Note that this particular composition takes quite a long time of
# rendering (about 20s on my computer for just 4s of video).

(note that some pictures are distorted here as their size has been modified without care for their aspect ratio. This could be changed with a few more lines.)