小丸因为稳定原因不提供这个功能,我们自己写一个。
请注意,对于多轨道文件,不保证正确或成功。
请自行确认目标格式是否可以封装原数据流。
老规矩,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
https://github.com/soimort/you-get/tree/develop/src/you_get/processor
这里有三个,ffmpeg.py、join_flv.py 和 join_mp4.py。
顺手看了一下整个的代码。。。
A和B站,用API的速度应该能快一些,而且可以使用海外加速,具体看之前的一个文章。。。
我就直接懒一下,用最无脑的copy方法直接remux了。
这个脚本唯一的用途是直接remux整个文件夹下的东西。
这是某天在丸妞反馈群里面有人提出的要求,因为小丸不提供这个功能。
顺手涂抹几个字,仅为完成这个功能。。。
这个就是批量封装后自动删除源文件吗 能不能做成一个软件 或者bat这样的东西
对。
Python写的,乐意叫脚本就叫脚本,乐意叫软件也成。
bat。。。没办法,linux的脚本还不会写,而且我没有windows环境可以用。。。
弄一个python就啥都可以跑了。
对这东西没信心
只要ffmpeg不拉肚子,这个东西就不拉肚子。
要是ffmpeg拉肚子,那你无论如何都得重新转码了。
不建议拿多轨道文件作死。而且我也不准备支持——要是有这个需求,自己敲ffmpeg命令呗。这个需求很明显不会用到批量。