如何在浏览器上流式窗口

发布于 2025-02-06 08:59:50 字数 142 浏览 1 评论 0原文

我有一款正在训练神经网络的游戏游戏。我想在Web应用程序上显示此过程,而无需用户 /客户端与游戏之间的任何互动。是否可以检索Pygame视频数据并将其流式传输到HTML帆布或类似的东西?

  • 目前正在使用烧瓶作为后端来服务HTML页面

I have a pygame game that is training a Neural Network. I would like to show this process on a web app without any interaction between the user / client and the game. Is it possible to retrieve the pygame video data and stream it to a html canvas or something similar?

  • am currently using flask as a back-end to serve the html pages

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

千仐 2025-02-13 08:59:50

一般而言,您可以在窗口对象中使用pygame.image.image.save

window = pygame.display.set_mode(...)
...
pygame.image.save(window, "window.bmp")

然后,您可以将图像流传输到各种端以创建或流视频。该视频可以在网页中显示出延迟。当然,您的过程也会比平时慢得多。

Generally speaking you can use pygame.image.save on your window object inside the loop.

window = pygame.display.set_mode(...)
...
pygame.image.save(window, "window.bmp")

Then you can stream the images to various ends to create or stream video. That video can be shown in a web page with a delay. Also your process will be much slower than usual, of course.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文