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
相关推荐
m0_74065322几秒前
Golang切片底层原理是怎样的_Golang切片实现原理教程【简明】yexuhgu2 分钟前
CSS如何处理CSS逻辑属性兼容性_通过PostCSS转译为物理属性m0_624578593 分钟前
CSS如何给Bootstrap背景添加半透明层_使用rgba颜色模式与定位智慧物业老杨4 分钟前
智慧物业数智化转型实战:从工单响应到业主满意度的闭环构建m0_470857645 分钟前
CSS如何实现等宽表格布局_利用table-layout与盒模型Kiling_07046 分钟前
Java集合框架:List集合详解与应用kexnjdcncnxjs10 分钟前
HTML 中使用 EXIF.js 读取图片元数据失败的常见原因与解决方案iuvtsrt17 分钟前
Python如何实现定时异步任务_结合asyncio与loop.call_later调用m0_4636722017 分钟前
HTML怎么标注成就连续打卡中断_HTML“断连,重新开始”提示【方法】m0_5967490918 分钟前
CSS如何解决IE下按钮点击反馈缺失_使用active伪类前缀处理