- 下载FFmpeg
https://ffmpeg.zeranoe.com/builds/win64/static/
- 添加环境变量
path: D:\ffmpeg\bin
- 将手机缓存文件导入到电脑
- 在随机数文件夹(例如925792221)下创建 bili.py
import os
import json
import time
superPath = os.getcwd()
partDirs = []
paths = os.listdir(superPath)
for p in paths:
if os.path.isdir(p):
partDirs.append(os.path.join(superPath, p))
print(partDirs)
for eatchPath in partDirs:
videoJsonDir = eatchPath+'\\'+'entry.json'
videoTitle = ''
with open(videoJsonDir, 'r', encoding='utf-8') as load_f:
load_dict = json.load(load_f)
videoTitle += '"'+load_dict['page_data']['part']+'"'
videoDir = 'video.m4s'
audioDir = 'audio.m4s'
outDir = videoTitle+'.mp4'
command = 'cd '+ eatchPath + '\\64 && '
command += 'ffmpeg -i ' + videoDir + ' -i ' + audioDir + ' -c:v copy -c:a aac -strict experimental ' + outDir
print('执行{}'+command)
os.system(command)