Created
July 25, 2019 15:50
-
-
Save raymondberg/ded30fa7d01f0de8ddbb00c37ccbacdc to your computer and use it in GitHub Desktop.
Extract clips from videos
This file contains hidden or 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 os | |
from moviepy.video.io.ffmpeg_tools import ffmpeg_extract_subclip | |
OUTPUT_DIRECTORY = 'done' | |
clips = [ | |
{'output': 'baby_peek_a_boo.mp4', 'input': 'baby_peek_a_boo.mp4', 'start': 0, 'end': 23}, | |
{'output': 'tickle_me_elmo.mp4', 'input': 'tickle_me_elmo.mp4', 'start': 39, 'end': 74}, | |
//... As many clips as you need | |
{'output': 'slapstick.mp4', 'input': 'slapstick.mp4', 'start': 6, 'end': 91}, | |
] | |
for clip in clips: | |
ffmpeg_extract_subclip( | |
clip['input'], | |
clip['start'], | |
clip['end'], | |
targetname=os.path.join(OUTPUT_DIRECTORY, clip['output']), | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment