标签:end sed ESS readlines 文件 man node ffmpeg mpeg
#coding=utf-8
import sys,os ,shutil
import struct
import glob
import time
import subprocess
def process_audio(file_name,to_file):
command=‘ffmpeg -i {} -af atempo=0.85 {} ‘.format(‘"‘+file_name+‘"‘,to_file.replace(‘ ‘,‘_‘))
print(command)
os.system(command)
def process_file(file_name,dest_node):
if not file_name.endswith(‘.mp3‘):
return;
process_audio(file_name,dest_node)
def process_dir(folder):
for sub_node in glob.glob ( folder+‘/*‘ ):
dest_node=sub_node.replace(node,"../processed/")
if os.path.isdir(sub_node):
if not os.path.isdir(dest_node):
os.mkdir(dest_node)
process_dir(sub_node)
else:
process_file(sub_node,dest_node)
node=sys.argv[1]
if os.path.isdir(node):
process_dir(node)
for audio_file in glob.glob ( node+‘/*‘ ):
process_file(audio_file,audio_file.replace(node,"../processed/"))
if os.path.isfile(node):
with open(node, ‘r‘) as file_to_read:
for line in file_to_read.readlines():
process_file(line)
标签:end sed ESS readlines 文件 man node ffmpeg mpeg
原文地址:https://www.cnblogs.com/shinedream/p/13308342.html