How To Control Your Android Device from a PC Using Scrcpy

scrcpy
(Image credit: Tom's Hardware)

Scrcpy (Screen Copy)  is a remarkable tool. At the most basic leve,l it is a means to interact with an Android device from our computer. We can launch applications, control cameras and play games using our Android device, but over a USB or Wi-Fi connection. We first came across Scrcpy in 2020 and have been using it as a means to add a high quality second camera to an OBS setup. 

This camera is in reality a four year old cellphone and we display the Android desktop as an application window on our desktop. We can even use Scrcpy over a Wi-Fi connection, useful for roving video streams. If you have an old Android cell phone or tablet in a drawer, then scrcpy is the means to breathe new life into it and repurpose it as part of your streaming setup.

Android developers will appreciate Scrcpy’s advanced features to record video from the stream and show where the user is touching. These two features can be used to debug issues in applications.

In this how to, we shall learn how to setup scrcpy on Windows, and learn more of its advanced commands.

Setting Up scrcpy

Scrcpy is remarkably simple to setup. On Windows, all we need to do is download a single archive and we are ready to go.

1. On your Android device go to Settings >> About phone.

(Image credit: Tom's Hardware)

2. Scroll down to Build Number and tap it seven times. This will unlock developer mode.

(Image credit: Tom's Hardware)

3. Click back and  search for USB.

(Image credit: Tom's Hardware)

4. Scroll down to and enable USB debugging.

(Image credit: Tom's Hardware)

5. Connect your Android device to your computer using a USB lead.

6. Download the pre-built archive for Windows. Linux and macOS users will need to follow  the instructions for their OS.

7. Extract the archive to a folder on your desktop.

8. Open a Command Prompt and navigate to the folder on your desktop.

9. Run the scrcpy.exe command. If prompted, allow the connection on your Android device.

(Image credit: Tom's Hardware)

We now have basic two way communication between our computer and the Android device. The window represents our Android device, and we can see and interact with the device as if it were in our hands. We can use our mouse to swipe and interact with applications and the keyboard to input text.  

Close the connection by closing the application window. Let's discover more of scrcpy’s features.

Scaling the Application Window

(Image credit: Tom's Hardware)

The application window, our Android device’s screen, can be scaled using the max-size argument. Our scenario is that we want to scale the application window size for use in a video. We don’t want the window to dominate the screen with the Android device window.

Run scrcpy from the command prompt and use the -m argument to set the maximum size to 1024. The -m argument is short for –max_size and both can be used.

scrcpy.exe -m 1024

Lock Screen Rotation

(Image credit: Tom's Hardware)

By default, scrcpy will run with no screen rotation lock. This means that when the Android device is rotated, the application window will react accordingly. This may not be the desired effect, and so we can lock the rotation. We may want to use the device in landscape mode as a camera in a complex OBS setup, or we may want to play Candy Crush in portrait mode.

Via the Command Prompt open scrcpy using one of the following options to lock the rotation.

scrcpy --lock-video-orientation     # initial (current) orientation
scrcpy --lock-video-orientation=0   # natural orientation
scrcpy --lock-video-orientation=1   # 90° counterclockwise
scrcpy --lock-video-orientation=2   # 180°
scrcpy --lock-video-orientation=3   # 90° clockwise

Recording the Android Device

Recording the Android interface can be a useful tool. If you wish to record the steps to complete a task, raise a bug or add the video to a YouTube tutorial, then recording the screen via scrcpy is rather useful.

To record the screen we use the -r argument, along with the name of the output file.

From the Command Prompt set scrcpy to record the video stream to a file called demo.mp4.

scrcpy.exe -r demo.mp4

We can mix the previous arguments, to rotate the screen and set the screen size. In this case we will rotate the screen to landscape, set the screen size to a maximum of 1080 pixels tall, and save the video to demo-1080.mp4.

scrcpy.exe --lock-video-orientation=1 -m 1080 -r demo-1080.mp4

Connecting Over Wi-Fi

USB provides the best, stable connection to our Android device, but there are times where going wireless is the best option. For example If you want to add a wireless camera for an OBS stream, or record your game from the comfort of your sofa. The –tcpip argument is the key to this step.

1. Ensure your Android device is connected via USB. For the first connection we need to use USB in order to correctly setup the connection.

2. Ensure that your Android device is connected to the same network as your computer.

3. Run scrcpy with –tcpip argument to discover the Android device and automatically connect over the network.

scrcpy.exe –tcpip

4. Remove the USB connection and the application window will remain on screen, enabling us to use the device over Wi-Fi. Note that there will be a slightly longer delay between an action and reaction due to network latency.

Window Configuration Options

The scrcpy application window has its own configuration options which we can use to tweak the application to our needs.

Window Title

(Image credit: Tom's Hardware)

We can give the window a title using the –window-title argument. In this example we set the window size to 768 pixels tall.

scrcpy --window-title 'Tutorial’

Set the Window Position and Size

If you need the application window to be in an exact location, this can be specified using an argument when running scrcpy from the Command Prompt.

scrcpy --window-x 100 --window-y 100 --window-width 800 --window-height 600

Borderless Application Window

If you don’t want or need the window decorations (minimize, maximize and close) then this argument will hide them. Note that you will need to press CTRL + C in the Command Prompt to close the window.

scrcpy --window-borderless

Always on Top

This argument will ensure that the scrcpy Android device window is always on top of every other window / application.

scrcpy --always-on-top

Fullscreen

To set scrcpy to use all of the available screen, use the –fullscreen, shortened to -f, argument. You will need to ALT-TAB and press CTRL + C in the Command Prompt to close the session.

scrcpy --fullscreen
scrcpy -f  # short version

Show Touches

(Image credit: Tom's Hardware)

This handy argument will show where a user is pressing on the screen. The argument can be called with a full, verbose option, or a shortened version.

scrcpy --show-touches
scrcpy -t
Les Pounder

Les Pounder is an associate editor at Tom's Hardware. He is a creative technologist and for seven years has created projects to educate and inspire minds both young and old. He has worked with the Raspberry Pi Foundation to write and deliver their teacher training program "Picademy".