Scrcpy 2.0 Android screen mirroring and control utility for Windows, Linux, and macOS has just been released with support for audio forwarding that enables audio to be played back into the computer/laptop, instead of the smartphone, at least for mobile devices running Android 11 or greater.
We first reported about Scrcpy open-source utility in 2018, and at the time, it worked relatively well in Ubuntu 16.04 but required quite a few steps for the installation, and it would lag from time to time. I could still use the mouse and keyboard to control my phone, send SMS, chat, browse the web, play games, switch between landscape and portrait modes, and so on. Five years later, Scrcpy 2.0 has been released, the installation is much easier, and new features have been implemented.
Scrcpy 2.0 highlights:
- Quality – 1920×1080 or above
- Performance – 30~120fps, depending on the device
- Latency – 35~70ms
- Startup time: ~1 second to display the first image
- Nothing to install on the Android device, as it relies on adb USB or WiFi debugging mode
- No account, no ads, no internet required
- Audio forwarding for Android 11 and greater
- Video and audio recording
- Mirroring with the Android device screen off
- Copy/paste in both directions
- Configurable quality
- Android device used as a webcam in Linux-only through V4L2
- Physical keyboard/mouse simulation (HID)
- OTG mode
So I decided to give another in Ubuntu 22.04. Scrcpy can be installed easily with apt or snap, but those are older versions 1.2.1 and 1.2.5, so I used the method to install the latest version that is not overly complicated. We first need to install some dependencies:
1 2 3 4 |
sudo apt install ffmpeg libsdl2-2.0-0 adb wget \ gcc git pkg-config meson ninja-build libsdl2-dev \ libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev \ libswresample-dev libusb-1.0-0 libusb-1.0-0-dev |
Then we can checkout the code and run the install_release.sh script:
1 2 3 |
git clone https://github.com/Genymobile/scrcpy cd scrcpy ./install_release.sh |
You’ll also have to make sure Developer Options and USB debugging is enabled on your smartphone. I thought WiFi debugging would work out of the box, but apparently, this now only works on Android 11 or greater (albeit I use WiFi adb in older Android versions before) but my phone is running Android 10, so I just connected a USB cable to my phone, and it works like a charm. I could browse the web, play a game, start a video call in LINE, watch a YouTube video in NewPipe in a maximized window (not fullscreen), display the Yahoo Finance app to show stock tickers, and so on. I could only hear audio from my phone because it is only running Android 10.
I also tested some of the new features like copy/paste. I could select text and copy some text in Firefox Android and copy it to Gedit with Ctrl+V. It’s bidirectional, so I could copy some text (a URL) in Firefox in Ubuntu and copy it with Ctrl+V in Android.
I also tried to use my phone as a webcam following the V4L2 instructions, but this part failed because of some codec issue:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
jaufranc@cnx-laptop-4:~$ scrcpy --v4l2-sink=/dev/video2 --no-display scrcpy 2.0 <https://github.com/Genymobile/scrcpy> INFO: Video orientation is locked for v4l2 sink. See --lock-video-orientation. INFO: No display and no recording: audio disabled /usr/local/share/scrcpy/scrcpy-server: 1 file pushed. 4.0 MB/s (52867 bytes in 0.013s) [server] INFO: Device: HUAWEI STK-L22 (Android 10) INFO: v4l2 sink started to device: /dev/video2 [server] ERROR: Encoding error: android.media.MediaCodec$CodecException: Error 0xfffffc0e WARN: Device disconnected [server] ERROR: Exception on thread Thread[main,5,main] android.media.MediaCodec$CodecException: Error 0xfffffc0e at android.media.MediaCodec.native_configure(Native Method) at android.media.MediaCodec.configure(MediaCodec.java:2023) at android.media.MediaCodec.configure(MediaCodec.java:1951) at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:84) at com.genymobile.scrcpy.Server.scrcpy(Server.java:133) at com.genymobile.scrcpy.Server.main(Server.java:381) at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method) at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:359) |
It could be really useful for older smartphones that can be converted into webcams. Note that scrcpy also works with Raspberry Pi, and it’s likely to work with other Arm Linux SBCs, so there could be some interesting use cases.
Nevertheless, Scrcpy 2.0 is a pretty neat tool that’s easy to use and well-documented. The source code and detailed instructions can be found on GitHub.
Via Liliputing
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress
One more issue, I can’t type Thai text in Scrcpy, no matter which keyboard I select in Android and Ubuntu:
Actually, I can, but not with the physical keyboard, I can only tap on the soft keyboard in Android.
I can see bug reports about Chinese language, and the K option works for Chinese, but somehow not for Thai where it will only show ASCII characters even when I switch to the Thai keyboard in Ubuntu…
OK. I have to set the physical keyboard to Thai in Settings -> System -> Languages and input -> Physical keyboard… But then if I want to type in English, I would have to change the language to English in the settings. In that mode, the keyboard selection in Ubuntu is completely disabled. so it’s not practical…
Scrcp 2.0 -> Scrcpy 2.0
I remember playing around with this a year or so ago on Windows x86 and Raspberry Pi. This looks like a great excuse to try it again.
Audio forwarding is one thing, but copy/paste working both ways could be the most useful change. I think it was unidirectional the last time I tried it.
It’s always hilarious to connect an ultra powerful smartphone to a Raspberry Pi 4, but it can be a legit use case. This seems like a good way to interact with an Android device you don’t fully trust. It’s also likely that my Android phone has a better camera than any laptop/external webcam I have, so it might be useful for that.
“It’s always hilarious to connect an ultra powerful smartphone to a Raspberry Pi 4”
I wonder if you could port Scrcpy 2.0 to an openwrt router. The dependencies looks like it might be doable.