![]() |
含蓄的绿茶 · python ...· 1 周前 · |
![]() |
忧郁的皮带 · python之subprocess.Pope ...· 1 周前 · |
![]() |
神勇威武的夕阳 · Python笔记:c++内嵌python,c ...· 1 周前 · |
![]() |
乖乖的香菜 · Python根据条件更改DataFrame中 ...· 6 天前 · |
![]() |
博学的枇杷 · 基于概率建模的多维时间序列的异常检测 - ...· 8 月前 · |
![]() |
直爽的红烧肉 · 央企数字化转型实践思考-CSDN博客· 1 年前 · |
![]() |
冷冷的四季豆 · PORWESHELL問題 - iT ...· 1 年前 · |
![]() |
胆小的排球 · 使用CSS实现两列布局_css两行两列的布局 ...· 1 年前 · |
![]() |
想出国的饼干 · VMware vSphere ...· 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