Raspberry Pi Adds Second HDMI Port to Laptop
After buying a new laptop Pierre Quy I noticed one important feature missing: DisplayPort over USB-C. This inspired Guoy to create his own virtual screen streaming solution powered by his Raspberry Pi 3B.
The premise is simple, use Ethernet to stream screen data to the Raspberry Pi and output the screen through the Pi’s HDMI port. However, different processes and skills were required to make this project successful.
Cuoy’s previous laptop could output via VGA and HDMI simultaneously. However, his latest purchase only allowed him HDMI, so Cuoy got to dusting off an old Raspberry Pi 3B and shoving it into the service to stream an extra screen. The Raspberry Pi was free, so the choice was easy, but there were some compromises, such as using a 100m Ethernet port and a quad-core CPU to get the right balance of image quality, latency, and frame rate.
The goal Cuoy set was simple.
- Delay should not be noticeable when scrolling or moving the mouse
- The image quality must be high enough to read small characters.
- Since I was planning to use it mainly for static textual content, I decided to ease myself by setting a low goal of 10 FPS.
- If the receiver of the stream falls behind, they should catch up live as soon as possible
- use direct rendering manager Display the stream on the Pi instead of relying on the X server.
- I looked into remote play tools and VNC because they seemed like easy-to-use, low-latency solutions. However, I wasn’t interested in streaming input from the Pi to my laptop.
Additionally, Cuoy wanted to set up a DHCP server on the Raspberry Pi and configure the laptop to launch the required software on boot and start streaming screen data. Its final goal is xrandr Create a virtual monitor.
Cuoy’s first task was to create a video pipeline, and he decided to use ffmpeg on his laptop. After installing the DHCP server (udhcpd), Cuoy configured the two machines to talk to each other. The connection was confirmed, so the first real test was a stream over unoptimized ethernet. The test passed, but failed on all goals. Undaunted, Kui kept pushing. Ultimately, through a series of iterations, Cuoy was able to optimize the stream to the point where he achieved his goals.
The ultimate goal was to extend the laptop display using a custom bash script that spawned a virtual monitor configured to meet Cuoy’s needs and streamed to the Raspberry Pi’s IP address. On the Pi another script intercepts the stream and outputs the playback through the HDMI port.
Admittedly, this is overkill. USB DisplayLink adapters work similarly, with little or no functionality. But the full process is fascinating. It shows what can be achieved with cheap hardware, some Linux knowledge, and enough iteration.
Quoi is full blog post All configuration files are in their respective processes. GitHub repository.