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
相关推荐
有一个好名字14 分钟前
工具即双手 —— 从 Bash 到 Tool Dispatch MapLyyaoo.15 分钟前
优惠券秒杀业务分析消失的旧时光-194316 分钟前
统一并发模型:线程、Reactor、协程本质是一件事(从线程到协程 · 第6篇·终章)DevilSeagull1 小时前
MySQL(2) 客户端工具和建库MATLAB代码顾问1 小时前
改进遗传算法(IGA)求解作业车间调度问题(JSSP)——附MATLAB代码syker2 小时前
AIFerric深度学习框架:自研全栈AI基础设施的技术全景HSunR2 小时前
dify 搭建ai作业批改流zhaoyong2222 小时前
MySQL 存储过程中字符集与排序规则不匹配导致查询性能下降的解决方案sinat_383437362 小时前
golang如何从Python转型Go开发_golang从Python转型Go开发攻略代码不加糖2 小时前
2026 跨境电商独立站实战:从 0 到 1 搭建高转化 SaaS 商城(附源码)