这个代码的说明和视频演示见视频
Bilibili视频演示
from moviepy.editor import *
SourcePath = "E:\Lecture\Linear Algebra\Work\2 矩阵及其运算\2.3 逆矩阵(闭环管理阶段)"
FileList = []
FileName = []
for a, b, c in os.walk(SourcePath):
for name in c:
fname = os.path.join(a, name)
if fname.endswith(".mp4"):
FileList.append(fname)
FileName.append(name)
print(FileList)
print(FileName)
for i in range(len(FileList)):
clip = VideoFileClip(FileList[i])
clip = clip.resize((1280, 720))
OutputName = os.path.join(SourcePath, FileName[i][:-4]+'_small.mp4')
clip.write_videofile(OutputName, bitrate='2500000', threads=1)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)