批量转换目录下音频格式的

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

##
import os;
def fa(dir):
	dst_dir = os.getcwd() + '/mp3/';
	lists = os.walk(dir);
	for root, dirs, files in lists:
		for file in files:
			pix = os.path.splitext(file);
			if 'amr' == pix[1][1:]:
				dst_file = dst_dir + pix[0] + '.mp3';
				src_file = root + '/' + file;
				cmd = 'ffmpeg -i ' + src_file + ' ' + dst_file;
				os.system(cmd)
	print('ok');

fa('/root/python/amr');