Open rushkii opened 3 years ago
@rushkii it seems like you're writing an empty video?
In the constructor:
self._compos = []
And in render:
result = CompositeVideoClip(self._compos)
@rushkii it seems like you're writing an empty video?
In the constructor:
self._compos = []
And in render:
result = CompositeVideoClip(self._compos)
Uh-- Sorry, I was given incomplete code before, I've edit it you can see it again. The problem is in FPS, the error says:
Traceback (most recent call last):
File "main.py", line 73, in execute_py
ret = await func(_, msg)
File "", line 9, in func
File "/app/core/pool.py", line 30, in wrapper
return await loop.run_in_executor(_EXECUTOR, partial(func, *args, **kwargs))
File "/app/.heroku/python/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/app/core/wish.py", line 85, in render_save
result.write_videofile(path, fps=fps)
File "/app/.heroku/python/lib/python3.7/site-packages/decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
File "/app/moviepy/decorators.py", line 54, in requires_duration
return f(clip, *a, **k)
File "/app/.heroku/python/lib/python3.7/site-packages/decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
File "/app/moviepy/decorators.py", line 135, in use_clip_fps_by_default
return f(clip, *new_a, **new_kw)
File "/app/.heroku/python/lib/python3.7/site-packages/decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
File "/app/moviepy/decorators.py", line 22, in convert_masks_to_RGB
return f(clip, *a, **k)
File "/app/moviepy/video/VideoClip.py", line 307, in write_videofile
logger=logger)
File "/app/moviepy/video/io/ffmpeg_writer.py", line 216, in ffmpeg_write_video
ffmpeg_params=ffmpeg_params) as writer:
File "/app/moviepy/video/io/ffmpeg_writer.py", line 88, in __init__
'-r', '%.02f' % fps,
TypeError: must be real number, not NoneType
It is hard to see without the full code, but it seems your problem is here:
File "/app/core/wish.py", line 85, in render_save result.write_videofile(path, fps=fps)
In that line, your fps variable is not set to a number. You can print it before, to verify, and then you need to trace to figure out why it is not set.
To test, you can replace fps=fps with fps=30, and check the rest of your code works ...
It is hard to see without the full code, but it seems your problem is here:
File "/app/core/wish.py", line 85, in render_save result.write_videofile(path, fps=fps)
In that line, your fps variable is not set to a number. You can print it before, to verify, and then you need to trace to figure out why it is not set.
To test, you can replace fps=fps with fps=30, and check the rest of your code works ...
This is my full code https://pastebin.com/Bp81V3uv, I run a Telegram bot in Heroku, but it return an error like that, I've already tested in my local computer (Windows 10) it really works actually. I don't know what's the problem.
Hi, I think the problem might be in the decorator moviepy.decorators.use_clip_fps_by_default
. I put it as the last decorator of the VideoClip.write_videofile
method and now it looks like it worked. I believe the problem was due to the func_code.co_varnames[1:]
inside the decorator, this will return the main method arguments. Therefore, the main method of use_clip_fps_by_default
has to be write_videofile
and not convert_masks_to_RGB
or anything else.
So the VideoClip.write_videofile
method signature should look like this:
@requires_duration
@convert_masks_to_RGB
@use_clip_fps_by_default
def write_videofile(self, filename, fps=None, codec=None,
...
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
This does not resolve the mentioned issue, after uninstalling decorator and installing moviepy, I get Successfully installed decorator-4.4.2 moviepy-1.0.3. However same error occurs when performing the before mentioned. Python : 3.10
Is the decorator issue separate from what #1986 is about? Or does upgrading to the latest changes in the repo, as suggested over there, fix this issue as well? If so, I'd like to close it as duplicate of the other one.
-->
Expected Behavior
Successfully rendering and save it.
Actual Behavior
Specifications