Skip to content

Instantly share code, notes, and snippets.

@elbruno
Created May 26, 2021 13:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elbruno/11d66bb4054fe644d8caf509fb4f752a to your computer and use it in GitHub Desktop.
Save elbruno/11d66bb4054fe644d8caf509fb4f752a to your computer and use it in GitHub Desktop.
moviepyconcatenateandblur.py
from moviepy.video.compositing.concatenate import concatenate_videoclips
from skimage.filters import gaussian
from moviepy.editor import VideoFileClip, clips_array, concatenate_videoclips
def blur(image):
""" Returns a blurred (radius=4 pixels) version of the image """
return gaussian(image.astype(float), sigma=4)
# open video and resize to 460
clip1 = VideoFileClip("cat1.mp4").subclip(1,2).resize(width=200)
clip2 = VideoFileClip("cat1.mp4").subclip(2,4).resize(width=200)
clip3 = VideoFileClip("cat1.mp4").subclip(4,6).resize(width=200)
# blur clip 2
clip2_blurred = clip2.fl_image( blur )
# final
final_clip = concatenate_videoclips([clip1, clip2_blurred, clip3])
final_clip.write_gif("blurdemo.gif")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment