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
相关推荐
至此流年莫相忘5 分钟前
Python之深拷贝和浅拷贝qq_401700415 分钟前
Qt的.pro文件FAFU_kyp14 分钟前
Rust 的 引用与借用像风一样自由202015 分钟前
XGBoost、LightGBM、CatBoost 原理深度剖析与全面对比喵星人工作室19 分钟前
C++传说:神明之剑0.4.5装备机制彻底完成用户2308266766521 分钟前
Python的管道符(|)联合类型语法糖秦jh_21 分钟前
【Qt】系统相关(下)东木月25 分钟前
使用python获取Windows产品标签pumpkin8451427 分钟前
Go 基础语法全景hqwest28 分钟前
码上通QT实战18--监控页面10-获取设备数据