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
相关推荐
程序猿追几秒前
kotlin-retry 接入鸿蒙后,怎样确认它真的会停止重试我是人✓1 分钟前
Java文件上传三方式对比:从传统到SpringBoot智能直播5 分钟前
网络RTMP拉流不卡顿、声音不同步,一文讲透缓冲区、时间戳CCblandy27 分钟前
令牌桶在 0.9 倍负载超发 19%、固定窗口边界放行 20 个:四种限流算法同构实测墨云安全1 小时前
内网资产无法暴露到公网,怎么做安全检测?2026 年内网渗透测试的落地路径摇滚侠1 小时前
《计算机是如何工作的:人人都能懂的计算机软硬件工作原理》第 9 章 机器码与汇编语言 阅读笔记 9Cc.Y1 小时前
Java零基础入门:深入Java核心:文件IO与序列化全解拿本唠嗑AI研究1 小时前
本体工程实战指南:从建模到可维护的完整落地路径Smoothcloud润云2 小时前
PyTorch推理服务模型热切换与失败回滚实战:降低版本更新中断jsjzsl22 小时前
递归自改进系统(RSI)的本质是自发对称破缺:智能爆炸有界—— AI研发切记盲目投入