當前位置: 首頁>>代碼示例>>Python>>正文


Python VideoFileClip.without_audio方法代碼示例

本文整理匯總了Python中moviepy.editor.VideoFileClip.without_audio方法的典型用法代碼示例。如果您正苦於以下問題:Python VideoFileClip.without_audio方法的具體用法?Python VideoFileClip.without_audio怎麽用?Python VideoFileClip.without_audio使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在moviepy.editor.VideoFileClip的用法示例。


在下文中一共展示了VideoFileClip.without_audio方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get_previous_bests_vid

# 需要導入模塊: from moviepy.editor import VideoFileClip [as 別名]
# 或者: from moviepy.editor.VideoFileClip import without_audio [as 別名]
    def get_previous_bests_vid(self, option, currloc):
        dpoint = None
        dpointvidfldr = None

        sys.stdout.write("Searching for previous intervals best vine...\n")
        for prev_date in self.PREV_DATES:
            vidfolderloc = os.path.join(SECTIONS_PATH, option, 'videos', \
                                                                str(prev_date))
            datafolderloc = os.path.join(SECTIONS_PATH, option, 'data', \
                                                                str(prev_date))
         
            for _, _, filenames in os.walk(datafolderloc):
                for idx, item in enumerate(filenames):
                    with open(os.path.join(datafolderloc, item)) as json_file:
                        json_data = json.load(json_file)
         
                    clip = VideoFileClip(os.path.join(vidfolderloc, \
                                          str(json_data["postId"]) + ".mp4"))

                    if clip.duration > 5:
                        if not dpoint:
                            dpoint = json_data
                            dpointvidfldr = vidfolderloc
                        elif dpoint["loops"]["count"] < json_data["loops"]\
                                                                    ["count"]:
                            dpoint = json_data
                            dpointvidfldr = vidfolderloc
                    elif not dpoint and idx == len(filenames) - 1:
                        dpoint = json_data
                        dpointvidfldr = vidfolderloc
     
        vidfile = os.path.join(dpointvidfldr, str(dpoint["postId"]) + ".mp4")
        sys.stdout.write("Adding previous best vid: %s\n" % vidfile)
        clip = (VideoFileClip(vidfile).resize((1070, 640)).\
                                    set_start(currloc + 6).crossfadein(1).\
                                    set_position((450, 255)).set_duration(5))
         
        return clip.without_audio()
開發者ID:LumbaJack,項目名稱:Vine-Compilation-Bot,代碼行數:40,代碼來源:makevideo_helper.py


注:本文中的moviepy.editor.VideoFileClip.without_audio方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。