Does scrcpy support audio?

What is scrcpy?

Scrcpy is an open source application that mirrors Android devices to computers. It allows users to view and control Android devices from a computer by connecting over USB or WiFi. Scrcpy uses Android Debug Bridge (adb) to communicate with the device.

Scrcpy was created by Romain Vimont and is hosted on GitHub. It is distributed under the Apache License 2.0. The project is primarily written in C.

Scrcpy’s Video Mirroring Capabilities

Scrcpy allows real-time screen mirroring from an Android device to a computer. It streams the device’s display to the computer screen and forwards input (touchscreen, keys, etc.) from the computer to the device [1]. This provides low latency, high framerate video streaming for a smooth mirroring experience.

Some key capabilities of scrcpy’s video streaming include:

  • Displays device screen in real-time on the computer.
  • Supports full HD resolution (1920×1080).
  • Achieves high FPS (up to 60fps depending on hardware).
  • Low latency (~16ms)
  • Customizable bitrate, FPS, and resolution.
  • Forwards input events from computer to device.

In summary, scrcpy leverages the power of the computer while remotely controlling an Android device for an optimized screen mirroring and control experience.

Scrcpy’s audio capabilities

Scrcpy has the ability to mirror audio from an Android device to a computer. This allows you to hear the sounds coming from your Android device through your computer’s speakers or headphones. To enable audio mirroring in scrcpy, you need to pass the –audio-bit-rate flag when starting scrcpy.

For example:

scrcpy –audio-bit-rate 192K

This will mirror the audio at a bitrate of 192kbps. The audio mirroring happens in real-time with very little lag or latency. So sounds from videos, games, phone calls etc. on your Android device will be played back instantly on your computer.

Scrcpy leverages the Android Debug Bridge (ADB) to capture the raw audio data and stream it to your computer over USB or wirelessly. This allows it to mirror any audio coming out of your Android device, whether it’s music, videos, games, notifications etc.

One limitation with scrcpy’s audio mirroring is that it does not allow simultaneous playback of audio on both the Android device and computer. The audio will either play on the Android device or the computer, not both at the same time. There are unofficial mods that can enable simultaneous audio, but it is not officially supported in the base scrcpy application.

Enabling audio in scrcpy

By default, audio is disabled in scrcpy for devices running Android 10 or lower. To enable audio forwarding, you must pass the --show-touches CLI argument when launching scrcpy as per the scrcpy documentation:

scrcpy --show-touches

This will enable audio forwarding for supported Android versions. Without this flag, you will only get video mirroring even if your device supports audio forwarding. The --show-touches flag acts as a manual toggle to opt-in to audio forwarding.

Audio Codecs Supported

Scrcpy supports common audio codecs like AAC and Opus when audio forwarding is enabled. According to the Scrcpy documentation, the supported audio codecs depend on the Android version:

– Android 11 and 12: AAC

– Android 13 and newer: Opus

The audio is encoded on the Android device before being forwarded to the computer running scrcpy. This means scrcpy supports any audio codec available on the Android device, rather than being limited to specific codecs on the receiving computer.

According to the Scrcpy release notes, Opus support was added in Scrcpy v1.17 for improved audio quality and lower latency. The Opus codec is now the default for Android 13 and newer due to its superior compression and performance compared to AAC.

In summary, Scrcpy leverages the audio codec support already present on the Android device, with AAC and Opus being the primary codecs used. The choice of codec depends on the Android version for optimal performance.

Audio quality

Scrcpy’s audio quality depends mainly on the device being mirrored and the connection speed between the device and computer. Since scrcpy transmits audio over a direct adb connection, audio quality can vary.

On most modern Android devices with good onboard audio components, scrcpy is capable of transmitting high quality, low latency audio when connected over a fast wired connection like USB. This allows it to mirror audio clearly and without much lag or artifacting.

However, when connecting wirelessly over Wi-Fi, audio quality may suffer due to network congestion or interference. Latency and choppiness in the audio stream may occur, degrading the experience. Audio artifacts or echos could be introduced as well.

Ultimately, scrcpy’s audio quality is only as good as the source device and connection. For best results, use a high end Android device connected via USB. Wireless connections will provide more variable audio performance.

Audio Lag

Like any wireless audio streaming technology, scrcpy’s audio transmission can suffer from lag or latency issues. This is because the audio data needs to be encoded on the device, transmitted over WiFi, and then decoded on the computer – all in real time. Each of these steps introduces a slight delay.

The amount of lag will depend mainly on two factors: the WiFi connection bandwidth and stability, and the audio codec bitrate. If the connection is poor or congested, packets may get dropped or delayed during transmission, leading to choppy audio. Similarly, lower bitrate codecs will have more compression artifacts and latency.

If you experience laggy audio in scrcpy, try increasing the bitrate under Settings > Bitrate. For example, boost it from the default 128kbps to 192kbps or higher. This reduces compression and allows faster encoding/decoding. Just keep in mind higher bitrates require more bandwidth. Also make sure your WiFi connection is strong in the area and free of interference.

With good connectivity and optimal bitrate settings, scrcpy’s audio delay should be hardly noticeable for most purposes, like watching videos or gaming. But sound engineers or musicians may still perceive a slight lag compared to wired solutions. Overall the audio performance is quite impressive given it’s wireless mirroring.

Use cases

Scrcpy has many use cases beyond personal screen mirroring. It is commonly used for demonstrations, presentations, and testing applications across different devices. The seamless screen mirroring capabilities make scrcpy an excellent tool for situations when a physical display of an Android device is needed.

For example, developers can use scrcpy to showcase their Android apps during presentations to clients or at conferences. They can mirror the Android device screen to a larger display, allowing the audience to see the app clearly as the developer walks through different features and workflows.

Teachers also benefit from scrcpy for classroom demonstrations. Connecting an Android device to a projector via scrcpy allows the whole class to follow along as the teacher shows educational apps, science simulations, or other interactive learning content from the device screen.

Moreover, QA testers and app reviewers can use scrcpy to mirror Android screens to their workstations for efficient testing across multiple real devices. Seeing the apps functioning on the actual devices (vs. emulators) allows for more accurate UI and UX testing.

According to one source, scrcpy’s use cases extend beyond personal and professional contexts to encompass educational scenarios as well. The software provides educators with a tool to wirelessly demonstrate learning applications to an entire classroom.

Limitations

Scrcpy has some audio limitations to be aware of. According to the scrcpy GitHub issues, some users have reported crackling or glitchy audio when using scrcpy, especially at higher bitrates. The audio playback relies on requesting small 5ms chunks of audio data, which can sometimes lead to gaps or discontinuities in the audio stream.

There are also complaints about low audio volume levels when casting the device’s audio to the computer, like in this Reddit thread. So users may need to max out their computer’s volume to hear audio properly from the mirrored device.

According to the scrcpy documentation, if audio capture fails for any reason, scrcpy will continue mirroring just the video. This prevents full app failure, but it means you may sometimes lose audio during a screen casting session.

While scrcpy handles audio, it’s mainly focused and optimized for low-latency, high framerate video mirroring. So there are some inherent audio limitations compared to a full-featured remote desktop tool.

Summary

scrcpy is an open-source application that mirrors Android device screens to desktop computers. It is primarily designed for video mirroring, but also has the ability to stream audio from the device to the computer. To enable audio support in scrcpy, the –audio-codec option must be specified along with the desired codec when launching scrcpy. The application supports common codecs like AAC and Opus for audio transmission. The audio quality and lag depends on factors like the codec used and network conditions. The audio feature allows scrcpy to be used for various purposes like demonstrating apps, remote support, and gaming. However, the audio transmission is still considered experimental and has some limitations around stability and synchronization. In summary, scrcpy does provide the ability to stream audio along with screen mirroring, but performance may vary depending on use case requirements.

Leave a Reply

Your email address will not be published. Required fields are marked *