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
相关推荐
郑州光合科技余经理1 天前
代码展示:PHP搭建海外版外卖系统源码解析feifeigo1231 天前
matlab画图工具dustcell.1 天前
haproxy七层代理norlan_jame1 天前
C-PHY与D-PHY差异多恩Stone1 天前
【C++入门扫盲1】C++ 与 Python:类型、编译器/解释器与 CPU 的关系QQ4022054961 天前
Python+django+vue3预制菜半成品配菜平台百锦再1 天前
Django实现接口token检测的实现方案QQ5110082851 天前
python+springboot+django/flask的校园资料分享系统QQ_19632884751 天前
Python-flask框架西山区家政服务评价系统网站设计与开发-Pycharm django遥遥江上月1 天前
Node.js + Stagehand + Python 部署