――What is important in deeolearning?
-"It's data!" (Old !!)
――Therefore, I thought about using the super A & G radio data as data by pulling it out.
--Caution
There are various copyrights, so use is at your own risk.
――It can be used for conversion of various data, so make it public and show
--About ffmpeg commands --In this program, flv file is converted to wav file and converted to 16000HZ at the same time. --A brief summary of ffmpeg is as follows
python
#First of all, extension conversion
$ffmpeg input.hoge output.hoge #hoge is an extension
#Sampling rate conversion
$ffmpeg input.hoge -ar 16000 output.hoge #-ar newsamplingrate
aandg.py
# -*- coding: utf-8 -*-
import sys
import glob
import os
import subprocess
#Directory specification
if len(sys.argv) != 3:
print("python3 aandg.py [inputfile_dir] [outputfile_dir]")
sys.exit()
else:
print(sys.argv[1])
inputpath=path = os.path.abspath(sys.argv[1])
#This time in the entered directory.List only flv
file_list=glob.glob(inputpath+"/*.flv")
#Create if there is no output directory
if not os.path.exists(sys.argv[2]):
os.mkdir(sys.argv[2])
print("make dir",sys.argv[2])
output_path = os.path.abspath(sys.argv[2])
for item in file_list:
#Get the file name without conversion extension with subprocess
basename_without_ext = os.path.splitext(os.path.basename(item))[0]
#This time flv 16,Convert to 000HZ wav
cmd = "ffmpeg -i "+item+" -ar 16000 "+output_path+"/"+basename_without_ext+".wav"
runcmd = subprocess.call(cmd.split())
--Sample code will be posted on github. The rest is nice
Recommended Posts