通过不同平台流式传输桌面以提高速度

发布于 2025-01-05 02:54:03 字数 639 浏览 5 评论 0 原文

我需要用“C”创建一个小型远程桌面软件,可以在各种平台(linux、freebsd、windows...)上编译,我已经研究了各种图像格式一段时间,但仍然无法想出一个使用它们是个好主意,现在,这就是我所做的:

1. Convert All Formats into Windows Bitmap (XImage,...etc)
2. Do a byte-to-byte comparion and replace the identical bytes with zeros
3. Preform a RLE (Run Length Encoding) on the Resulted data.
4. Transmit the Packet to the Server
5. Inverse the Operation on the Server by Reconstructing the Image through the previous image (Comparing Last Image with the New one Discarding Zero Bytes after RLE)

但这往往非常慢,因为位图图像格式已经有非常大的文件,因为它不包含压缩,并且在 Mac OS X 等平台上,位图尺寸大得离谱,因为非常高分辨率。

有没有更快更好的桌面流媒体方式?

I needed to create a small remote desktop software in 'C' that compiles on various platforms (linux, freebsd, windows...) i've been looking into various image formats for a while, but still couldn't come up with a good idea to use them, right now, here is what i do:

1. Convert All Formats into Windows Bitmap (XImage,...etc)
2. Do a byte-to-byte comparion and replace the identical bytes with zeros
3. Preform a RLE (Run Length Encoding) on the Resulted data.
4. Transmit the Packet to the Server
5. Inverse the Operation on the Server by Reconstructing the Image through the previous image (Comparing Last Image with the New one Discarding Zero Bytes after RLE)

but this tends to be very slow, since the bitmap image format has very big files already because it contains no compression, and on platforms such as Mac OS X, the bitmap size is rediculously big because of the very hight resolution.

is there any faster and better way to do desktop streaming?

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

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

发布评论

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

评论(1

待"谢繁草 2025-01-12 02:54:03

对于计算机屏幕,您可以考虑一些事情,主要是屏幕的一小部分可能会随时发生变化。

您可以查看以下三种方法:

  1. 将屏幕分成矩形,每次屏幕更新仅传输那些随位置变化的内容。
  2. 使用压缩图像格式,如 png 或 jpeg,或使用 zlib 压缩位图,而不是RLE。
  3. 捕获图像时减少图像的颜色深度,将图像减少到 4 位或 8 位颜色将大大减少您发送的数据量以及必须比较更改的数据量。

根据您想要编写服务器的方式,您也许能够从操作系统获取关于屏幕的哪些位已更改的提示,以减少您必须执行的处理量。

最后,(如果这不是家庭作业)然后看看 VNC 已经做得很好了,甚至还有 java 或 c# 版本。

There are things you can take into account with computer screens, mainly that only small portions of the screen are likley to change at any one time.

You could look these three approaches:

  1. Break the screen up into rectangles, for each screen update only transmit those that have changed along with thier location.
  2. Use a compressed image format, like png or jpeg, or compress the bitmaps using zlib rather than RLE.
  3. Reduce the colour depth of your images when you capture them, reducing the images to 4bit or 8bit colour will vastly reduce the amount of data you send and the amount of data you have to compare for changes.

Depending on how you want to write the server, you may be able to take hints from the OS as to which bits of the screen have changed to reduce the amount of processing you have to do.

Lastly, (if this is not homework) then look at things like VNC that already do this pretty well, there are even java or c# versions.

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