1

在我的 macOS v 10.11.6 上,我在 jupyter notebook Python v 3.5.2 Conda v 4.3.8 Jupyter 4.2.1 上运行 moviepy 时出错

我正在导入并运行一个简单的单元格:

from moviepy.editor import VideoFileClip
from IPython.display import HTML

new_clip_output = 'test_output.mp4'
test_clip = VideoFileClip("test.mp4")
new_clip = test_clip.fl_image(lambda x: cv2.cvtColor(x, cv2.COLOR_RGB2YUV)) #NOTE: this function expects color images!!
%time new_clip.write_videofile(new_clip_output, audio=False)

错误是:

TypeError                                 Traceback (most recent call last)
<ipython-input-8-27aee53c99d8> in <module>()
1 new_clip_output = 'test_output.mp4'
--> 2 test_clip = VideoFileClip("test.mp4")
3 new_clip = test_clip.fl_image(lambda x: cv2.cvtColor(x, cv2.COLOR_RGB2YUV)) #NOTE: this function expects color images!!
4 get_ipython().magic('time new_clip.write_videofile(new_clip_output, audio=False)')
/Users/<username>/anaconda3/envs/carnd-term1/lib/python3.5/site-packages/moviepy/video/io/VideoFileClip.py in __init__(self, filename, has_mask, audio, audio_buffersize, audio_fps, audio_nbytes, verbose)
80                                        buffersize= audio_buffersize,
81                                        fps = audio_fps,
--> 82                                        nbytes = audio_nbytes)
83 
84     def __del__(self):
/Users/<username>/anaconda3/envs/carnd-term1/lib/python3.5/site-packages/moviepy/audio/io/AudioFileClip.py in __init__(self, filename, buffersize, nbytes, fps)
61         self.filename = filename
62         reader = FFMPEG_AudioReader(filename,fps=fps,nbytes=nbytes,
--> 63                                          buffersize=buffersize)
64 
65         self.reader = reader
/Users/<username>/anaconda3/envs/carnd-term1/lib/python3.5/site-packages/moviepy/audio/io/readers.py in __init__(self, filename, buffersize, print_infos, fps, nbytes, nchannels)
68         self.buffer_startframe = 1
69         self.initialize()
--> 70         self.buffer_around(1)
71 
72
/Users/<username>/anaconda3/envs/carnd-term1/lib/python3.5/site-packages/moviepy/audio/io/readers.py in buffer_around(self, framenumber)
232         else:
233             self.seek(new_bufferstart)
--> 234             self.buffer =  self.read_chunk(self.buffersize)
235 
236         self.buffer_startframe = new_bufferstart
/Users/<username>/anaconda3/envs/carnd-term1/lib/python3.5/site-packages/moviepy/audio/io/readers.py in read_chunk(self, chunksize)
121         result = (1.0*result / 2**(8*self.nbytes-1)).\
122                                  reshape((len(result)/self.nchannels,
--> 123                                           self.nchannels))
124         #self.proc.stdout.flush()
125         self.pos = self.pos+chunksize

TypeError: 'float' object cannot be interpreted as an integer

是不是因为各种库的版本有冲突?

4

0 回答 0