cvqluu / simple_diarizer

Simplified diarization pipeline using some pretrained models - audio file to diarized segments in a few lines of code
GNU General Public License v3.0
141 stars 27 forks source link

Space in path (directory or file name) prevents diarization #23

Open MrEdwards007 opened 11 months ago

MrEdwards007 commented 11 months ago

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 commented 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
mDimitar commented 10 months ago

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.