You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because of the decorator: @use_clip_fps_by_default, even though fps is not passed as an argument to this function, it should be given the value from the attribute clip.fps which is 25 in my case, and it should generate a video with that FPS.
Actual Behavior
However, I got the Type Error saying that fps is in fact Nonetype when passing to ffmepg. Part of the traceback:
File ~/anaconda3/envs/myenv/lib/python3.11/site-packages/moviepy/video/io/ffmpeg_writer.py:86, in FFMPEG_VideoWriter.__init__(self, filename, size, fps, codec, audiofile, preset, bitrate, withmask, logfile, threads, ffmpeg_params)
75 self.ext = self.filename.split(".")[-1]
77 # order is important
78 cmd = [
79 get_setting("FFMPEG_BINARY"),
80 '-y',
81 '-loglevel', 'error'if logfile == sp.PIPE else'info',
82 '-f', 'rawvideo',
83 '-vcodec', 'rawvideo',
84 '-s', '%dx%d' % (size[0], size[1]),
85 '-pix_fmt', 'rgba'if withmask else'rgb24',
---> 86 '-r', '%.02f' % fps,
87 '-i', '-', '-an',
88 ]
89 if audiofile is not None:
90 cmd.extend([
91 '-i', audiofile,
92 '-acodec', 'copy'
93 ])
TypeError: must be real number, not NoneType
Upon checking the execution of the decorator use_clip_fps_by_default, I found that in this case fps doesn't show up in neither the names = func_code.co_varnames[1:] or the kwargs, so neither of the lines:
will call function fun and handle the None type FPS. So I had to hardcode and add the following to the end of the function to make it work:
if'fps'notinnamesand ('fps'notinkork['fps'] isNone):
ifhasattr(clip, 'fps') andclip.fpsisnotNone:
new_kw['fps'] =clip.fpselse:
raiseAttributeError("No 'fps' (frames per second) attribute specified"" for function %s and the clip has no 'fps' attribute. Either"" provide e.g. fps=24 in the arguments of the function, or define"" the clip's fps with `clip.fps=24`"%f.__name__)
Steps to Reproduce the Problem
Specifications
Python Version: 3.11.9
MoviePy Version: 1.0.3
Platform Name: MacOS
Platform Version: m2
The text was updated successfully, but these errors were encountered:
I was trying to run in my ipython notebook:
which will call function from the the parent class:
VideoClip.write_videofile
:Expected Behavior
Because of the decorator:
@use_clip_fps_by_default
, even thoughfps
is not passed as an argument to this function, it should be given the value from the attributeclip.fps
which is 25 in my case, and it should generate a video with that FPS.Actual Behavior
However, I got the Type Error saying that fps is in fact Nonetype when passing to ffmepg. Part of the traceback:
Upon checking the execution of the decorator
use_clip_fps_by_default
, I found that in this case fps doesn't show up in neither thenames = func_code.co_varnames[1:]
or thekwargs
, so neither of the lines:will call function
fun
and handle the None type FPS. So I had to hardcode and add the following to the end of the function to make it work:Steps to Reproduce the Problem
Specifications
The text was updated successfully, but these errors were encountered: