import os.path
from moviepy.editor import VideoFileClip
from tqdm import tqdm
def get_file_names(path):
return [os.path.join(path, f) for f in os.listdir(path) if f.endswith('.mp4')]
def run(path):
l = get_file_names(path)
for f in tqdm(l):
clip = VideoFileClip(f)
#计算视频的时长,单位为分钟
len_time=round(clip.duration / 60, 0)
if int(len_time)>=15:
print(f)
clip.close()
if __name__ == '__main__':
path="D:\\b"
run(path)
标签:__,tqdm,批量,clip,python,某时长,import,path,os From: https://www.cnblogs.com/xianzhewujie/p/16753298.html