xaviviro / refacer

Refacer: One-Click Deepfake Multi-Face Swap Tool
MIT License
530 stars 130 forks source link

won't start #14

Closed jecer closed 1 year ago

jecer commented 1 year ago

installed everything that was needed, but when you run python app.py you get an error the file app.py is in the folder refacer and all rights are granted to it D:\reface\refacer>python app.py Traceback (most recent call last): File "D:\reface\refacer\app.py", line 11, in <module> refacer = Refacer(force_cpu=args.force_cpu) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\reface\refacer\refacer.py", line 30, in __init__ self.__check_encoders() File "D:\reface\refacer\refacer.py", line 195, in __check_encoders commandout = subprocess.run(command, check=True, capture_output=True).stdout ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jecer\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 548, in run with Popen(*popenargs, **kwargs) as process: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jecer\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1024, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Users\jecer\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1493, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: [WinError 2] Cannot find specified file

xaviviro commented 1 year ago

It seems like you don't have ffmpeg installed or it's not properly set in the path. If you are using a virtual environment (venv), installing the requirements should automatically install ffmpeg. If not, you can manually install ffmpeg from https://ffmpeg.org/.

xaviviro commented 1 year ago

Can you run ffmpeg in the terminal and paste what appears? thank you

jecer commented 1 year ago

placed ffmpeg.exe, ffplay.exe, ffprobe.exe in the folder with app.py And everything worked, thank you!

jecer commented 1 year ago

An error is displayed after trying to render Total frames: 136 Extracting frames: 100%|████████████████████████████████████████████████████████████| 136/136 [00:00<00:00, 199.46it/s] Processing frames: 100%|█████████████████████████████████████████████████████████████| 136/136 [00:17<00:00, 7.79it/s] Merging audio with the refaced video... Traceback (most recent call last): File "C:\Users\jecer\AppData\Local\Programs\Python\Python311\Lib\site-packages\gradio\routes.py", line 427, in run_predict output = await app.get_blocks().process_api( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jecer\AppData\Local\Programs\Python\Python311\Lib\site-packages\gradio\blocks.py", line 1323, in process_api result = await self.call_function( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jecer\AppData\Local\Programs\Python\Python311\Lib\site-packages\gradio\blocks.py", line 1051, in call_function prediction = await anyio.to_thread.run_sync( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jecer\AppData\Local\Programs\Python\Python311\Lib\site-packages\anyio\to_thread.py", line 31, in run_sync return await get_asynclib().run_sync_in_worker_thread( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\jecer\AppData\Local\Programs\Python\Python311\Lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread return await future ^^^^^^^^^^^^ File "C:\Users\jecer\AppData\Local\Programs\Python\Python311\Lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run result = context.run(func, *args) ^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\reface\refacer\app.py", line 30, in run return refacer.reface(video_path,faces) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\reface\refacer\refacer.py", line 189, in reface return self.__convert_video(video_path,output_video_path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\reface\refacer\refacer.py", line 113, in __convert_video out.run(overwrite_output=True,quiet=True) File "C:\Users\jecer\AppData\Local\Programs\Python\Python311\Lib\site-packages\ffmpeg\_run.py", line 325, in run raise Error('ffmpeg', out, err) ffmpeg._run.Error: ffmpeg error (see stderr output for detail)

xaviviro commented 1 year ago

It's possible that placing the ffmpeg.exe file in the same folder has allowed the program to locate ffmpeg, but ffmpeg requires other components such as encoders to function properly. Instead of placing the executable in the folder, you might want to try adding ffmpeg to the Windows PATH. Here's a tutorial on how to do this: https://www.thewindowsclub.com/how-to-install-ffmpeg-on-windows-10?utm_content=cmp-true

rmhckrkz commented 1 year ago

Hello. Need help with below error. Thanks

C:\Python\REFACE\refacer>python app.py Traceback (most recent call last): File "C:\Python\REFACE\refacer\app.py", line 12, in refacer = Refacer(force_cpu=args.force_cpu,colab_performance=args.colab_performance) File "C:\Python\REFACE\refacer\refacer.py", line 32, in init self.__check_encoders() File "C:\Python\REFACE\refacer\refacer.py", line 230, in check_encoders commandout = subprocess.run(command, check=True, capture_output=True).stdout File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64qbz5n2kfra8p0\lib\subprocess.py", line 503, in run with Popen(*popenargs, **kwargs) as process: File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64qbz5n2kfra8p0\lib\subprocess.py", line 971, in init self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64qbz5n2kfra8p0\lib\subprocess.py", line 1456, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, FileNotFoundError: [WinError 2] The system cannot find the file specified

xaviviro commented 1 year ago

This is likely because you either do not have ffmpeg installed, or it's not properly configured. Please refer to the prerequisites that I have just added in the readme: https://github.com/xaviviro/refacer/blob/main/README.md#prerequisites