Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions llm/main_ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -1249,14 +1249,15 @@ async def _recording_loop(self):
image = self.image_queue.get()
# 转换为numpy数组
import numpy as np
img = np.frombuffer(image.raw_data, dtype=np.uint8)
img = img.reshape((image.height, image.width, 4)) # BGRA
img = img[:, :, :3] # 转换为BGR
img = img[:, :, ::-1] # 转换为RGB
import cv2
array = np.frombuffer(image.raw_data, dtype=np.uint8)
array = array.reshape((image.height, image.width, 4))
array = array[:, :, :3]
img_rgb = array[:, :, ::-1]
img_bgr = cv2.cvtColor(img_rgb, cv2.COLOR_RGB2BGR)

# 写入视频文件
if self.video_writer is None:
import cv2
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
self.video_writer = cv2.VideoWriter(
self.recording_output_path,
Expand All @@ -1266,7 +1267,7 @@ async def _recording_loop(self):
)
app_logger.info(f"📹 视频写入器已创建")

self.video_writer.write(img)
self.video_writer.write(img_bgr)
self.recording_frame_count += 1

await asyncio.sleep(frame_interval)
Expand Down
Loading