Scrcpy

Last updated 7-10-2024


In this screenshot above,  you see a Firefox window running the google fiber speed test on my Raspberry 4B desktop that is USB tethered to my cell phone for internet access. On top of that window you see a window with a  copy of my cell phone screen using the program, scrcpy, running the same google fiber speed test on the phone instead of on my desktop. I have exceeded my USB tethering high speed data cap of 15 GB/account month, so it has been throttled to 600Kbps. This has no impact on the in app phone data rate which at the time of this screenshot was 114 x faster.  If I do my internet related work on my phone, I have no need for a separate internet provider for my desktops that run useful opensource Linux apps like LibreOffice, GIMP, etc. At the age of 78 and a very late adopter of a cell phone, I like a keyboard, mouse, and full size monitor while accessing my cell phone browser.

There are multiple approaches for mirroring your cell phone screen. Scrcpy allows you to view and control your cell phone in a window on your computer or even full screen. This way you can run Android apps at the allowed data rate on your phone, rather than the reduced rate using USB tethering on your desktop after you have exceeded your tethering high speed data rate for the current account period.  To compile the latest version, see this link:

https://github.com/Genymobile/scrcpy/blob/master/doc/linux.md

On the raspberry Pi 4B, video lags the phone screen and some audio is skipped. No wonder there was no scrcpy candidate in the PiOS repository! Compiling the most recent version worked exactly as written in the above link and didn’t take very long.

For Mint Linux and Ubuntu Studio running on a desktop with an Intel i3 or better cpu, there is no video lag and there is an install candidate in the repository so installing is as simple as

sudo apt-get install scrcpy

Why the video lag on the Raspberry Pi? My guess is that the mirroring method in scrcpy is better suited to x-server primitives than to movies that have only pixels to transfer. Bookworm on the Pi is using wayland instead of x-server. I should try configuring the Pi to use x-server instead of wayland to compare lagging.

In the meantime, it is still very useful to be able to run my phone from my Raspberry Pi desktop for fast downloads and browsing.

A second mirroring method is called Miracast. The FireTV supports Miracast although it calls this “wireless display.”  Enable it with Settings > Display and Sound > Enable Screen Mirroring. On the OnePlus 7pro Android phone, search for “screencast” or Settings> Connections and Sharing > and scroll down to Screencast >Search for display devices (your TV) > and then Start Now when this box pops up after you have chosen the device to display to.  This uses a peer to peer wifi connection (wifi direst) between the phone and the TV. The TV does not need internet access and no are cables required. You can attach your USB keyboard and mouse through an adapter to your phone. Audio goes directly to the TV with the video. The FireTV has a headphone jack which disconnects the TV speakers if you plug in headphones.

https://www.youtube.com/watch?v=x5zQrJAuN_k

The Raspberry Pi OS does not have a Miracast candidate in its repository.

Method 3 is the DisplayLink Presenter Android app in the Google Play Store. You can also download it directly from DisplayLink which is now called Synaptics. The displaylink USB to video connects directly to the phone. This results in no detectable latency. It still supported my dl-195 legacy USB 2.0 adapter. Neither the Google Play Store nor the synaptics direct *.apk download display protected content. Not supporting protected content on the mirrored display seems to be an Android OS choice. So far, only the Miracast approach allows me to stream commercial films playing on my phone and mirrored to a full size display.

https://www.synaptics.com/products/displaylink-graphics/downloads/android

It is likely that advertised USB to HDMI adapters for mobile Android phones will not support protected video content either. No advertiser on Amazon that I have queried will commit to saying their USB to HDMI adapter will display protected content, but they word their answer with some legalese to leave you hoping that theirs will. I think the reason Android blocks this is that they want to control whose video streaming service you can mirror from your phone to a smartTV or Android TV box full size screen. Google Play Store and Android app developers derive income or advertising revenue from apps in this online store. Android runs on top of Linux to enable blocking using your phone or smart TV as a full desktop Linux computer. Windows 11 reportedly is making it harder to run any OS not bought from Micro$oft.  I used to help people configure their computers to multi-boot Windows and Linux, but then Micro$soft started issuing updates that would overwrite the multi-boot loader. The last Micro$oft product I bought was MSdos 6.0. their MASM 5.0, and their Visual C. Then I went to Linux. I will never buy hardware that can only run Windows.