THE CUP SONG COVERS MIX

This notebook contains the Python code that generated this video:

In [2]:
from IPython.display import HTML
HTML(""" <iframe width="560" height="315"
 src="//www.youtube.com/embed/rIehsqqYFEM"
    frameborder="0" allowfullscreen>
</iframe> """)
Out[2]:

Foreword

The code uses MoviePy, a Python library for video editing. You can see most of the most basic capabilities of the library in this video: cuts, concatenations, resizing, fade-in/fade-out effects, texts, etc. Just for fun I also added a few not-so-basic effects like video clips with changing positions.

MoviePy is well suited for simple and automotizable operations, as well as advanced, customized effects, but this video, by its length and complexity, is an extreme example of what you would do with it. So if you like elegant and concise code, don't look down !

For info, the generation of this 2 minutes video takes 10-15 minutes on my laptop, most of the computation time being spent to resize the different video clips.

Using scripts to edit a music video is not necessarily a good idea, but it has its perks: in this video the end credits are automatically generated from the list of videos used by the script, and that list is obtained by parsing... the script itself ! In other words, the code is reading itself ! This way I am sure that no one is forgotten in the credits.

Imports and functions

Here begins the code. It is organized by parts. In each part we first load the video clips from files:

kara = VideoFileClip(... # Video of Kara
kid = VideoFileClip(...  # Video of a kid

Later, we edit these clips (cut, transitions, fade-ins, etc.):

kara_p = ( kara.subclip(0.55,4.45)
   .reW()
   .crop(y2=H)
   .fadein(0.5) )


kid_p= kid.subclip(1.35,1.85)...

Then we assemble the clips into a big composition: first_verse = CompositeVideoClip([kara_p, kid_p...])

In [3]:
from moviepy.editor import *
import os 
import re # to parse this file to make the credits


W, H = 720, 404 # dimensions of the final video

# These very useful functions resize the clips to
# the dimensions of the final video

VideoFileClip.reW = lambda clip :  clip.resize(width=W)
VideoFileClip.reH = lambda clip :  clip.resize(height=H)

Title Screen

In [4]:
theCupSong = TextClip('The Cup Song\nYoutube Covers Mix',
    fontsize=50,
    font="Ubuntu-Regular",
    color = 'white')\
    .set_pos(('center', 0.24*H))

    
editedby = TextClip('Edited by A. de Lamarmotte',
    fontsize=28,
    font="Ubuntu-Regular",
    color = 'gray')\
    .set_pos(('center', 0.58*H))


titleScreen = CompositeVideoClip([theCupSong, editedby],
    size = (W,H))\
    .set_duration(3)\
    .fadeout(0.5)

First Rythm

In [5]:
kara = VideoFileClip("./girl_acapella/xkaraxmusicx.mp4")
kid = VideoFileClip("./male/DrewMannMusic.mp4")
talia = VideoFileClip("./girl_acapella/taliajoy18.mp4")
jencar = VideoFileClip("./male/hoorahjencar.mp4")
riley = VideoFileClip("./girl_acapella/hoosierfamily.mp4")
clown = VideoFileClip("./girl_acapella/salvadorzepeda68.mp4")
nicoleKim = VideoFileClip("./girl_acapella/NicoleKim.mp4")
In [6]:
kara_p = ( kara.subclip(0.55,4.45)
    .reW()
    .crop(y2=H)
    .fadein(0.5) )


kid_p= ( kid.subclip(1.35,1.85)
    .crop(x1=44, x2=-45)
    .reH()
    .set_pos('left')
    .margin( right=2, color=3*[255])
    .volumex(1.5) )
    
    
talia_p = (talia.subclip(3.53,4)
    .reH()
    .crop(x1=22, x2=-22)
    .set_pos((kid_p.w-2,0))
    .margin( right=2, left=2, color=3*[255]) )
    
    
jencar_p = ( jencar.subclip(1.79,2.23)
    .crop( x1=241, x2=-242)
    .reH()
    .margin(right=2, left=2, color=3*[255])
    .set_pos(( kid_p.w + talia_p.w-4 ,0))
    .volumex(0.7) )
        
    
riley_p = (riley.subclip(9.25,9.75)
    .crop( x1=20, x2=-47)
    .reH()
    .margin(left=2, color=3*[255])
    .set_pos((jencar_p.w + kid_p.w + talia_p.w-6,0)) )

clown_p = (clown.subclip(6.6,7.1)
    .crop( x1=410, x2=-550)
    .reH()
    .margin(left=2,  right=2, color=3*[255]))
clown_p = clown_p.set_pos((riley_p.pos(0)[0] - clown_p.w+2,0))


nicoleKim_p = ( nicoleKim.subclip(7.4,8.0)
    .reH()
    .crop( x1=280,x2=280+W/4 )
    .margin( left=2, right=2, color=3*[255])
    .set_pos((W/4,0)) )
In [7]:
d = 0.52
cc = CompositeVideoClip([
    kid_p,
    talia_p.set_start(d+.01),
    jencar_p.set_start(2*d+.00),
    nicoleKim_p.set_start(5*d),
    clown_p.set_start(4*d),
    riley_p.set_start(3*d-.01)],
    size=(W,H))

first_rythm = concatenate([kara_p, cc])

VERSE 1

In [8]:
anna = VideoFileClip("./girl_acapella/Anna Burden.mp4")
malia = VideoFileClip("./girl_acapella/MaliaRogersMusic.mp4")

halie = VideoFileClip("./girl_acapella/Halie Ranee.mp4")
cooper = VideoFileClip("./girl_acapella/eveecooper.flv")
speedstack = VideoFileClip("./girl_acapella/theaterobsession101.mp4")


faraz = VideoFileClip("./male/Faraz Sabir.mp4")
amyspants = VideoFileClip("./amyspants.mp4")

miriam = VideoFileClip("./girl_acapella/Miriam Carone.mp4")
kristina = VideoFileClip("./girl_acapella/Kristina G.mp4")
irene = VideoFileClip("./girl_acapella/Irene Poon.mp4")

two_little_girls = VideoFileClip("./duet/MuggleSam.mp4")
school_choir_PS22 = VideoFileClip("./choir/PS22 Chorus.mp4")
piano = VideoFileClip("./instrumental/Jasper Tan.mp4")
shae = VideoFileClip("./uke_guitar_song/McKenna Shae.mp4")
In [9]:
from scipy.interpolate import interp1d

# These complicated interpolation define the movement of the clip

anna1 = interp1d([-1,1.0,2,8.1,8.8,11.0,11.4,22],
                 [190,190,112,112,190,190,170,170])

anna2 = interp1d([-1,1.0,2,8.1,8.8,11.0,11.4,22],
                [190+W/4,190+W/4,112+W/2,112+W/2,
                 190+W/4,190+W/4,170+W/3,170+W/3])


anna_p = (anna
    .subclip(8)
    .reH()
    .fl(lambda gf,t: gf(t)[:,int(anna1(t)):int(anna2(t))])
    .volumex(1.2)
    .set_duration(18)
    .set_pos(lambda t:("left" if (t<11.0) else 
                      min(480,1000*(t-11.0)),0)))


malia_p = (malia
    .reH()
    .subclip(17.18)
    .crop(x1=185,x2=185+W/2)
    .margin(left=3,color= (255,255,255))
    .set_pos("right")
    .volumex(0.8)
    .set_start(anna_p.start+ 4.65)
    .set_end(anna_p.start+8.8))
In [10]:
cooper_p = (cooper.crop(y1=50)
    .reH()
    .crop(x1=304, x2 = 304+W/4)
    .margin(left=1,right=1,color=3*[255])
    .subclip(13.65)
    .volumex(0.6)
    .set_start(anna_p.start+8.1)
    .set_end(anna_p.start+10.3))
    
ww = cooper_p.w
cooper_p = cooper_p.set_pos(lambda t:(W-2*ww,min(0,1000*t-H)))


halie_p = (halie.subclip(15.6)
    .reH()
    .crop(x1=258, x2 = 258+W/4)
    .margin(left=1,right=1,color=3*[255])
    .volumex(0.6)
    .set_start(anna_p.start+8.1)
    .set_end(anna_p.start+10.3)
    .set_pos(lambda t:(W-3*ww,max(0,H-1000*t))))

                
speed_stack_p = (speedstack.subclip(35.27)
    .reH()
    .crop(x1=160, x2 = 160+W/4)
    .margin(left=1,color=3*[255])
    .volumex(0.6)
    .set_start(anna_p.start+8.1)
    .set_end(anna_p.start+10.3)
    .set_pos(lambda t:(W-ww,max(0,H-1000*t))))

    
faraz_p = (faraz.subclip(25.9)
    .reH()
    .crop( x1=100, x2=100+3*W/4)
    .fl(lambda gf, t: gf(t)[:,(0 if (t<0.9) else
                                int(1000*(t-0.9))):])
    .fadeout(0.2)
    .crossfadein(0.2)
    .volumex(2.4)
    .set_start(anna_p.start+10.1)
    .set_end(anna_p.start+11.6)
    .audio_fadeout(0.1)
    .set_pos('right'))


amyspants_p = (amyspants
    .subclip(19.4,22)
    .margin(12,color=(255,255,255))
    .resize( width=2*W/3-20)
    .set_pos((10,'center'))
    .fadein( 0.5)
    .fadeout( 0.5)
    .audio_fadein(0.3)
    .set_start(anna_p.start+12.29))

CHORUS 1

In [11]:
shae_p = (shae
    .subclip(25.6)
    .reH()
    .crop(x1=240, x2 = 240+W/3)
    .margin(right=3, color=(255,255,255))
    .audio_fadein(0.7)
    .volumex(0.6)
    .set_start(anna_p.start+16.1)
    .set_end(anna_p.start+22)
    .audio_fadeout(0.3) 
    .set_pos(lambda t:(min(240,-240+1000*t),0)) )
    
            
two_little_girls_p = (two_little_girls
    .subclip(34.25)
    .reH()
    .crop(x1=170, x2=170+360+60)
    .margin( right=2, color=(255,255,255))
    .set_start(anna_p.start+14.9)
    .set_end(anna_p.start+23.5)
    .audio_fadeout(0.5)
    .set_pos( lambda t:( -180 if t<5.3 else
                        min(0,-150+500*(t-5.3)),0)))
                         
    
school_choir_PS22_p = (school_choir_PS22
    .reH()
    .volumex(0.3)
    .subclip(29.6)
    .crop(x1=140, x2=140+W/2)
    .set_start(anna_p.start+16.24)
    .set_end(anna_p.start+24.5)
    .audio_fadeout(0.5)
    .margin(left=3,color=(255,255,255))
    .crossfadein( 2)
    .fadeout(0.5)
    .set_pos(lambda t:(W-240 if t<4 else
                       max(W/2,W-240-500*(t-4)),0)) )


### PIANO


piano_p = (piano
    .subclip(43,53.1)
    .reW()
    .set_pos("bottom")
    .crop(y1=145,y2=278)
    .margin(top=2,color=(255,255,255))
    .crossfadein(1)
    .audio_fadeout(0.8)
    .audio_fadeout(0.8)
    .volumex(.7)
    .set_start(anna_p.start+22.2) )


miriam_p = (miriam
    .subclip(25.8,31)
    .resize(height=H-piano_p.h)
    .volumex(0.8)
    .crop( x1=120,x2=120+W/3)
    .margin( right=2,  color=3*[255])
    .crossfadein(0.3)
    .set_start(piano_p.start + 1.55)
    .set_end(piano_p.start + 5.65)
    .audio_fadeout(0.4)
    .fadeout(.2)
    .set_pos(('left','top')) )
      
        
kristina_p = (kristina
    .subclip(33.20)
    .resize(height=H-piano_p.h)
    .volumex(0.8)
    .crop(x1=110,x2=110+W/3)
    .margin(left=2, color=3*[255])
    .crossfadein(0.3)
    .set_start(piano_p.start + 3.53)
    .set_end(piano_p.start + 5.65)
    .audio_fadeout(0.4)
    .fadeout(.3)
    .set_pos(('center','top')))

     
irene_p = (irene
    .subclip(39.4,43.5)
    .resize( height=H-piano_p.h)
    .crop( x1=70,x2=70+W/3)
    .margin( left=2, color=3*[255])
    .set_start(piano_p.start + 5.80)
    .crossfadein(0.3)
    .fadeout(.3)
    .set_pos(('right','top')) )
In [12]:
first_verse = CompositeVideoClip([
    faraz_p, # not chronological, but must be under every other video
    anna_p,
    malia_p,
    halie_p, speed_stack_p, cooper_p,
    amyspants_p,
    shae_p,
    two_little_girls_p,
    school_choir_PS22_p,
    piano_p,
    miriam_p, kristina_p, irene_p],
    size=(W,H))
#final.subclip(15,27).audio.to_audiofile("test.ogg")
#final.show(10)

Inter Rhythm

1 - Straight

In [13]:
rainbelle = VideoFileClip("./duet/rainbelle99.mp4")
cup_kids = VideoFileClip("./trio/patmartel100.mp4")
girls_complex = VideoFileClip("./cup_only/gimmiebeanstheband.mp4")
cantina_band = VideoFileClip("./choir/SMCdramaclub .mp4")
allSheKnows = VideoFileClip('./male/AllSheKnows.mp4')
harvard = VideoFileClip('./cup_only/HarvardTHUD.mp4')
rsnmusik = VideoFileClip("./cup_only/RSNmusik.mp4")
In [14]:
rainbelle_p = (rainbelle.subclip(7.1,10.55)
    .reW()
    .crop(y2=H)
    .fadein(.15)
    .volumex(0.6) )
            
    
cup_kids_p = (cup_kids.subclip(278.80,279.20)
    .reH()
    .audio_fadein(0.1) )
    

harvard_p = (harvard.subclip(17.90,18.34)
    .reW()
    .crop(y2=H))
    
    
cantina_band_p = (cantina_band.subclip(25.25,25.6)
    .reH()
    .audio_fadein(0.1) )


allSheKnows_p = (allSheKnows.subclip(35.20,35.97)
    .reH())



girls_complex_p = (girls_complex.subclip(32.00,32.78)
    .reH())


rsnmusik_p = (rsnmusik
    .subclip(20.16,20.66)
    .volumex(0.6)
    .reW()
    .crop(y2=220) )
In [15]:
inter_rythm = concatenate([
    rainbelle_p,
    cup_kids_p,
    harvard_p,
    cantina_band_p,
    allSheKnows_p,
    girls_complex_p,
    rsnmusik_p])

#inter_rythm.audio.preview()
#inter_rythm.to_videofile('test.mp4', bitrate='6000k')
In [16]:
until_inter_rythm = concatenate(
         [titleScreen,
          first_rythm,
          first_verse,
          inter_rythm])

Second Verse

In [17]:
original_lulu = VideoFileClip("./duet/Lulapinga.mp4")


ally_turner = VideoFileClip("./girl_acapella/Ally Turner.mp4")
daiyan = VideoFileClip("./girl_acapella/Daiyan Trisha.mp4")


sita_lizzie = VideoFileClip("./duet/Sita Lizzie.mp4")
jocelyne = VideoFileClip("./duet/Jocelyne Van Den Meersche.mp4")

amanda = VideoFileClip("./girl_acapella/amandayanggg.mp4")
people_mountain = VideoFileClip("./choir/Camp Kulin.mp4")
duo_alaska = VideoFileClip("./duet/Satrina Lord.mp4")

steph = VideoFileClip("./girl_acapella/stephulahoops.mp4")
katrina = VideoFileClip("./uke_guitar_song/katrinamelody.mp4")

choir_black_cloths = VideoFileClip("./choir/Genesee Noelani.mp4")
In [18]:
txt = TextClip('The original cup song',
               font='Ubuntu-Bold',
               fontsize=22)

txt_original_cupsong = (txt
    .on_color(size=(txt.w+6, txt.h + 6),
              color=3*[255])
    .margin(1)
    .margin( bottom=30,right=30, opacity=0.0)
    .set_pos(('right','bottom'))
    .set_duration(1.5) )
txt_original_cupsong.show()
In [19]:
original_lulu_p = (original_lulu.subclip(50,56.7)
    .reH()
    .set_pos('center')
    .set_end(5.6)
    .audio_fadeout(0.2))

ally_turner_p = (ally_turner.subclip(45.5,47.5)
    .crop( x1 = 400, x2= 950)
    .resize( height=0.45*H)
    .margin( 2, color=3*[255])
    .margin(right=20, opacity=0)
    .set_pos(('right','center'))
    .set_start(1.8))

wby,hby= ally_turner_p.size
ally_turner_p.pos = lambda t: (W-wby-20,'center')
            
daiyan_p = (daiyan.subclip((1,31),(1,33))
    .crop( x1 = 117, x2= 362)
    .resize(height=0.45*H)
    .margin(2, color=3*[255])
    .margin(left=20, opacity=0)
    .set_pos(('left','center'))
    .set_start(1.8) )
In [20]:
from scipy.interpolate import interp1d

sita_lizzie_p= ( sita_lizzie.subclip(51.2,55.4)
   .reW()
   .audio_fadein(0.2)
   .crop( x1 = 38, x2=-82, y1=21,y2=358)
   .resize( height =0.33*H)
   .margin( 2, color=3*[255])
   .set_start(3.8)
   .set_end(6.7)
   .crossfadeout(1) )


wgsv,hgsv = sita_lizzie_p.size 
itr_gsv = interp1d([-1,0,0.2,10],
                   [W/2 - wgsv/2,W/2 - wgsv/2, W-wgsv-10, W-wgsv-10  ])
sita_lizzie_p.pos = lambda t: (itr_gsv(t),H/2)# H-hgsv-10)


jocelyne_p = (jocelyne.subclip(44.95)
    .crop(x1=85, x2=598, y1=27, y2=315)
    .resize( height=0.33*H)
    .margin( 2, color=3*[255])
    .set_start(1.8)
    .set_end(6.7)
    .crossfadeout(1)
    .volumex(0.4)
    .audio_fadein(0.2))
    
w_joc, h_joc = jocelyne_p.size
itr_joc = interp1d([-1,2,2.2,10],
                   [W/2 - w_joc/2,W/2 - w_joc/2, 10, 10])
jocelyne_p.pos = lambda t: (itr_joc(t),H/2)
In [21]:
d = 2.5

amanda_p= (amanda.subclip(51.0,59)
    .crop( x1=50, x2 = 50+W/2)
    .resize( width=140)
    .margin( 2, color=3*[255])
    .crossfadein(0.2)
    .margin( right=10,top=10,opacity=0)
    .set_pos(('right','top'))
    .volumex(1.3)
    .audio_fadein(2)
    .set_start(5.5) )
                   

people_mountain_p = ( people_mountain.subclip(49.9,51)
    .reW()
    .volumex(1.5)
    .set_start(6.7))


duo_alaska_p = (duo_alaska.subclip(56.5,57.5)
    .reW()
    .crop(y1=-H)
    .volumex(1.2)
    .set_pos('center')
    .set_start(7.35))


katrina_p = ( katrina.subclip(38.15+d,58)
    .crop( x1=138, x2=342)
    .reH()
    .margin( right=2, color=3*[255])
    .audio_fadein( 0.1)
    .set_pos('left')
    .set_start(amanda_p.start + d)
    .set_end(13.53)
    .audio_fadeout(.1))

steph_p = (steph.subclip(52.85+d,59)
    .reH()
    .crop( x1=150, x2=150+W-katrina_p.w)
    .margin( left=2, color=3*[255])
    .volumex( 1.8)
    .set_pos('right')
    .set_start(katrina_p.start)
    .set_end(10.5)
    .audio_fadein( 0.5)
    .audio_fadeout( 0.5) )

choir_black_cloths_p = (choir_black_cloths
    .subclip((1,38.1),(1,43))
    .reH()
    .crop( x2= W-katrina_p.w)
    .volumex(0.5)
    .audio_fadein(0.5)
    .crossfadein(0.5)
    .set_pos('right')
    .set_start(10.0)
    .set_end(13.6)
    .audio_fadeout(1))
In [22]:
second_verse = CompositeVideoClip([
    original_lulu_p,
    txt_original_cupsong,
    ally_turner_p,
    daiyan_p,
    jocelyne_p,
    people_mountain_p,
    duo_alaska_p,
    sita_lizzie_p,
    steph_p,
    choir_black_cloths_p,
    katrina_p,
    amanda_p ],
    size = (W,H))
In [23]:
second_verse_start = until_inter_rythm.duration -.14

until_second_verse = CompositeVideoClip(
    [until_inter_rythm,
    second_verse.set_start(second_verse_start)])

#until_second_verse.audio.subclip(start-4, start+4).preview()

End

In [24]:
hannah_elless = VideoFileClip("./trio/Hannah Elless.mp4")

# First of three
marj = VideoFileClip("./girl_acapella/Marjorie Reboul.mp4")
thomas = VideoFileClip("./male/Thomas Graff.mp4")
camshie = VideoFileClip("./trio/Camshie Tejada.mp4")

# Second of three
raRaRileyStraw = VideoFileClip("./male/RaRaRileyStraw.mp4")
kira_mackenzie = VideoFileClip("./duet/Kira Pleska and Mackenzie Ziegler.mp4")
rachel = VideoFileClip("./duet/Rachel Nheu.mp4")

bass = VideoFileClip("./instrumental/Ankadiov Subran.mp4")
violin_guitar = VideoFileClip("./instrumental/David Wong.mp4")
flute = VideoFileClip("./instrumental/Laura Mew.mp4")
clarinet = VideoFileClip("./instrumental/clANAnett.mp4")
katie = VideoFileClip("./girl_acapella/Katie Floyd.mp4")
allyPaige = VideoFileClip("./girl_acapella/AllyyyPaige.mp4")
camryn = VideoFileClip("./girl_acapella/Camryn Harder.mp4")
richard = VideoFileClip("./male/Richard Beilfuss.mp4")
haven = VideoFileClip("./uke_guitar_song/Scott Slay.mp4")

lizzie = VideoFileClip("./ASL/lizzieejudee.mp4")
nicole = VideoFileClip("./uke_guitar_song/Nicole Zhang.mp4")
In [25]:
M = 20
B = 45

hannah_elless_p = (hannah_elless.subclip(79.31,91.00)
   .crop(y1=40,y2=-30,x1=50, x2=-50)
   .resize(width=.4*W)
   .fadein(1)
   .audio_fadein(.1)
   .audio_fadeout(.1)
   .margin(1, color=3*[255])
   .margin(right=B, bottom=M, opacity=0)
   .set_pos(('right', 'bottom')))

# ==================

marj_p = (marj
  .subclip(5.9,7.4)
  .resize(width= .4*W)
  .margin(1, color=3*[255])
  .margin(left=B, top=M, opacity=0)
  .set_pos(('left', 'top')))


thomas_p = ( thomas.subclip(0.6)
    .set_duration(marj_p.duration)
    .resize(width=.4*W)
    .crop(y2=-1, height = hannah_elless_p.h-M)
    .margin(1, color=3*[255])
    .margin(left=B, bottom=M, opacity=0)
    .set_pos(('left', 'bottom'))
    .audio_fadein(.1)
    .audio_fadeout(.1))



camshie_p = (camshie.subclip(5.2)
  .set_duration(marj_p.duration)
  .resize(width= .4*W)
  #.crop(y1= -marj_p.h-50, height=marj_p.h-M)
  .margin(1, color=3*[255])
  .margin(right=B, top=M, opacity=0)
  .set_pos(('right', 'top')))



# ==================

rachel_p = (rachel.subclip(5.85,7.65)
    .resize(width=.4*W)
    .margin(1, color=3*[255])
    .margin(right=B, top=M, opacity=0)
    .set_pos(('right', 'top'))
    .audio_fadein(.1))

kira_mackenzie_p = (kira_mackenzie.subclip(45.9, 50)
    .crop(x2=-50)
    .resize(width=.4*W)
    .crop(y2=-10, height = rachel_p.h-M)
    .margin(1, color=3*[255])
    .margin(left=B, top=M, opacity=0)
    .audio_fadein(.1)
    .crossfadeout(.5)
    .set_pos(('left', 'top'))
    .audio_fadeout(.1))

raRaRileyStraw_p = (raRaRileyStraw.subclip(10.35)
    .set_duration(rachel_p.duration)
    .resize(width=.4*W)
    .crop(y1=10, height = hannah_elless_p.h-M)
    .margin(1, color=3*[255])
    .margin(left=B, bottom=M, opacity=0)
    .set_pos(('left', 'bottom'))
    .audio_fadein(.1)
    .audio_fadeout(.1))
In [26]:
af_start=17


Hbottom = 3*H/5+2

M = 20


violin_guitar_p = ( violin_guitar.subclip(30.25,37)
    .crop(y1=100)
    .resize( height=Hbottom)
    .crop(x1=0, width=2.0*W/3)
    .volumex(1.5)
    #.subfx(lambda cl: cl.crop(x1=0, width=W/3),0,.9 )
    .margin( right=2, bottom=2, color=3*[255])
    .set_pos(('left','top'))
    .set_start(12.8)
    .audio_fadein(.1)
    .audio_fadeout(.5))

T_bass=1.2
bass_p = ( bass.subclip((1,8.95-T_bass),(1,16.5))
          .crop(x1=92, x2=-80)
          .audio_fadeout(.05)
          .volumex(1.0)
          .resize(width = 2.0*W/7)
          .margin( top=2, right=2, color=3*[255] )
          .set_pos(('left',Hbottom)) )

clarinet_p = ( clarinet.subclip(25.9,31)
    .volumex( 0.5)
    .crop( x1=73, x2=-101)
    .resize( width=2.0*W/7-1)
    .margin( top=2, left=2, color=3*[255])
    .set_pos(('right', Hbottom))
    .set_start(13.8))
print clarinet_p.h
    
flute_p = ( flute.subclip(22.35)
    .reH()
    .set_duration(violin_guitar_p.duration)
    .audio_fadeout(1)
    .volumex( 1.3)
    .resize(width=3.0*W/7)
    .margin(top=2, color=3*[255])
    .set_pos(('center',Hbottom))
    .set_start(13.8))
    
    
katie_p = ( katie.subclip(23.1,27)
    .volumex(1.6)
    .audio_fadein(.1)
    .resize(height=Hbottom)
    .crop( x1=10, x2=10+W/3)
    .margin(left=2, color=3*[255])
    .set_pos(('right','top')))
    
    
allyPaige_p = ( allyPaige.subclip(31.35,37.8)
    .audio_fadeout(1)
    .crop(x1=70, x2=-300, y1=50)
    .resize( height=Hbottom)
    .crop( x1=75, width=W/3)
    .margin(left=2, right=2, color=3*[255])
    .set_pos((W/3,'top')))


camryn_p = ( camryn.subclip(26.45,29.4)
    .crop(x1=300, x2=-300, y2=-100)
    .resize(height=Hbottom)
    .crop(x1=10, width=W/3)
    .margin(left=2, color=3*[255])
    .set_pos(('right', 'top')))


richard_p = (richard.subclip((1,13.05),(1,16.5))
             .audio_fadein(.1)
             .audio_fadeout(.5)
             .crop(y1=45,x1=70)
             .resize(width = clarinet_p.w)
             .margin(top=2, left=2, color=3*[255])
             .set_pos(('right',Hbottom))
             .volumex(2.5) )
160
In [27]:
haven_p = ( haven.subclip((1,54.65))
    .reH()
    .volumex(.5)
    .audio_fadein(.8)
    .resize(width=0.4*W)
    .margin(1, color=3*[255])
    .margin(right=40, opacity=0)
    .set_pos(('right','center')) )

lizzie_p = (lizzie.subclip((1,29.3),(1,34.5))
            .set_audio(None)
            .resize(width=.4*W)
            .margin(1, color=3*[255])
            .margin(left=40, opacity=0)
            .set_pos(('left','center'))
            .fadein(1)
            .fadeout(.5))

nicole_p = (nicole.subclip(36.9,-.1)
            .crop(y1=50)
            .resize(width=.4*W)
            .volumex(2)
            .audio_fadein(.2)
            .fadein(.5)
            .margin(1, color=3*[255])
            .margin(left=40, opacity=0)
            .fadeout(.1)
            .set_pos(('left','center')))
In [28]:
he_start = second_verse_start + 10.45
d1 = 3.5 # clap clap 1
d2 = 6.9 # clap clap 2


d = he_start+ 10.28 # start_orchestra
dstop = d+7.5 # stop_orchestra

until_last_chorus = CompositeVideoClip([

    until_second_verse,

    hannah_elless_p.set_start(he_start-.45),

    marj_p.set_start(he_start+d1),
    camshie_p.set_start(he_start+d1),
    thomas_p.set_start(he_start+d1),

    raRaRileyStraw_p.set_start(he_start+d2),
    rachel_p.set_start(he_start+d2),

    violin_guitar_p.set_start(d).set_end(dstop),
    kira_mackenzie_p.set_start(he_start+d2),

    flute_p.set_start(d).set_end(dstop),
    clarinet_p.set_start(d),
    katie_p.set_start(d),
    bass_p.set_start(d-T_bass).set_end(dstop),
    allyPaige_p.set_start(d+1.5).set_end(dstop),
    richard_p.set_start(d+4.0).set_end(dstop),

    camryn_p.set_start(d+4.0).set_end(dstop),
    haven_p.set_start(d+5.75),
    lizzie_p.set_start(dstop+.5),
    nicole_p.set_start(d+13.8)
    ])
In [29]:
#until_last_chorus.to_videofile('test_ulc.mp4',fps=5)

Credits

In [30]:
import re
import os
from moviepy.editor import *

def chunks(l, n):
    """
    Yield successive n-sized chunks from l.
    """
    for i in range(0, len(l), n):
        yield l[i:i+n]

andrew_foy = VideoFileClip("./instrumental/Andrew Foy.mp4")
jenni_saslove = VideoFileClip("./girl_acapella/Jenni Saslove.mp4")
brie_monetti =  VideoFileClip("./uke_guitar_song/Brie Monetti.mp4")
jenna_lynn = VideoFileClip("./uke_guitar_song/Jenna Lynn.mp4")
tiffany = VideoFileClip("./uke_guitar_song/Tiffany Cicio.mp4")
In [31]:
# We open THIS notebook !
with open('./CupSongsCovers.ipynb','r') as f:
    lines = f.readlines()

files = [re.search("VideoFileClip\((.*)\)", l) for l in lines]
files = [f.groups()[0][1:-1] for f in files if f is not None]
names = [os.path.splitext(os.path.basename(f))[0] for f in files]
print ', '.join(names)
xkaraxmusicx, DrewMannMusic, taliajoy18, hoorahjencar, hoosierfamily, salvadorzepeda68, NicoleKim, Anna Burden, MaliaRogersMusic, Halie Ranee, eveecooper, theaterobsession101, Faraz Sabir, amyspants, Miriam Carone, Kristina G, Irene Poon, MuggleSam, PS22 Chorus, Jasper Tan, McKenna Shae, rainbelle99, patmartel100, gimmiebeanstheband, SMCdramaclub , AllSheKnows, HarvardTHUD, RSNmusik, Lulapinga, Ally Turner, Daiyan Trisha, Sita Lizzie, Jocelyne Van Den Meersche, amandayanggg, Camp Kulin, Satrina Lord, stephulahoops, katrinamelody, Genesee Noelani, Hannah Elless, Marjorie Reboul, Thomas Graff, Camshie Tejada, RaRaRileyStraw, Kira Pleska and Mackenzie Ziegler, Rachel Nheu, Ankadiov Subran, David Wong, Laura Mew, clANAnett, Katie Floyd, AllyyyPaige, Camryn Harder, Richard Beilfuss, Scott Slay, lizzieejudee, Nicole Zhang, Andrew Foy, Jenni Saslove, Brie Monetti, Jenna Lynn, Tiffany Cicio
In [32]:
D=1.72

txt_end = (TextClip("Original Cup Song written by\n"
                 "Lulu and the Lampshades",
                fontsize=30, interline=15,
                bg_color='black',
         font="Ubuntu-Regular",
         size=(W,H), color = 'white')
         .set_pos(('center', 'center'))
         .set_duration(3)
         .fadein(1)
         .fadeout(1)
         .fx(vfx.freeze_at_start, 1))

txt0 = (TextClip("Youtubers by order\nof appearance:",
                fontsize=30, interline=15,
                bg_color='black',
         font="Ubuntu-Regular",
         size=(W,H), color = 'white')
         .set_duration(3)
         .fadein(1)
         .fadeout(1)
         .fx(vfx.freeze_at_start, 1))

txts = [TextClip("\n".join(nn),
         fontsize=30,
         font="Ubuntu-Regular",
         color = 'white', interline=9)
         .set_pos(('center', 'center'))
         .fadein(.3)
         .set_start(D*(i))
         .set_duration(D)
         .fadeout(.3)
        for i,nn in enumerate(chunks(names,7))]
In [33]:
W2 = 2*W/7
end_time=19
andrew_foy_p = (andrew_foy
                .resize(width=W2)
                .margin(1, color=3*[255])
                .margin(left=10, bottom=10, opacity=0)
                .set_pos(('left','bottom'))
                .subclip(23)
                .volumex(.6)
                .audio_fadein(1)
                .audio_fadeout(1))

brie_monetti_p = (brie_monetti
                  .crop(y2=300, x2=-150)
                  .resize(width=W2)
                  .margin(1, color=3*[255])
                  .margin(right=10, top=10, opacity=0)
                  .set_pos(('right','top'))
                  .subclip(47, 52)
                  .audio_fadein(.1))
                  
jenni_saslove_p = (jenni_saslove
                   .resize(width=W2)
                   .margin(1, color=3*[255])
                   .margin(left=10, top=10, opacity=0)
                   .set_pos(('left','top'))
                   .subclip(24.5, 27.3)
                   .audio_fadein(.3))

jenna_lynn_p = (jenna_lynn.subclip(30.45, 34.5)
                .resize(width=W2)
                .margin(1, color=3*[255])
                .margin(right=10, bottom=10, opacity=0)
                .set_pos(('right','bottom'))
                .audio_fadein(.1))

tiffany_p = (tiffany.subclip(40.5)
             .resize(width=W2)
             .margin(1, color=3*[255])
             .margin(left=10, top=10, opacity=0)
             .set_pos(('left','top'))
             .audio_fadein(.2)
             .volumex(.5)
             .audio_fadein(.5)
             .audio_fadeout(1))


af_start = 0
bm_start = af_start + 1
js_start = af_start  + 5.3
mar_start = af_start + 3
kf_start = af_start + 8.8
tiff_start = af_start  + 12.6
jl_start = af_start + 15.85
scott_start = af_start + 23.5



credits = (CompositeVideoClip(txts+[
         andrew_foy_p.set_start(af_start),
         brie_monetti_p.set_start(bm_start),
         jenni_saslove_p.set_start(js_start),
         jenna_lynn_p.set_start(kf_start),
         tiffany_p.set_start(tiff_start)
         ],
        size= (W,H))
      .set_duration(17+af_start)
      .fadein(1)
      .fadeout(1)
      .audio_fadeout(1)
      .audio_fadeout(1))
In []:
len(names)
Out[]:
62
In []:
# made wit moviepy

mwm = ( ImageClip('logo_white.png')
      .resize(width=0.6*W)
      .on_color(size= [W,H], pos=('center',H/5)))

mwm_audio = (AudioFileClip("./cupspiano.wav")
             .subclip(.2)
             .audio_fadein(.5)
             .audio_fadeout(.5))

grenoble = (TextClip("Grenoble, 2014",fontsize=25,
                     font="Amiri-Regular", color='gray')
         .margin(right=20, bottom=10, opacity=0)
         .set_pos(('right', 'bottom')))

mwm_grenoble = (CompositeVideoClip([mwm, grenoble])
                    .set_audio(mwm_audio)
                    .set_duration(mwm_audio.duration)
                    .fadein(1).fadeout(1))


credits_and_end = concatenate([txt_end, txt0,
                               credits,
                               mwm_grenoble])


#credits_and_end.to_videofile('testend.mp4', fps=25)
In []:
until_end = concatenate([until_last_chorus,
                         credits_and_end])

until_end.to_videofile("Cup_Song_Covers_Mix.mp4",
                       fps=25, bitrate="10000k",
                       audio_bitrate='500k')