-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
屏幕录制的代码好像是基于linux的,可以写个在windows上运行的demo吗? #5
Comments
暂时没有Windows的电脑,欢迎提PR |
改这个几个地方: import imageio # 引入依赖
def _video_writer(self): # 修改实现
"""Write frames to video file."""
writer = None
try:
writer = imageio.get_writer("ohos.mp4", fps=10)
while not self.stop_event.is_set():
data = self.jpeg_queue.get()
if data is not None:
image = imageio.imread(bytes(data))
writer.append_data(image)
writer.close()
time.sleep(1)
finally:
if writer is not None and not writer.closed:
writer.close()
def stop(self):
"""Stop screen recording."""
try:
self.stop_event.set()
self.jpeg_queue.put(None) # 新增
for t in self.threads:
t.join()
if self.sock:
self._send_message("stopCaptureScreen", [])
self._recv_mesaage(1024, decode=True)
self.sock.close()
except Exception as e:
print(f"An error occurred: {e}") |
已适配windows 53293e9 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
谢谢
The text was updated successfully, but these errors were encountered: