AIFSH / ComfyUI-Hallo

MIT License
217 stars 8 forks source link

到最后一步报错了 #33

Open rguogreen opened 6 days ago

rguogreen commented 6 days ago

[12/12] [MoviePy] >>>> Building video D:\00_AI_TOOLS\ComfyUI-aki-v1.2\output\hallo_1719451232483069200.mp4 [MoviePy] Writing audio in hallo_1719451232483069200TEMP_MPY_wvf_snd.mp3 [MoviePy] Done. [MoviePy] Writing video D:\00_AI_TOOLS\ComfyUI-aki-v1.2\output\hallo_1719451232483069200.mp4 Traceback (most recent call last): File "D:\00_AI_TOOLS\ComfyUI-aki-v1.2\custom_nodes\ComfyUI-Hallo\Hallo\scripts\inference.py", line 375, in inference_process(command_line_args) File "D:\00_AI_TOOLS\ComfyUI-aki-v1.2\custom_nodes\ComfyUI-Hallo\Hallo\scripts\inference.py", line 346, in inference_process tensor_to_video(tensor_result, output_file, driving_audio_path) File "D:\00_AI_TOOLS\ComfyUI-aki-v1.2\custom_nodes\ComfyUI-Hallo\Hallo\hallo\utils\util.py", line 318, in tensor_to_video new_video_clip.write_videofile(output_video_file, fps=fps, audio_codec='aac') File "D:\00_AI_TOOLS\ComfyUI-aki-v1.2\python\lib\site-packages\decorator.py", line 232, in fun return caller(func, *(extras + args), kw) File "D:\00_AI_TOOLS\ComfyUI-aki-v1.2\python\lib\site-packages\moviepy\decorators.py", line 54, in requires_duration return f(clip, *a, *k) File "D:\00_AI_TOOLS\ComfyUI-aki-v1.2\python\lib\site-packages\decorator.py", line 232, in fun return caller(func, (extras + args), kw) File "D:\00_AI_TOOLS\ComfyUI-aki-v1.2\python\lib\site-packages\moviepy\decorators.py", line 137, in use_clip_fps_by_default return f(clip, *new_a, new_kw) File "D:\00_AI_TOOLS\ComfyUI-aki-v1.2\python\lib\site-packages\decorator.py", line 232, in fun return caller(func, *(extras + args), *kw) File "D:\00_AI_TOOLS\ComfyUI-aki-v1.2\python\lib\site-packages\moviepy\decorators.py", line 22, in convert_masks_to_RGB return f(clip, a, k) File "D:\00_AI_TOOLS\ComfyUI-aki-v1.2\python\lib\site-packages\moviepy\video\VideoClip.py", line 338, in write_videofile ffmpeg_write_video(self, filename, fps, codec, File "D:\00_AI_TOOLS\ComfyUI-aki-v1.2\python\lib\site-packages\moviepy\video\io\ffmpeg_writer.py", line 201, in ffmpeg_write_video writer = FFMPEG_VideoWriter(filename, clip.size, fps, codec = codec, File "D:\00_AI_TOOLS\ComfyUI-aki-v1.2\python\lib\site-packages\moviepy\video\io\ffmpeg_writer.py", line 86, in init '-r', '%.02f' % fps, TypeError: must be real number, not NoneType

AIFSH commented 6 days ago

readme,check your ffmpeg

rguogreen commented 5 days ago

ffmpeg ffmpeg version 7.0.1-full_build-www.gyan.dev Copyright (c) 2000-2024 the FFmpeg developers built with gcc 13.2.0 (Rev5, Built by MSYS2 project)

我使用秋叶的集成包,本地安装了ffmpeg, 这样是不是不行?

rguogreen commented 5 days ago

image 我看控制台的显示, ffmpeg已经安装了。 还是说我的这个ffmpeg不行?

Kinglord commented 5 days ago

Sadly this has nothing to do with ffmpeg, apparently there's a bug in moviepy itself (the latest version) that isn't passing in the fps correctly to the deocrators. Maybe this only happens on Windows? I'm not actually sure how it works for anyone :D

Here is a link to the bug: https://github.com/Zulko/moviepy/issues/2158

I did a dirty hack to hardcode it in moviepy so I didn't have to mess with decorators. You can make this change as well to ffmpeg_writer.py if you like, just set the fps to something reasonable, I had mine on 24 and it works fine.

I added this code to the main class and the ffmpeg_write_video function just to be safe:

    # Ensure fps is set to 24 if not provided
    if fps is None:
        fps = 24

Hopefully that will fix things for you as well! I wish there was a way to punt on the whole moviepy thing cause it's pretty old. If not, I think we could edit the comfyui node to include an FPS setting so that's properly being passed and that would work as well and it's something we can control.