Created
May 8, 2022 02:51
-
-
Save cjacobwade/533e95b5ad257c45b4a34d538b789ae9 to your computer and use it in GitHub Desktop.
Python script to cut a video into 10 second skips and 0.5 seconds of gameplay
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 sys | |
from moviepy.editor import * | |
print(sys.argv) | |
skipTime = float(sys.argv[1]) | |
videoTime = float(sys.argv[2]) | |
inputName = sys.argv[3] | |
video = VideoFileClip(inputName) | |
subclips = [] | |
numCuts = video.duration / (skipTime + videoTime) | |
i = 0 | |
while i < numCuts: | |
startTime = float((skipTime + videoTime) * i) | |
clip = video.subclip(startTime, startTime + videoTime) | |
subclips.append(clip) | |
i += 1 | |
finalVideo = concatenate_videoclips(subclips) | |
outputName = inputName.replace(".mp4", "_Shortplay.mp4") | |
finalVideo.write_videofile(outputName) | |
print("Success") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment