clovaai / voxceleb_trainer

In defence of metric learning for speaker recognition
MIT License
1.03k stars 272 forks source link

Problems in converting voxceleb #53

Closed huyvl closed 4 years ago

huyvl commented 4 years ago

Hello, I'm having problems when using dataprep.py to convert aac files, I using this script

D:\VGGvox\VGGvoxtrainer\voxceleb_trainer>python ./dataprep.py --save_path ./voxceleb --convert and this error show up

Converting files from AAC to WAV 0%| | 0/1091606 [00:00<?, ?it/s] The system cannot find the path specified. 0%| | 0/1091606 [00:00<?, ?it/s] Traceback (most recent call last): File "./dataprep.py", line 142, in convert(args) File "./dataprep.py", line 113, in convert raise ValueError('Conversion failed %s.'%fname) ValueError: Conversion failed ./voxceleb/voxceleb2\id00012\21Uxsk56VDQ\00001.m4a.

I have been trying to figure this for days Thanks you very much

joonson commented 4 years ago

Hi, the script does not work in Windows.

muzihuole commented 2 years ago

So how to modify the code to make it run in windows?

muzihuole commented 2 years ago

So how to modify the code to make it run in windows?

I have modified the code to make it work in windows. The code show as below: `import os path=r'F:\voxceleb_trainer-master\data\voxceleb2'

filter=[".m4a"] #Set the filtered file type. Of course, you can set multiple types

def all_path(dirname):

result = []#All files

for maindir, subdir, file_name_list in os.walk(dirname):

    for filename in file_name_list:
        apath = os.path.join(maindir, filename)#Merge into one full path
        ext = os.path.splitext(apath)[1]  # Get the file suffix [0] Get the content other than the file name

        if ext in filter:
            result.append(apath)

return result

filenames=all_path(path)

for filename in filenames: filename=str(filename) temp=filename.split('.')

#Command to convert .m4a format to wav format
# cmd_command = "ffmpeg -i {0} -acodec pcm_s16le -ac 1 -ar 16000 -y {1}.wav && del {0}".format(filename,temp[0])
cmd_command = "ffmpeg -i {0} -vn -acodec pcm_s16le -ac 1 -ar 16000 -y {1}.wav && del {0}".format(filename, temp[0])

#print(cmd_command)
os.system(cmd_command)`