dchatel / vid-faceswap

32 stars 3 forks source link

Can't generate video #3

Open Niutonian opened 1 year ago

Niutonian commented 1 year ago

Hello, I can't get it to work, I have two Auto1111 installs with torch 1.13 and 2.0 but it crashes on both, Here's the output:

""" File "C:\AI\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 399, in run_predict output = await app.get_blocks().process_api( File "C:\AI\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1299, in process_api result = await self.call_function( File "C:\AI\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1022, in call_function prediction = await anyio.to_thread.run_sync( File "C:\AI\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py", line 31, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "C:\AI\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 937, in run_sync_in_worker_thread return await future File "C:\AI\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 867, in run result = context.run(func, *args) File "C:\AI\stable-diffusion-webui\extensions\vid-faceswap\scripts\vid_faceswap.py", line 67, in process_video frames_data, fps, audio = video_reader(video_input, max_fps=max_fps if max_fps > 0 else None) File "C:\AI\stable-diffusion-webui\extensions\vid-faceswap\scripts\video.py", line 11, in video_reader return _ffmpeg_reader(file, max_fps) File "C:\AI\stable-diffusion-webui\extensions\vid-faceswap\scripts\video.py", line 31, in _ffmpeg_reader with VideoFileClip(file) as clip: AttributeError: enter """

How can I fix it, Best,

dchatel commented 1 year ago

Which version of moviepy have you installed ? Also, ffmpeg needs to be installed and accessible by moviepy. One good way to do it is add the folder where ffmpeg.exe is in your PATH, since you probably want to be able to use it from anywhere, anyway.

sti320a commented 1 year ago

I encountered the same error, I added the folder with ffmpeg.exe to my PATH. The version of moviepy I installed is 1.0.3.

This problem seems to be caused by VideoFileClip not supporting the with syntax.

Can you tell me which version of libraries I should use? Or can you provide me with something like requirements.txt?

dchatel commented 1 year ago

I'm using moviepy 1.0.3 and for ffmpeg:

ffmpeg version 4.4-full_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 10.2.0 (Rev6, Built by MSYS2 project)
dchatel commented 1 year ago

Could you try to run a very small script which does the following ?

from moviepy.editor import VideoFileClip

with VideoFileClip('path/to/video-file') as clip:
  frames = list(clip.iter_frames())
sti320a commented 1 year ago

Could you try to run a very small script which does the following ?

from moviepy.editor import VideoFileClip

with VideoFileClip('path/to/video-file') as clip:
  frames = list(clip.iter_frames())

This script worked fine. Then I noticed that I needed to install moviepy in Stable Diffusion's venv environment.

path\to\stable-diffusion-webui> .\venv\Scripts\activate   
(venv) > pip install moviepy==1.0.3

This solved the above problem. Thanks for your help.

After resolving this issue, I ran into another error. I'm currently investigating. Please let me know if you know anything about it.

TypeError: FaceAnalysis.__init__() got an unexpected keyword argument 'providers'

Thank you.

dchatel commented 1 year ago

It could be related to the wrong version of insightface. You should use 0.7.3 and not 0.2.1. You can fix that by running pip install -U insightface in the stable diffusion environment.

sti320a commented 1 year ago

It could be related to the wrong version of insightface. You should use 0.7.3 and not 0.2.1. You can fix that by running pip install -U insightface in the stable diffusion environment.

After executing the command, insightface v0.7.3 was installed and it worked! Thank you !!

path\to\stable-diffusion-webui> .\venv\Scripts\activate   
(venv) > pip install -U insightface