You will want to Enable JavaScript while exploring this website.

Because most of the projects I create are interactive, JavaScript is essential for experiencing my work.

Automating Video


My final project is a black and white video maker. You can give the script a youtube video url and the video's name, and a black and white version of the video is created, announced on my Facebook page, and uploaded to Vimeo.

import moviepy.editor as mp import moviepy.video.fx as sfx from moviepy.editor import VideoFileClip from moviepy.editor import * import facebook import vimeo import pytube from pytube import YouTube videoFile = raw_input("Video Url: ") videoYoutubeName = raw_input("What's the name of the video?: ") yt = YouTube(videoFile) yt.url = videoFile YouTube(videoFile).streams.first().download() yt.filename = videoYoutubeName the_video_url = yt.filename+'.mp4' print the_video_url access_token = "EAACEdEose0cBALkFOYEzADHe9pCbrMdD0TkvZCFhUTjbVOTZBJmaRZCVkLkQ8AfLmXzqZAuwR3lHFPkw8O3HySh97VacI6Jq1YC2k6hTNzj31KQkCRk6LbpcQEBqUzNZCi3mJAMZAP5sNNEZCmNuBCQSr22YpAjjCXuyze2C7LT48hu60HTfg4L0W77x9w3HovTRtdiDzUlvUQxPuIEfBKFAzRKNxx421wZD" #Background Music mainSong = mp.VideoFileClip("Maple.mp4") #print "audio song length: %d" % mainSong.duration mainSong_audio = mainSong.audio def makeBlackWhite(file): video = mp.VideoFileClip(file) #print "video before speed: %d" % video.duration video = sfx.all.blackwhite(video, RGB=[1, 1, 1], preserve_luminosity=True) #black and white video = video.volumex(0) video = sfx.all.speedx(video, factor=3) video = video.resize((720, 480)) #print "video after speed: %d" % video.duration video = sfx.all.fadein(video, 5, initial_color=None) video = sfx.all.fadeout(video, 5, final_color=None) video = sfx.all.lum_contrast(video, lum=0.8, contrast=8, contrast_thr=70) #video = sfx.all.loop(video, n=3, duration=None) return video final = makeBlackWhite(the_video_url) l = final.duration final = final.set_audio(mainSong_audio) final = final.subclip(0, l) print "final length: %d seconds" % final.duration videoName = raw_input("New Video Name: ") videoName = videoName+".mp4" final.write_videofile(videoName, codec="mpeg4") ##################### Vimeo and Facebook ###################### YOUR_ACCESS_TOKEN = "48e98140a0ef419449083510b0fa529d" YOUR_CLIENT_ID = "46cfbb727b8d146207ce1c730de8c303150ff170" YOUR_CLIENT_SECRET = "lpgrofuiSCmnVUGIB/qwPTZXxzdgSCkIprrpG6NAES75F/8T9OYPS0WOfGMdwH97hsD1ixQJOga+4yBbLCQ63RcUpaWu4Du5U971kk6V/bWpuzcU2pWq6louYti3jLp1" #Upload to Vimeo v = vimeo.VimeoClient(token=YOUR_ACCESS_TOKEN,key=YOUR_CLIENT_ID,secret=YOUR_CLIENT_SECRET) # Make the request to the server for the "/me" endpoint. about_me = v.get('/me') vimeo_authorization_url = v.auth_url(YOUR_CLIENT_ID, ['public', 'private', 'interact', 'upload'], 'https://api.vimeo.com/oauth/authorize') video_url = v.upload(videoName) v.patch(video_url, data={'name': 'Black and White Video', 'description': 'Another black and white video... Tada!'}) #Upload to facebook graph = facebook.GraphAPI(access_token) graph.put_object("me", "feed", message="I just made another video.", link="https://vimeo.com/user25868029") #graph.put_photo(image=open('img.jpg', 'rb'), message='Look at this cool photo!')

This is a short series of videos using an automated panning camera programmed in Python. Each video is randomly compiled and tells a different story using the same content. The music is written and performed by Gretchen Erlichman.

import random from random import shuffle import moviepy.editor as mp import moviepy.video.fx as sfx from moviepy.editor import VideoFileClip from moviepy.editor import * #Background Music mainSongOne_audio = AudioFileClip("Techno.wav") #Background Music mainSongTwo_audio = AudioFileClip("Missing.wav") #Background Music mainSongThree_audio = AudioFileClip("Revolution.wav") music = [] music.append(mainSongOne_audio) music.append(mainSongTwo_audio) music.append(mainSongThree_audio) randomFactor = random.randint(0, 3) randomFactorTwo = random.randint(1, 10) newFactor = randomFactor * randomFactorTwo newFactorTwo = newFactor + randomFactorTwo print "newFactor: ",newFactor print "newFactorTwo: ",newFactorTwo def getVideo(videoFile): video = mp.VideoFileClip(videoFile) video = video.resize((800, 450)) video = video.volumex(0) video = video.subclip(newFactor, newFactorTwo) video = sfx.all.blackwhite(video, RGB=[1, 1, 1], preserve_luminosity=True) #black and white return video #Hold the small clips clips = [] d = int(newFactorTwo) - int(newFactor) print "length of each clip: ",d #How many videos? numClips = raw_input("How many videos will you use?: ") #Add all of the clips for part one into the list for i in range(0, int(numClips)): myVideo = raw_input("Video: ") video = getVideo(myVideo) clips.append(video) #Combine the clips to make part one random.shuffle(clips) main = mp.concatenate(clips) #Add audio to partOne and partTwo main = main.set_audio(random.choice(music)) al = int(d) * int(numClips) print "duration seconds: ",int(al) main = main.subclip(0, int(al)) main.write_videofile("video.mp4")

This is my idea of what I would like to create with a surveillance camera controlled by Python. Shown is my sketch of a camera continuously panning as random clips and background music combine to create a final film.

This week I was able to get a surveillance camera, write a simple script, and control the camera with a continious pan. See the raw footage of one clip here.

This week, I created a video that shares a message about the earth using only a python script.

import moviepy.editor as mp from moviepy.editor import VideoFileClip #Background Music mainSong = mp.VideoFileClip("songs/colorsOfWind.mp4") mainSong_audio = mainSong.audio lavaSong = mp.VideoFileClip("songs/Lava.mp4") #This has everything in the song lavaSong_audio = lavaSong.audio #Part One Videos ******************************* nature_video1 = mp.VideoFileClip("Nature1.mp4") nature_video1 = nature_video1.resize((1280, 720)) nature_video1 = nature_video1.volumex(0) p1_clip1 = nature_video1.subclip(0, 10) nature_video2 = mp.VideoFileClip("Nature2.mp4") nature_video2 = nature_video2.resize((1280, 720)) nature_video2 = nature_video2.volumex(0) p1_clip2 = nature_video2.subclip(0, 10) mine = mp.VideoFileClip("Mine.mp4") mine = mine.resize((1280, 720)) mine = mine.volumex(0) p1_clip3 = mine.subclip(85, 95) backhoe = mp.VideoFileClip("backho.mp4") backhoe = backhoe.resize((1280, 720)) backhoe = backhoe.volumex(0) p1_clip4 = backhoe.subclip(0, 10) clearing = mp.VideoFileClip("clearing.mp4") clearing = clearing.resize((1280, 720)) clearing = clearing.volumex(0) p1_clip5 = clearing.subclip(0, 10) homeOne = mp.VideoFileClip("homeBuilt.mp4") homeOne = homeOne.resize((1280, 720)) homeOne = homeOne.volumex(0) p1_clip6 = homeOne.subclip(0, 10) homeTwo = mp.VideoFileClip("KBHome.mp4") homeTwo = homeTwo.resize((1280, 720)) homeTwo = homeTwo.volumex(0) p1_clip7 = homeTwo.subclip(20, 30) animals = mp.VideoFileClip("animalsHit.mp4") animals = animals.resize((1280, 720)) animals = animals.volumex(0) p1_clip8 = animals.subclip(102, 112) pollute = mp.VideoFileClip("pollution.mp4") pollute = pollute.resize((1280, 720)) pollute = pollute.volumex(0) p1_clip9 = pollute.subclip(376, 386) #Part One Videos ******************************* jason = mp.VideoFileClip("jason.mp4") jason = jason.resize((1280, 720)) jason = jason.volumex(0) p2_clip1 = jason.subclip(27, 37) godzilla = mp.VideoFileClip("godzilla.mp4") godzilla = godzilla.resize((1280, 720)) godzilla = godzilla.volumex(0) p2_clip2 = godzilla.subclip(0, 10) bugs = mp.VideoFileClip("BugsBunny.mp4") bugs = bugs.resize((1280, 720)) bugs = bugs.volumex(0) p2_clip3 = bugs.subclip(0, 10) daysLater = mp.VideoFileClip("28DaysLater.mp4") daysLater = daysLater.resize((1280, 720)) daysLater = daysLater.volumex(0) p2_clip4 = daysLater.subclip(59, 69) follows = mp.VideoFileClip("itFollows.mp4") follows = follows.resize((1280, 720)) follows = follows.volumex(0) p2_clip5 = follows.subclip(45, 55) #Hold the small clips of part one and part two clips_part1 = [] clips_part2 = [] #Add all of the clips for part one into the list #for i in range(1, 9): clips_part1.append(p1_clip1) clips_part1.append(p1_clip2) clips_part1.append(p1_clip3) clips_part1.append(p1_clip4) clips_part1.append(p1_clip5) clips_part1.append(p1_clip6) clips_part1.append(p1_clip7) clips_part1.append(p1_clip8) clips_part1.append(p1_clip9) #Combine the clips to make part one partOne = mp.concatenate(clips_part1) #Add all of the clips for part two into the list #for i in range(1, 5): clips_part2.append(p2_clip1) clips_part2.append(p2_clip2) clips_part2.append(p2_clip3) clips_part2.append(p2_clip4) clips_part2.append(p2_clip5) #Combine the clips to make part one partTwo = mp.concatenate(clips_part2) #Add audio to partOne and partTwo partOne = partOne.set_audio(mainSong_audio) partTwo = partTwo.set_audio(lavaSong_audio) partOne = partOne.subclip(0, 90) #90 seconds partTwo = partTwo.subclip(0, 50) finalClips = [partOne, partTwo] composition = mp.concatenate(finalClips) composition = composition.subclip(0, 140) #140 seconds composition.write_videofile("final_projectOne.mp4")

Designed and developed by Steven Simon 2018