这是我的编码项目之一。我对 Linux 还很陌生,所以在开始之前我需要你们的一些指导和想法。我知道已经存在屏幕共享软件,但我想制作自己的! (=
具体来说,我想通过 WLAN 将笔记本电脑屏幕克隆到电视上,通过 VGA 电缆连接到电视的 Linux 盒子:
- 笔记本电脑传输其屏幕
- Linux 盒子读取流
- Linux 盒子将流输出到电视(通过VGA电缆)
首先,如何在Linux中实时记录屏幕并发送流?
其次,我必须编写一个读取正在发送的流的程序,该程序必须监听某个端口,并收集数据。任何从笔记本电脑流式传输的内容。那么
我必须将这些数据实时输出到电视上,您对如何解决这个问题有什么想法吗?
谢谢!
关于编程语言,我最喜欢Python。
This is one of my coding projects. I'm fairly new to linux, so I need some pointers and thoughts from you guys, before I get started. I know there exists screen sharing software already, but I want to make my own! (=
Specifically, I want to clone my laptop screen to my TV over WLAN, via a linux box that is connected to a TV through a VGA cable:
- Laptop streams it's screen
- Linux box reads the stream
- Linux box outputs the stream into the TV (through a VGA cable)
First of all, how do I record the screen and send the stream in real time in linux?
Secondly I must write a program that reads the stream being sent. The program must listen to some port, and collect the data being streamed from the laptop. Any thoughts?
Then I must output that data in real time to the TV. Do you how any ideas on how to solve this?
Thanks!
Edit: Regarding programming languages, I'm most comfortable with python.
发布评论
评论(2)
可以通过各种风格的VNC(即RealVNC, TightVNC, UltraVNC 等)。 rel="nofollow">它们是开源的,您可能想要:
在Linux中,图形全部由Xorg(X Server的新版本)处理,Xorg是嵌入网络开发的。这解释了为什么您可以通过 ssh -X 进入计算机,在其上执行图形界面并在远程计算机上查看它。我建议您阅读 Xorg 上的 hooks 来满足您的需求。
您需要客户端-服务器拓扑来满足您的需求。不过,您并不是在谈论您预计使用的任何编程语言。有些语言可能比某些语言更难入门。此外,每种主要编程语言都已经很好地理解了这种代码。您应该至少尝试使用一个可以简化项目网络部分的框架。
在电视上共享屏幕可以通过 Linux 中的显卡驱动程序来完成。只需检查您的桌面环境(例如,KDE 和 Gnome 提供视频配置面板)或视频卡配置(nVidia 和 ATI Linux 驱动程序提供多屏幕支持)
在我看来,您似乎正在尝试重新发明轮子,并且正在尝试重新发明轮子。不太确定如何开始。我建议您从一种已经经过验证的 VNC 软件开始,看看它是如何运作的。如果缺少某个功能,您将获得服务器和客户端的源代码,以便您可以继续开发这些项目。一旦你的设置开始工作,就开始考虑用你自己的代码替换拼图的一块,然后看看效果如何。
如果没有功能强大的 CPU/GPU 和没有用户的 802.11n 无线网络,请不要指望电视上有良好的(例如全高清)视频质量,并准备好接受编解码器启动时的一些延迟。
Sharing your screen can be done via the various flavors of VNC (ie. RealVNC, TightVNC, UltraVNC, etc.). Most of them are Open Source, you might want to:
In Linux, the graphics are all processed by Xorg (new version of X Server), which was developed with networking embedded. This explains why you can ssh -X into a machine, execute a graphical interface on it and see it on your remote computer. I recommend you to read about hooks on Xorg to achieve your needs.
You need a client-server topology to achieve your needs. You are not talking about any programming language you forecast to use, though. Some languages may be harder than some to start with. Furthermore, this kind of code is already really well understood under every major programming language. You should try to at least use a framework that simplifies your networking portion of the project.
Sharing a screen on the TV can be done by your video card driver in Linux. Just check on your Desktop Environment (KDE and Gnome offers video configuration panels, for example) or in your video card configuration (nVidia and ATI Linux drivers offers multiple screen support)
It seems to me like you're trying to reinvent the wheel and are not too sure about how to begin. I recommend you to begin simple with one of the already proven VNC software and see how it goes from there. If a feature is missing, you've got the source code of the server and the client, so you can continue development of these projects. Once you've got your setup working, start thinking about replacing a single piece of the puzzle by your own code, and see how it goes.
Do not expect good (full HD, for instance) video quality on your TV without some very capable CPU/GPU and a 802.11n wireless network empty of users and be ready to accept some lag for the codecs to kick in.
您应该尝试采取尽可能小的步骤。如果我正在从事这样一个项目,我的第一步将是尝试使用标准 unix 工具(例如网络部分的
netcat
或socat
,>mplayer
或vlc
用于播放,也许ffmpeg
用于捕获)?然后,如果需要,用自定义编写的组件替换每个组件。You should try to take as small steps as possible. If I were taking up such a project, my first step would be to try to implement a solution using standard unix tools (e.g.
netcat
orsocat
for the network part,mplayer
orvlc
for the playback and maybeffmpeg
for the capture)? Then, replace each component with custom-written ones if needed.