Skip to content

Instantly share code, notes, and snippets.

@gyglim
Last active March 14, 2017 10:29
Show Gist options
  • Save gyglim/c686ac4e09a178fe542dcbf2c14c8d17 to your computer and use it in GitHub Desktop.
Save gyglim/c686ac4e09a178fe542dcbf2c14c8d17 to your computer and use it in GitHub Desktop.
from moviepy.editor import VideoFileClip
import cv2
size= (128, 128)
video_file='/home/gyglim/scratch_gygli/gifscom/shot_detection/debug_videos/UEoUURJ1Dck.mp4'
v1 = VideoFileClip(video_file, target_resolution=size, resize_algorithm='bilinear').subclip(0, 60)
def read_resized():
for f in v1.iter_frames():
pass
v2 = VideoFileClip(video_file).subclip(0, 60)
def read_and_resize_cv2():
for f in v2.iter_frames():
f2=cv2.resize(f, size, interpolation=cv2.INTER_LINEAR)
v3 = VideoFileClip(video_file).subclip(0, 60).resize(size)
def read_and_resize_moviepy():
for f in v3.iter_frames():
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment