小丸因为稳定原因不提供这个功能,我们自己写一个。
请注意,对于多轨道文件,不保证正确或成功。
请自行确认目标格式是否可以封装原数据流。
老规矩,MIT协议。随便抱走,文件坏了不负责。
基于python3写的。
用法:
python3 ***.py
#!/usr/bin/env python #coding:utf-8 # Author: Beining@ACICFG Tech Team # Purpose: Batch convert media file type with ffmpeg. # Created: 03/07/14 # MIT License import os import glob print(''' ----------------------------------------- Batch convert mediafile type with remux V 0.01 Beining@ACICFG www.cnbeining.com ----------------------------------------- ''') ffmpeg_location = input("Type the real location of ffmpeg. If left blank, I will use the default one under /usr/bin/.\nMake sure you use the latest version of ffmpeg.") if ffmpeg_location == '': ffmpeg_location = 'ffmpeg' format_from = str(input('Type the format you want to convert from, without ".":')) format_to = str(input('Type the format you want to convert to, without ".":')) if_delete_original = int(input("Type 0 for not deleting original file(s), 1 for delete.")) info=os.getcwd() print('My working folder is '+str(info)) file_to_convert_type = '*.'+format_from file_list = glob.glob(file_to_convert_type) print('Files to be remuxed:') for filename in file_list: print(filename+'\n') total_file_number = str(len(file_list)) print('Total file number: '+total_file_number) flag = 0 for filename in file_list: name = filename.split('.') real_name = name[0] print('Converting ' + str(flag+1) + ' of ' + total_file_number + ' files...') os.system(ffmpeg_location + ' -i ' + filename + ' -c:a copy -c:v copy ' + real_name + '.'+format_to) if if_delete_original == 1: try: os.remove(filename) pass except: print('Cannot delete ' + str(filename) + ' ! Do it by yourself...') pass