Created
April 4, 2019 05:25
-
-
Save bakirillov/d16040fe74066fe63b8f61fddbf1dfeb to your computer and use it in GitHub Desktop.
Script to cut subclip from a video via Moviepy
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 argparse | |
from moviepy.editor import * | |
if __name__ == "__main__": | |
parser = argparse.ArgumentParser(description="Cut parts of video clip") | |
parser.add_argument( | |
"source", | |
metavar="Source", | |
help="Input filename" | |
) | |
parser.add_argument( | |
"start", | |
metavar="Start", | |
help="First second" | |
) | |
parser.add_argument( | |
"finish", | |
metavar="Finist", | |
help="Last second" | |
) | |
parser.add_argument( | |
"output", | |
metavar="Output", | |
help="Output filename" | |
) | |
args = parser.parse_args() | |
src = VideoFileClip(args.source) | |
cut = src.subclip(float(args.start), float(args.finish)) | |
cut.write_videofile(args.output,fps=24,codec='libx264') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment