Mirror Android Screen with ADB connection wirelessly

Most of the time, when developer need to showcase their android apps, or mirroring their Android phone onto a screen, they usually use third party apps to do that. Did you know that you can mirror your android phone in your linux desktop through wireless ADB without relying on any third party application? Well in this post, I'll tell you how you can do that 😉.

Generally, third party application done it the best. However, in cases some of you might looking for an 'old-school' method, this could achive by connecting your android phone through adb wirelessly and pipe it through ffmpeg for image rendering.

Step 1: Install requirements

Make sure to download appropriate tools before started.

sudo apt install android-tools-adb ffmpeg

Step 2: Start the adb server

On your terminal, start the adb server.

adb start-server
* daemon not running; starting now at tcp:5037
* daemon started successfully

Step 3: Restart the adb daemon to listen on port

Connect your phone with same wifi and enable usb debugging adb over wifi.

If your android doesn't have adb over wifi feature, connect your phone to your pc wired and enable usb debugging on your Android phone. Run this command on your PC to check the connection of the ADB. A prompt on your Android phone might appears if you never done this before. Just accept the fingerprint.

adb devices
List of devices attached
b68bfcf9cbd8c2fe device

And execute this command to enable adb over network. The port can be anything. In this case, I do 5555 (by default). So what this command does is restarting your Android phone adbd daemon to listen on TCP on the specified port.

adb tcpip 5555

Now you can pull off the cable.

Step 4: Connect adb to your Android over the wifi

Check your Android IP on the network setting (or sometimes on About phone -> status -> IP address). And with the IP in mind, execute the following command on your pc to make a connection to the device via TCP/IP. Port 5555 is used by default if no port number is specified.

adb connect
connected to
adb devices
List of devices attached	device

Now you can perform any adb command wirelessly.

Step 5: The Magic happens

The Mirror magic. Run the following command and piped the output to ffplay to render the image.

Here, you can read more about screenrecord features introduce in Android.

adb shell screenrecord --output-format=h264 - | ffplay -

Enjoy your Android screen mirror using the "old-school" method.

Some drawbacks..

  • On busy wifi, speed or screen latency might lagging.
  • You cannot interact with the Android using this method.
  • No sound will capture.