simple_diarizer icon indicating copy to clipboard operation
simple_diarizer copied to clipboard

Space in path (directory or file name) prevents diarization

Open MrEdwards007 opened this issue 2 years ago • 2 comments

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.

MrEdwards007 avatar Dec 22 '23 03:12 MrEdwards007

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

MrEdwards007 avatar Dec 22 '23 16:12 MrEdwards007

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.

mDimitar avatar Jan 30 '24 23:01 mDimitar