C# 的最佳图像压缩
我目前正在开发一些软件,可以捕获您的显示器图像并将其通过互联网发送给客户。 到目前为止,我已经让它在我的局域网中工作,但是当我通过互联网测试它时,几乎没有任何图像到达客户端。
我正在使用 Lidgren 进行网络连接。目前,我从屏幕上获取一个位图,将其转换为 30 质量的 JPEG,对其进行 G 压缩并继续发送。每个图像的大小约为 80KB,我尝试每秒向客户端发送 10 个图像。现在好像需要 7 兆位的上传连接,而我的只有 2 兆位。
基本上,任何人都知道有任何压缩库或技术可以显着减小每个图像的文件大小。这可能是完全不可能的,但我想我会尝试一下。
非常感谢任何帮助,谢谢!
I'm currently working on some software which captures your monitor image and sends it over to clients over the internet.
So far I have it working in my local area network but when I go to test it over the internet, hardly any of the images get through to the client.
I am using Lidgren for my networking. At the moment, I get a Bitmap from the screen, convert it to a JPEG with 30 quality, G-zip it and send it on its way. Each image is about 80KB in size, and I try to send 10 images a second to the client. Now that's like a 7mbit upload connection required, mines is only 2mbit.
So basically, is anyone aware of any compression libraries or techniques which will dramatically decrease the file size of each image. This might be completely impossible but I thought that I would give it a go.
Any help is much appreciated, Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您真的需要每次都发送整个帧吗?您能否不只发送当前帧和前一帧之间发生的更改,然后将这些更改应用到客户端框架以使其保持最新状态?假设服务器没有观看视频或类似内容,这应该很快。 这个答案表明这是 RDP (Microsoft) 和 VNC 用于远程桌面查看的方式。
请参阅 https://stackoverflow.com/a/4098515/171703 和 https://stackoverflow.com/a/1876848/171703 一些想法关于如何做到这一点。
Do you really need to send the whole frame each time? Could you not just send what has changed between the current and the previous frame and then apply these changes to the client frame to bring it up to date? This should be pretty quick assuming the server isn't watching a video or some-such. This answer suggests this is what both RDP (Microsoft) and VNC use for remote desktop viewing.
See https://stackoverflow.com/a/4098515/171703 and https://stackoverflow.com/a/1876848/171703 for some ideas on how to do this.