DinoMan / speech-driven-animation

949 stars 289 forks source link

System cannot find the file specified #47

Open ghost opened 4 years ago

ghost commented 4 years ago

After installing everything I run into an issue when running the following code:

CODE: import sda va = sda.VideoAnimator(gpu=0, model_path="grid")# Instantiate the animator vid, aud = va("example\image.bmp", "example\audio.wav") va.save_video(vid, aud, "generated.mp4")

ERROR: File "Y:\SpeechDrivenAnimation\speech-driven-animation\code", line 4, in vid, aud = va("example\image.bmp", "example\audio.wav") File "Y:\SpeechDrivenAnimation\speech-driven-animation\sda\sda.py", line 232, in call info = mediainfo(audio) File "C:\Users\sd\AppData\Local\Programs\Python\Python38\lib\site-packages\pydub\utils.py", line 323, in mediainfo res = Popen(command, stdout=PIPE) File "C:\Users\sd\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 854, in init self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Users\sd\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 1307, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, FileNotFoundError: [WinError 2] The system cannot find the file specified

I have confirmed the file paths exist and it is getting the correct file - I can only assume it's something internal?

Cryaniptic commented 4 years ago

I am getting the same issue, I can't help too much but I dont think its the models.

DinoMan commented 4 years ago

It could be that there is a problem with the library that opens the audio file. The call to the animator can be done with a numpy array instead of a file so you could try loading the audio file outside the call and providing the numpy array to the animator to see if it runs.

A-q-p-W commented 3 years ago

Specify full path in your vid, aud = va("example\image.bmp", "example\audio.wav") line.

As in, vid, aud = va("C:\<folder name>\example\image.bmp", "C:\<folder name>\example\audio.wav")

Your scripts are searching for the files relative to the path of the script, which is why it cannot find them.

See accepted answer given here: https://stackoverflow.com/questions/31248197/python-pil-imaging-library-filenotfounderror

illtellyoulater commented 2 years ago

@spencer759 @Cryaniptic did you guys fix it somehow?

I am having the same issue, tried using the full path but it didn't fix it. So, @A-q-p-W, I don't think it's related to that. Also, before erroring out (either using relative or full paths) python takes up some CPU cycles... so it's clearly doing something that does not end well... but what is it?

DinoMan commented 2 years ago

@illtellyoulater What you are experiencing might be a different issue and maybe happening during the alignment process (this happens in CPU). You can try using the example and setting aligned=True so that the alignment is skipped to see if this works.

illtellyoulater commented 2 years ago

@DinoMan not sure about that, the error message I was receiving is exactly the same described at the top of this thread. Anyway, as a workaround I used this different approach and it worked:

import sda
import scipy.io.wavfile as wav
from PIL import Image
va = sda.VideoAnimator(gpu=0)# Instantiate the aminator
fs, audio_clip = wav.read("example/audio.wav")
frame = Image.open("example/image.bmp")
frame = "example/image.bmp"
vid, aud = va(frame, audio_clip, fs=fs)
va.save_video(vid, aud, "generated.mp4")
DinoMan commented 2 years ago

Ok good to know it works that way. I noticed that @spencer759 was running under windows so maybe it is related to this (the code was developed on Linux and I never tested on windows). Also unless you have a typo then some of the lines in your code are not necessary. You are loading the image into the frame variable but then replacing it with the filename. The code will handle it and load from file so that's probably why it works. In any case, it is probably safe to say that originally the issue is likely with reading the audio.

frame = Image.open("example/image.bmp") frame = "example/image.bmp"