​​感谢风雪小筑​​

1 安装优酷找到自带的ffmeg进行操作

  • 默认路径"C:\Program Files (x86)\YouKu\YoukuClient\nplayer\ffmpeg.exe"
  • 将nplayer文件夹整个拷贝出来
  • ​$ nplayer/ffmpeg.exe -y -i 01.kux -c:a copy -c:v copy -threads 2 01.MP4​

2 为了后续操作方便,添加系统变量

优酷视频kux格式转mp4格式_python


优酷视频kux格式转mp4格式_批量操作_02

3 脚本批量操作

这里借用​​视频压缩处理之ffmpeg用法​​

将待处理文件kux,放到​​/待处理​​文件夹内

# 该脚本的功能是, 将待压缩的文件夹内所有视频, 通过ffmpeg
# 进行帧率压缩, 将压缩后的文件保存到处理完文件夹内
# 执行命令为 在安装ffmpeg的系统中, python passion.py
import os
import sys
import time
# ffmpeg.exe -y -i 01.kux -c:a copy -c:v copy -threads 2 01.MP4

wait_handle_dir = r"待处理/"
save_dir = r"处理完/"
if os.path.exists(save_dir):
pass
else:
os.mkdir(save_dir)


for file in os.listdir(wait_handle_dir):
save_name = f"{os.path.splitext(file)[0]}.mp4"
if save_name not in os.listdir(save_dir): # 判断文件夹内是有转化完成的数据
print(f"trackle {wait_handle_dir}{file} ..................................")
command = f'ffmpeg.exe -y -i "{wait_handle_dir}{file}" -c:a copy -c:v copy -threads 2 "{save_dir}{save_name}"'
print(command)
os.system(command)
time.sleep(0.5)