import os
import argparse
parser = argparse.ArgumentParser(description='Demo of argparse')
parser.add_argument('--path', type=str)
args = parser.parse_args()
path = args.path
for root, dirs, files in os.walk(path):
for file in files:
file = str(root)+ '\\' +str(file)
file = os.path.splitext(file)[0]
print(file)
os.system("ffmpeg -i \""+ file +".ts\" -acodec copy -vcodec copy -absf aac_adtstoasc \"" + file +".mp4\"")
然后执行以下命令
python main.py --path “目录名”