common.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:meetup-utilities 作者: igauravsehrawat 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号