|
|
至今单身的小蝌蚪 · UPDATE - Azure ...· 3 月前 · |
|
|
胡子拉碴的手术刀 · 武周王夫人長孫氏墓誌銘墨拓本 軸 - 故宮· 6 月前 · |
|
|
正直的椰子 · 将 ASP.NET MVC 与不同版本的 ...· 9 月前 · |
|
|
瘦瘦的人字拖 · 内网服务器离线编译安装mysql5.7并调优 ...· 11 月前 · |
|
|
性感的小蝌蚪 · 9位女书法家临《兰亭序》,谁写得最好?_百科TA说· 1 年前 · |
我有一个文件夹的视频,我想快进使用多个线程使用moviePy。如何动态地从文件夹中获取视频,而不是静态地给出它们的路径?这是我的代码:
导入操作系统
从nat排序导入
从线程导入线程
def fast(path,thread_name):
如果os.path.splitext(path)1 == '.mp4':#print(path(Path)) clip = (VideoFileClip(path).fx(vfx.speedx,5)) #print(Path) clip.to_videofile('G:/Ocsid Technologies/Video_1/‘+线程_name+ '.mp4',codec=’libx264 264‘)
't1')).start() =线程(target=fast,args=("G:/Ocsid Technologies/Video_1/sample1.mp4“)
t2 =线程(target=fast,args=(“G://Video_1/sample2.mp4”,‘t2’).start()
t3 =线程(target=fast,args=(“G://Video_1/sample3.mp4”,'t3‘).start()
t4 =线程(target=fast,args=(“G://Video_1/sample4.mp4”,'t4‘).start()
发布于 2022-03-07 17:36:51
您可以使用
glob.glob()
枚举文件,并使用
enumerate
获取线程名称的计数器。
import glob
# ...
for i, filename in enumerate(glob.glob("G:/Ocsid Technologies/Video_1/*.mp4"), 1):
thread_name = f"t{i}"
Thread(target=fast, args=(filename, thread_name)).start()
https://stackoverflow.com/questions/71385029
复制相似问题
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2023 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号: 粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287