更新版本号
This commit is contained in:
@@ -55,6 +55,7 @@ def _extract_frames_worker(video_path: str,
|
||||
# 新模式:按时间间隔抽帧
|
||||
time_interval = frame_interval_seconds
|
||||
next_frame_time = 0.0
|
||||
extracted_count = 0 # 初始化提取帧计数器
|
||||
|
||||
while cap.isOpened():
|
||||
ret, frame = cap.read()
|
||||
@@ -69,20 +70,21 @@ def _extract_frames_worker(video_path: str,
|
||||
pil_image = Image.fromarray(frame_rgb)
|
||||
|
||||
# 调整图像大小
|
||||
if max(pil_image.size) > self.max_image_size:
|
||||
ratio = self.max_image_size / max(pil_image.size)
|
||||
if max(pil_image.size) > max_image_size:
|
||||
ratio = max_image_size / max(pil_image.size)
|
||||
new_size = tuple(int(dim * ratio) for dim in pil_image.size)
|
||||
pil_image = pil_image.resize(new_size, Image.Resampling.LANCZOS)
|
||||
|
||||
# 转换为base64
|
||||
buffer = io.BytesIO()
|
||||
pil_image.save(buffer, format='JPEG', quality=self.frame_quality)
|
||||
pil_image.save(buffer, format='JPEG', quality=frame_quality)
|
||||
frame_base64 = base64.b64encode(buffer.getvalue()).decode('utf-8')
|
||||
|
||||
frames.append((frame_base64, current_time))
|
||||
extracted_count += 1
|
||||
|
||||
logger.debug(f"提取第{extracted_count}帧 (时间: {current_time:.2f}s)")
|
||||
# 注意:这里不能使用logger,因为在线程池中
|
||||
# logger.debug(f"提取第{extracted_count}帧 (时间: {current_time:.2f}s)")
|
||||
|
||||
next_frame_time += time_interval
|
||||
else:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[inner]
|
||||
version = "6.4.4"
|
||||
version = "6.4.6"
|
||||
|
||||
#----以下是给开发人员阅读的,如果你只是部署了麦麦,不需要阅读----
|
||||
#如果你想要修改配置文件,请递增version的值
|
||||
@@ -387,6 +387,8 @@ max_frames = 16 # 最大分析帧数(仅在 mode = "fixed_number" 时生效)
|
||||
frame_quality = 80 # 帧图像JPEG质量 (1-100)
|
||||
max_image_size = 800 # 单帧最大图像尺寸(像素)
|
||||
enable_frame_timing = true # 是否在分析中包含帧的时间信息
|
||||
use_multiprocessing = true # 是否使用线程池处理视频帧提取(推荐开启,可防止卡死)
|
||||
max_workers = 2 # 最大线程数(建议1-2个,避免过度消耗资源)
|
||||
# 批量分析时使用的提示词
|
||||
batch_analysis_prompt = """请分析这个视频的内容。这些图片是从视频中按时间顺序提取的关键帧。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user