import os
import ffmpeg
from ffmpeg import output, run
def convert_wemtv_to_mp4(input_file, output_dir):
"""
将 WEMTV 文件转换为 MP4 文件并保存
Args:
input_file (str): 输入 WEMTV 文件路径
output_dir (str): 输出 MP4 文件保存目录
"""
try:
if os.path.exists(input_file):
print(f"input_file:存在")
# 检查输出目录是否存在
if not os.path.exists(output_dir):
os.makedirs(output_dir)
print(f"output_dir:不存在")
# 构建输出文件路径
output_file = os.path.join(output_dir, output_dir + ".mp4")
print(f"input_file:{input_file}")
# 创建 FFmpeg 处理流
stream = input(input_file)
print(f"stream:{stream}")
stream = output(stream, output_file, codec='libx264', f='mp4')
# 执行转换
run(stream)
print(f"转换成功: {output_file}")
except Exception as e:
print(f"转换失败: {input_file}")
print(e)
# 示例用法
input_file = 'path/to/input.wemtv'
output_file = 'path/to/output.mp4'
output_dir = 'directory'
convert_wemtv_to_mp4(input_file, output_dir)
python 腾讯会议录屏文件转化为MP4
@小张不嚣张2024-08-28 19:32
相关推荐
森语林溪21 小时前
大数据环境搭建从零开始(十七):JDK 17 安装与配置完整指南“负拾捌”21 小时前
LangChain提示词模版 PromptTemplate合作小小程序员小小店1 天前
web安全开发,在线%服务器日志入侵检测%系统安全开发,基于Python,flaskWeb,正则表达式检测,mysql数据库dreams_dream1 天前
Django序列化器懷淰メ1 天前
python3GUI--短视频社交软件 By:Django+PyQt5(前后端分离项目)lsx2024061 天前
HTML 音频(Audio)详解woshihonghonga1 天前
【动手学深度学习】威风的虫1 天前
ES6 数组方法:告别循环,拥抱函数式编程码界筑梦坊1 天前
240-基于Python的医疗疾病数据可视化分析系统2301_803554521 天前
C++ 锁类型大全详解