Open MrEdwards007 opened 11 months ago
Proposing the following
single quotes around the '{}' resolves the space issue with ffmpeg.
Adding a way to silence the large output from ffmpeg to stdout.
It has value for debugging but otherwise, it is just noisy.
If you need it, you can pass False to silent.
def convert_wavfile(wavfile, outfile, silent=True):
"""
Converts file to 16khz single channel mono wav
"""
cmd = "ffmpeg -y -i '{}' -acodec pcm_s16le -ar 16000 -ac 1 '{}'".format( wavfile, outfile )
if (silent == True):
rc = subprocess.Popen(cmd, shell=True, stderr=subprocess.DEVNULL, stdout=subprocess.DEVNULL).wait()
else:
subprocess.Popen(cmd, shell=True).wait()
return outfiles
Hey @MrEdwards007 do you mind if we chat somewhere outside? Possibly Discord,I have troubles starting this project and running it on my test audio .wav file. I'd appreciate it if you help me.
I am unable to process a file if there is a space in the folder path or in the file name. I have tried escaping the spaces but the sticking point appears to be ffmpeg or more specifically "convert_wavefile". Currently my only method for addressing this is to create a temporary name and copy the file to a temporary directory, to eliminate the space.
Is there another way to manage this issue.
I have attempted to escape the spaces but that has not worked.