def trim_the_video():
allowed_extensions = [".mp4", ".mov", ".webm"]
video_file_name = auto_complete_prompt(allowed_extensions, "video")
start_time = prompt("Start time for the video: ")
end_time = prompt("End time for the video: ")
file_name, extension = os.path.splitext(video_file_name)
if extension not in allowed_extensions:
print("The file you specified isn't supported at the moment.")
print("Exiting now.")
exit()
command = (
"ffmpeg -i {0} -r 24 -ss {1} -to {2} trimmed-{0}.mp4"
).format(video_file_name, start_time, end_time, video_file_name)
args = shlex.split(command)
with Halo(text="Generating preface video...", spinner='earth'):
subprocess.run(args)
return "trimmed-{0}.mp4".format(video_file_name)
评论列表
文章目录