在VideoFileClip函数中获取“OSError:[WinError 6]句柄无效”
我正在使用python通过导入moviepy库创建一个程序,但收到以下错误:
from moviepy.editor import VideoFileClip white_output = 'videos/testVideo.mp4'
clip1 = VideoFileClip("videos/testVideo.mp4") OSError Traceback (most recent call last)
<ipython-input-40-f49638833528> in <module>()
1 white_output = 'videos/testVideo.mp4'
----> 2 clip1 = VideoFileClip("videos/testVideo.mp4")
3 white_clip = clip1.fl_image(process_image) #NOTE: this function expects color images!!
4 get_ipython().magic('time white_clip.write_videofile(white_output, audio=False)') C:\Users\hp pc\Anaconda3\envs\lib\site-packages\moviepy\video\io\VideoFileClip.py in __init__(self, filename, has_mask, audio, audio_buffersize, audio_fps, audio_nbytes, verbose)
53 # Make a reader
54 pix_fmt= "rgba" if has_mask else "rgb24"
---> 55 reader = FFMPEG_VideoReader(filename, pix_fmt=pix_fmt)
56 self.reader = reader
57 # Make some of the reader's attributes accessible from the clip C:\Users\hp pc\Anaconda3\envs\lib\site-packages\moviepy\video\io\ffmpeg_reader.py in __init__(self, filename, print_infos, bufsize, pix_fmt, check_duration)
30
31 self.filename = filename
---> 32 infos = ffmpeg_parse_infos(filename, print_infos, check_duration)
33 self.fps = infos['video_fps']
34 self.size = infos['video_size'] C:\Users\hp pc\Anaconda3\envs\lib\site-packages\moviepy\video\io\ffmpeg_reader.py in ffmpeg_parse_infos(filename, print_infos, check_duration)
236 popen_params["creationflags"] = 0x08000000
237
--> 238 proc = sp.Popen(cmd, **popen_params)
239
240 proc.stdout.readline() C:\Users\hp pc\Anaconda3\envs\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds)
840 pass_fds=()):
841 """Create new Popen instance."""
--> 842 _cleanup()
843 # Held while anything is calling waitpid before returncode has been
844 # updated to prevent clobbering returncode if wait() or poll() are C:\Users\hp pc\Anaconda3\envs\lib\subprocess.py in _cleanup()
503 def _cleanup():
504 for inst in _active[:]:
--> 505 res = inst._internal_poll(_deadstate=sys.maxsize)
506 if res is not None:
507 try: C:\Users\hp pc\Anaconda3\envs\lib\subprocess.py in _internal_poll(self, _deadstate, _WaitForSingleObject, _WAIT_OBJECT_0, _GetExitCodeProcess)
1257 """
1258 if self.returncode is None:
-> 1259 if _WaitForSingleObject(self._handle, 0) == _WAIT_OBJECT_0:
1260 self.returncode = _GetExitCodeProcess(self._handle)
1261 return self.returncode OSError: [WinError 6] The handle is invalid
我通过运行以下命令解决了这个问题。
video_clip.reader.close()
video_clip.audio.reader.close_proc()
某种程度上python.exe是失败的,因为内部函数比如VideoFileClip在jupyter-notebook中报错。
然后我关闭了所有东西并重新启动了,错误消失了,现在它正常工作。
链接来源:
http://www.voidcn.com/article/p-orifxkfo-btn.html
在VideoFileClip函数中获取“OSError:[WinError 6]句柄无效”的更多相关文章
- selenium 问题:OSError: [WinError 6] 句柄无效
问题: 执行多个用例的时候,会抛出异常: File "xxxxxx.py", line 16, in get_driver driver = webdriver.Chrome(ex ...
- 【Selenium + Python】之OSError: [WinError 6] 句柄无效。
问题描述:执行多个用例的时候,会抛出异常: Traceback (most recent call last): File "F:\Demo\pomGisStu\gis\test_case\ ...
- 在被调用函数中获取资源及C++中的引用
#include <iostream> using namespace std; struct Teacher{ char name[64]; int age; }; //在被调用函数 获 ...
- 组件Slate教程 & UMG widget构造初始化函数中获取其内部组件
转自:http://aigo.iteye.com/blog/2296218 目的:在自定义的Widget初始化完毕后,获取其内部的button.combo等UMG组件的C++指针. 这里我们新建了一个 ...
- vue 钩子函数中获取不到DOM节点
原文链接:https://jingyan.baidu.com/article/f96699bbfe9c9d894f3c1b4b.html 两种解决方案: 1:官方解决方案: 受到 HTML 本身的一些 ...
- AngularJs在ng-click函数中获取代表当前元素的DOM对象
html代码 <div ng-click="test($event)">111</div> Controllers.js $scope.test= func ...
- Android在OnCreate中获取控件的宽度和高度
在Android中,有时需要对控件进行测量,得到的控件宽度和高度可以用来做一些计算.在需要自适应屏幕的情况下,这种计算就显得特别重要.另一方便,由于需求的原因,希望一进入界面后,就能得到控件的宽度和高 ...
- 使用python读取配置文件并从mysql数据库中获取数据进行传参(基于Httprunner)
最近在使用httprunner进行接口测试,在传参时,用到了三种方法:(1)从csv文件中获取:(2)在config中声名然后进行引用:(3)从函数中获取.在测试过程中,往往有些参数是需要从数据库中获 ...
- SQL Server 中获取字符串拼音的标量函数实现
工作中时常遇到字符串转换为拼音的需求.特别目前在各大网站平台都可以看到的基于拼音的查询功能.如果在查询中增加相应的拼音查询,就可以减少很多的因中文汉字完全输入的不便利,例如:当我要查询叫”郭德 ...
随机推荐
- leetcode 排序问题
1.堆排序 //大顶堆的构造,传入的i是父节点 void HeapAdjust(int k[],int p,int n) { int i,temp; temp = k[p]; * p; i <= ...
- C语言中关于输出n个数后就换行的问题。
例如:n=10 ........; n++; if(n%10==0&&n!=0) //因为当n=0时,n%10的值也是0,就也会转行,为了防止这种情况的发生,就用了&&a ...
- POJ3104Drying(二分)
传送门 题目大意:n件衣服,每件有ai水分.每分钟可自然风干1个水分,或者放入机器中风干k个水分. 问最少花多长时间,衣服全干. 代码: #include<iostream> #inclu ...
- SVN版本更新自动通知提醒
当其他用户提交后,如何提示我及时更新代码或版本? 一般情况下,代码的更新时间节点在每天工作开始或有重大功能提交时,所以,不是所有人都对此功能有需求,最好的方式是使用客户端"SVN项目监视器& ...
- Codeforces Round #596 (Div. 2, based on Technocup 2020 Elimination Round 2) F. Tree Factory 构造题
F. Tree Factory Bytelandian Tree Factory produces trees for all kinds of industrial applications. Yo ...
- 怎么做web接口测试
这就需要开发提供的接口文档了,接口文档和功能测试的需求说明书的功能是一样的.包括:接口说明.调用的url,请求方式(get or post),请求参数.参数类型.请求参数说明,返回结果说明.有 ...
- vue.js过度&动画、混入&插件
1.vue 过度动画 1.过度 Vue 在插入.更新或者移除 DOM 时,提供多种不同方式的应用过渡效果.Vue 提供了内置的过渡封装组件,该组件用于包裹要实现过渡效果的组件. 语法格式: < ...
- 线代第六章定义&定理整理(持续更新中)
Chapter 6 6.1 Inner Products and Norms Definition (inner product). Let V be a vector space over F. A ...
- LuoguP5290 [十二省联考2019]春节十二响 | 启发式合并
还有33天就要高考了,我在干啥-- 题目概述 一棵有根树,每个节点有权值. 要求把所有节点分成组,具有祖先-后代关系的两个节点不能被分到同一组. 每一组的代价是所包含的节点的最大权值,最小化所有组的代 ...
- IDEA 日常小技巧
原文首发于 studyidea.cn点击查看更多技巧 适用于 IDEA 2019.2 之前版本 ,2019.2 版本以下功能默认开启. Surround a selection with a quot ...