赞
踩
树莓派装了jellyfin,里面放了很多学习资料都是.wmv,不启动树莓派的V4L2硬件加速播放是没有问题, 但是经常遇到软解速度跟不上(树莓派4b没超频)。
启动硬件加速后,居然给我看弹窗,该客户端与媒体不兼容,服务器未发送兼容的媒体格式。
于是用ffmpeg 转化成mp4格式。测试可用,网上翻了一下,没一个顺手的脚本,就随手自己用python实现了一下批处理。
#!/usr/bin/python3 # -*- coding: UTF-8 -*- import os baseDir = "" def log(logStr): file = open(f"{ baseDir}/log.txt", "a", encoding="utf-8") file.write(logStr) file.close() def ls(path): tempFile = os.popen("ls").readlines() for fileName in tempFile: # 处理一些可能的问题 fileName = fileName.replace("\n", "") # print(fileName) if fileName.endswith(".wmv"): fileName = fileName.replace("(", "\\(").replace(")", "\\)") outfileName = fileName.replace(".wmv", ".mp4") print(f"ffmpeg -i { fileName} { outfileName}") back = os.system(f"ffmpeg -i { fileName} { outfileName}") if back == 0: log(f"{ path}/{ fileName} 转化成功 \n") delete = os.system(f"rm { fileName}") if delete == 0: log(f"{ path}/{ fileName} 删除成功 \n") else: print(f"{ fileName} 转化失败") log(f"{ path}/{ fileName} 转化失败 \n") else: newPath = path + "/" + fileName print(newPath) cd(newPath) def cd(path): # print(f'{path}') try: os.chdir(path)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。