question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

myclip.write_videofile("movie.webm",audio=False) TypeError: must be real number, not NoneType

See original GitHub issue

Expected 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:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

4reactions
smidmcommented, Nov 18, 2021

This happens when moviepy and decorator modules are not compatible (e.g. after the decorator module was upgraded to the last version).

This should solve the issue:

pip uninstall moviepy decorator
pip install moviepy
0reactions
keikorocommented, Sep 9, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

must be real number, not NoneType" whenever trying to run ...
This occurs whenever I try to perform write_videofile to any kinds of clip in moviepy. It is strange since the exact same code...
Read more >
TypeError: must be real number, not NoneType : r/moviepy
New to moviepy library. I am trying to execute a simple code that was used in library documentation. I couldn't get past this...
Read more >
myclip.write_videofile("movie.webm",audio=False) TypeError
myclip.write_videofile("movie.webm",audio=False) TypeError: must be real number, not NoneType.
Read more >
TypeError: must be real number, not NoneType when writing ...
I receive the following error using the demo. I'll try to resolve myself, and update the issue if I find a fix. python...
Read more >
must be real number, not NoneType" whenever trying to run ...
Getting "TypeError: must be real number, not NoneType" whenever trying to run write_videofile to a clip in moviepy.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found