修改保存视频格式为webm,使得能在浏览器上播放
This commit is contained in:
@@ -405,10 +405,11 @@ class VideoCheckBiz(BaseFaceBiz):
|
||||
# 创建输出路径
|
||||
video_dir = os.path.dirname(video_path)
|
||||
video_name = os.path.splitext(os.path.basename(video_path))[0]
|
||||
output_path = os.path.join(video_dir, f"{video_name}{suffix}.mp4")
|
||||
output_path = os.path.join(video_dir, f"{video_name}{suffix}.webm")
|
||||
|
||||
# 创建视频写入器,使用计算出的目标帧率
|
||||
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
|
||||
# 使用WebM格式(VP8编码),现代浏览器原生支持
|
||||
fourcc = cv2.VideoWriter_fourcc(*'VP80')
|
||||
out = cv2.VideoWriter(output_path, fourcc, target_fps, (width, height))
|
||||
|
||||
if not out.isOpened():
|
||||
@@ -535,10 +536,11 @@ class VideoCheckBiz(BaseFaceBiz):
|
||||
# 创建输出路径
|
||||
video_dir = os.path.dirname(video_path)
|
||||
video_name = os.path.splitext(os.path.basename(video_path))[0]
|
||||
output_path = os.path.join(video_dir, f"{video_name}{suffix}.mp4")
|
||||
output_path = os.path.join(video_dir, f"{video_name}{suffix}.webm")
|
||||
|
||||
# 创建视频写入器
|
||||
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
|
||||
# 使用WebM格式(VP8编码),现代浏览器原生支持
|
||||
fourcc = cv2.VideoWriter_fourcc(*'VP80')
|
||||
out = cv2.VideoWriter(output_path, fourcc, fps, (width, height))
|
||||
|
||||
if not out.isOpened():
|
||||
|
||||
Reference in New Issue
Block a user