myclip.write_videofile("movie.webm",audio=False) TypeError: must be real number, not NoneType
See original GitHub issueExpected Behavior
File should be saved without the error
Actual Behavior
chunk: 0%| | 0/152 [00:00<?, ?it/s, now=None] Moviepy - Building video movie.webm. MoviePy - Writing audio in movieTEMP_MPY_wvf_snd.ogg
MoviePy - Done. Moviepy - Writing video movie.webm
TypeError Traceback (most recent call last) <ipython-input-22-dd7c1f8ed18c> in <module> ----> 1 myclip.write_videofile(“movie.webm”,audio=False)
~\anaconda3\envs\deep-music-visualizer\lib\site-packages\decorator.py in fun(*args, **kw) 230 if not kwsyntax: 231 args, kw = fix(args, kw, sig) –> 232 return caller(func, *(extras + args), **kw) 233 fun.name = func.name 234 fun.doc = func.doc
~\anaconda3\envs\deep-music-visualizer\lib\site-packages\moviepy\decorators.py in requires_duration(f, clip, *a, **k) 52 raise ValueError(“Attribute ‘duration’ not set”) 53 else: —> 54 return f(clip, *a, **k) 55 56
~\anaconda3\envs\deep-music-visualizer\lib\site-packages\decorator.py in fun(*args, **kw) 230 if not kwsyntax: 231 args, kw = fix(args, kw, sig) –> 232 return caller(func, *(extras + args), **kw) 233 fun.name = func.name 234 fun.doc = func.doc
~\anaconda3\envs\deep-music-visualizer\lib\site-packages\moviepy\decorators.py in use_clip_fps_by_default(f, clip, *a, **k) 133 for (k,v) in k.items()} 134 –> 135 return f(clip, *new_a, **new_kw)
~\anaconda3\envs\deep-music-visualizer\lib\site-packages\decorator.py in fun(*args, **kw) 230 if not kwsyntax: 231 args, kw = fix(args, kw, sig) –> 232 return caller(func, *(extras + args), **kw) 233 fun.name = func.name 234 fun.doc = func.doc
~\anaconda3\envs\deep-music-visualizer\lib\site-packages\moviepy\decorators.py in convert_masks_to_RGB(f, clip, *a, **k) 20 if clip.ismask: 21 clip = clip.to_RGB() —> 22 return f(clip, *a, **k) 23 24 @decorator.decorator
~\anaconda3\envs\deep-music-visualizer\lib\site-packages\moviepy\video\VideoClip.py in write_videofile(self, filename, fps, codec, bitrate, audio, audio_fps, preset, audio_nbytes, audio_codec, audio_bitrate, audio_bufsize, temp_audiofile, rewrite_audio, remove_temp, write_logfile, verbose, threads, ffmpeg_params, logger) 305 verbose=verbose, threads=threads, 306 ffmpeg_params=ffmpeg_params, –> 307 logger=logger) 308 309 if remove_temp and make_audio:
~\anaconda3\envs\deep-music-visualizer\lib\site-packages\moviepy\video\io\ffmpeg_writer.py in ffmpeg_write_video(clip, filename, fps, codec, bitrate, preset, withmask, write_logfile, audiofile, verbose, threads, ffmpeg_params, logger) 214 preset=preset, bitrate=bitrate, logfile=logfile, 215 audiofile=audiofile, threads=threads, –> 216 ffmpeg_params=ffmpeg_params) as writer: 217 218 nframes = int(clip.duration*fps)
~\anaconda3\envs\deep-music-visualizer\lib\site-packages\moviepy\video\io\ffmpeg_writer.py in init(self, filename, size, fps, codec, audiofile, preset, bitrate, withmask, logfile, threads, ffmpeg_params) 86 ‘-s’, ‘%dx%d’ % (size[0], size[1]), 87 ‘-pix_fmt’, ‘rgba’ if withmask else ‘rgb24’, —> 88 ‘-r’, ‘%.02f’ % fps, 89 ‘-an’, ‘-i’, ‘-’ 90 ]
TypeError: must be real number, not NoneType
Steps to Reproduce the Problem
from moviepy.editor import VideoFileClip
myclip = VideoFileClip("D:\Captures\Zoom Meeting 2021-05-19 23-48-20.mp4")
myclip.write_videofile("movie.webm",audio=False)
Specifications
- Python Version: 3.7.10
- ffmpeg Version: 1.4
- imageio Version: 2.9.0
- Moviepy Version: 1.0.3
- Platform Name: Windows
- Platform Version: 10
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5
This happens when
moviepy
anddecorator
modules are not compatible (e.g. after thedecorator
module was upgraded to the last version).This should solve the issue:
This seems to a duplicate of #1625. I’m closing it in favour of the other issue even though it was reported earlier because the other isses uses code formatting for errors, which helps with readability.