Today, I was trying to operate my mobile phone using my Laptop (Ubuntu 21.10). I found an interesting application that allows me to operate my mobile phone using Ubuntu. The application is known as Scrcpy. I followed all the steps of README.md and installed it using sudo snap install scrcpy
. After allowing all the permissions (USB debugging and Security USB debugging) on my android phone, I tried to run it, however, it gives me the following errors:
$ scrcpy
INFO: scrcpy 1.19 <https://github.com/Genymobile/scrcpy>
/usr/local/share/scrcpy/scrcpy-server:...shed. 0.8 MB/s (37330 bytes in 0.042s)
[server] INFO: Device: XXXXXX NNNNN (Android 10)
[server] ERROR: Exception on thread Thread[main,5,main]
android.media.MediaCodec$CodecException: Error 0xfffffff4
at android.media.MediaCodec.native_configure(Native Method)
at android.media.MediaCodec.configure(MediaCodec.java:2024)
at android.media.MediaCodec.configure(MediaCodec.java:1952)
at com.genymobile.scrcpy.ScreenEncoder.configure(ScreenEncoder.java:237)
at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:90)
at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:61)
at com.genymobile.scrcpy.Server.scrcpy(Server.java:80)
at com.genymobile.scrcpy.Server.main(Server.java:255)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:380)
INFO: Renderer: opengl
INFO: OpenGL version: 2.1 Mesa 20.0.8
WARN: Trilinear filtering disabled (OpenGL 3.0+ or ES 2.0+ required)
INFO: Initial texture: 1080x2336
WARN: Device disconnected
WARN: Killing the server...
Some information
-
All permissions are given on my android phone.
-
It is the latest Redmi note 10 pro (8GB – 128GB)
-
All scrcpy settings are default.
-
I am using Ubuntu 21.10 Impish.
Any help is appreciated!
>Solution :
For anyone who has the same error, the problem was with the unsupported resolution. You need to change the resolution to somewhere near 1024
to get it to work. You can do it by running:
scrcpy -m 1024
You may want to increase or decrease the resolution to adjust for your device.
Some other information which may be useful.
If you have installed scrcpy
using sudo snap install scrcpy
, then you will also face a lot of errors!
In this case, start by removing it:
sudo snap remove scrcpy
Now you need to compile it from source or install it using apt
.
-
Compiling from source:
As Romain Vimont says in Build.md, you need to follow the following steps to manually compile
scrcpy
:First, you need to install the required packages:
# for Debian/Ubuntu 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 \ libusb-1.0-0 libusb-1.0-0-dev
Then clone the repo and execute the installation script (source):
git clone https://github.com/Genymobile/scrcpy cd scrcpy ./install_release.sh
-
Installing from
apt
:As Romain Vimont says in README.md, you need to follow the following steps to install
scrcpy
usingapt
:On Ubuntu:
sudo apt install scrcpy
If you still have issues, then you can start a new issue at scrcpy’s GitHub page.