Created
November 2, 2017 21:46
-
-
Save bryanjhsu/de6a5b10933873aa986d3f2575dd2679 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import moviepy.editor as mp | |
from moviepy.editor import * | |
import random | |
video = mp.VideoFileClip("clip1.mp4") | |
video2= mp.VideoFileClip("clip2.mp4") | |
audioclip = AudioFileClip("tattoo.m4a").cutout(0,7) | |
clips = [] | |
duration = 0.435 | |
for i in range(0,90): | |
start = random.uniform(0, video.duration-1) | |
end = start + duration | |
clip1 = video.subclip(start, end) | |
start = random.uniform(0, video2.duration-1) | |
end = start + duration | |
clip2 = video2.subclip(start, end) | |
clips.append(clip1) | |
clips.append(clip2) | |
random.shuffle(clips) | |
composition = mp.concatenate(clips) | |
compositionMusic = composition.set_audio(audioclip) | |
compositionMusic.write_videofile("juxtapose.mp4", fps=30) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment