在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 中获取字符串拼音的标量函数实现
工作中时常遇到字符串转换为拼音的需求.特别目前在各大网站平台都可以看到的基于拼音的查询功能.如果在查询中增加相应的拼音查询,就可以减少很多的因中文汉字完全输入的不便利,例如:当我要查询叫”郭德 ...
随机推荐
- Linux—各种重要配置文件详解
一./etc/profile文件详解(环境变量) 添加环境变量 .编辑profile文件 [root@localhost ~]# vi /etc/profile .在profile文件中添加如下内容 ...
- Tomcat下载教程
首先确定你Windows系统是64位,还是32位(现在大部分是64位) 查看操作系统位数步骤:(WindowsXP,Windows7,Windows8,Windows10查看步骤大同小异,举例Wind ...
- CodeForces - 1236B (简单组合数学)
题意 有n种物品和m个背包,每种物品有无限个,现将若干个物品放到这些背包中,满足: 1.每个背包里不能出现相同种类的物品(允许有空背包): 2.在所有的m个背包中,每种物品都出现过. 求方案数,对10 ...
- 提升ML.NET模型的准确性
ML.NET是一个面向.NET开发人员的开源.跨平台的机器学习框架. 使用ML.NET,您可以轻松地为诸如情绪分析.价格预测.销售分析.推荐.图像分类等场景构建自定义机器学习模型. ML.NET从0. ...
- AWVS破解安装
参考大佬@pirogue的安装步骤及awvs安装包,@pandahks的安装依赖,在本地虚拟机安装awvs,艰辛历程记录如下. 虚拟机操作系统:CentOS Linux release 7.7.190 ...
- 3. Go语言—函数和常量
一.函数声明和注释 1. 声明 func 函数名 (参数列表)(返回值列表){} func add{ pass } func add(a int, b int){ } func add(a int ...
- Html学习之十二(CSS选择器的应用二)
<!doctype html> <html> <head> <meta charset="utf-8"> <title> ...
- win10,anconda, python3.6安装dlib19.17
目的和经验: 几个月前在笔记本上安过一次,按着教程用cmake编译其实也蛮简单的,不过当初忘了收藏了.现在换了台机子需要重新安装一遍,奈何之前的帖子找不到了. pypi 网站上有19.8.whl,如果 ...
- 浅谈C++ STL deque 容器
浅谈C++ STL deque 容器 本篇随笔简单介绍一下\(C++STL\)中\(deque\)容器的使用方法及常见使用技巧. deque容器的概念 \(deque\)的意义是:双端队列.队列是我们 ...
- 【oracle】update