morrolinux / simple-ehm

A simple tool for a simple task: remove filler sounds ("ehm") from pre-recorded speeches. AI powered.
MIT License
228 stars 19 forks source link

[WinError 2] The system cannot find the file specified #5

Closed ghost closed 3 years ago

ghost commented 3 years ago

Hi, I'm using Windows 10 with Python 3.8 64 bit.

If i try to launch the simple_ehm-runnable.py i'm facing this problem (I tried with two differents MOV files):

C:\Users\fabio\Desktop\simple-ehm-main>simple_ehm-runnable.py rula\morro.mov
extracting audio track...
Traceback (most recent call last):
  File "C:\Users\fabio\Desktop\simple-ehm-main\simple_ehm-runnable.py", line 276, in <module>
    wav_path = convert_input(video_path)
  File "C:\Users\fabio\Desktop\simple-ehm-main\simple_ehm-runnable.py", line 70, in timed
    output = f(*args, **kw)
  File "C:\Users\fabio\Desktop\simple-ehm-main\simple_ehm-runnable.py", line 82, in convert_input
    subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE).wait()
  File "C:\Users\fabio\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\fabio\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 1307, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] Impossibile trovare il file specificato

I had to install different packages before launch the script (matplotlib, seaborn, numpy, tensorflow) with no problems. The only package which gave me an error was cv2, I got the error: "Could not find a version that satisfies the requirement cv2". Searching on the web, I found here to use the command pip install opencv-python, after that I had no more errors on cv2. Can this be the cause of the original error? I can't understand what is the cause of the original error.

morrolinux commented 3 years ago

I think you should make sure ffmpeg is installed and in your PATH so that when you type ffmpeg in a shell it doesn't error out

ghost commented 3 years ago

I think you should make sure ffmpeg is installed and in your PATH so that when you type ffmpeg in a shell it doesn't error out

ffmpeg was not installed, thanks. Now the script starts without errors, but it get stuck on this message. No difference after 10 minutes of waiting.

C:\Users\fabio\Desktop\simple-ehm-main>simple_ehm-runnable.py morro.mov
extracting audio track...
analyzing track...
 92%|████████████████████████████████████████████████████████████████▋     | 784000/848000 [00:00<00:00, 946765.57it/s]CUT and MERGE: running 2 ffmpeg simultaneous instances.

856000it [00:20, 946765.57it/s]

The video is 53 seconds long. I noticed the it creates a WAV file, but it has the same length of the input video, without removing "ehm" sounds. morro

I've edited the code to do some debugging, and it seems it enters an infinite loop from line 239 https://github.com/morrolinux/simple-ehm/blob/4d72899ade5cff0a0f17bac30e485912a67d6a47/simple_ehm-runnable.py#L239

As you can see from the screenshot, the variable i, after passing form 0 to 2 is never more increased.

loop

Asky1111 commented 3 years ago

Hi, I had the exact same errors: both the cv2 error, which I solved in the same way, and the 'The system cannot find the file specified' error. I installed ffmpeg with pip install ffmpeg, and it didn't change anything, I'm not always 100% sure of what I'm doing, since I'm kind of a noob, but when I type pip install ffmpeg again it says: Requirement already satisfied: ffmpeg in c:\programdata\anaconda3\lib\site-packages (1.4). Problem is, when I try running the program I always get: extracting audio track... Traceback (most recent call last): File ".\simple_ehm-runnable.py", line 285, in <module> wav_path = convert_input(video_path) File ".\simple_ehm-runnable.py", line 73, in timed output = f(*args, **kw) File ".\simple_ehm-runnable.py", line 85, in convert_input subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE).wait() File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 729, in __init__ restore_signals, start_new_session) File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 1017, in _execute_child startupinfo) FileNotFoundError: [WinError 2] Impossibile trovare il file specificato

Is there another solution to the problem? Or am I just doing something wrong?

morrolinux commented 3 years ago

@Asky1111 you must install ffmpeg as a system command with your package manager (apt?)

@fabios15 about your post:

There's a similar issue: #4 where the problem did not happen when removing options stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE in subprocess.Popen instructions, see the issue for more details.

It looks like this issue is caused by the ffmpeg process generating too much output for the subprocess output redirection to handle: https://stackoverflow.com/questions/39477003/python-subprocess-popen-hanging So I'll probably need to use Popen.communicate() instead. The weird thing is I haven't been able to reproduce this issue on any of my machines or invocations, but yeah that seems to be the culprit.

morrolinux commented 3 years ago

Ok, on second thought I think I might just force ffmpeg to be less verbose... -hide_banner -loglevel error Will push something soon....

morrolinux commented 3 years ago

fixed by 0c263ae feel free to reopen if necessary