Giter Club home page Giter Club logo

qtscrcpy's Introduction

QtScrcpy

Financial Contributors to Open Collective Windows MacOS Ubuntu

license release

中文用户?点我查看中文介绍

QtScrcpy supports displaying and controlling Android devices via USB or over network. It does NOT require root privileges.

It supports three major platforms: GNU/Linux, Windows and macOS.

It focuses on:

  • lightness (displays only the device screen)
  • performance (30~60 fps)
  • quality (1920×1080 or above)
  • low latency (35~70ms)
  • low startup time (only about 1 second to display the first frame)
  • non-intrusiveness (nothing will be installed on the device)

win

mac

linux

Mapping Keys

You can write your script to map keyboard and mouse actions to touches and clicks of the mobile phone according to your needs. Here are the script writing rules.

Script for TikTok and some other games are provided by default. Once enabled, you can play the game with your keyboard and mouse. The default key mapping for PUBG Mobile is as follows:

game

Here is a video demonstration playing PUBG Mobile.

Instruction for adding new customized mapping files.

  • Write a customized script and put it in the keymap directory
  • Click refresh script to show it
  • Select your script
  • Connect to your phone, start service and click apply
  • Press ~ key (the SwitchKey in the key map script) to switch to custom mapping mode
  • Press the ~ key again to switch back to normal mode
  • (For games such as PUBG Mobile) If you want to move vehicles with the STEER_WHEEL keys, you need to set the move mode to single rocker mode.

Group control

You can control all your phones at the same time.

group-control-demo

Thanks

QtScrcpy is based on Genymobile's scrcpy project. Thanks a lot!

The difference between QtScrcpy and the original scrcpy is as follows:

key points scrcpy QtScrcpy
ui sdl qt
video encode ffmpeg ffmpeg
video render sdl opengl
cross-platform self implemented provided by Qt
language C C++
style sync async
keymap no custom keymap support custom keymap
build meson+gradle qmake or CMake
  • It's very easy to customize your GUI with Qt
  • Asynchronous programming of Qt-based signal slot mechanism improves performance
  • Easy to learn
  • Add support for multi-touch

Learn

If you are interested in it and want to learn how it works but do not know how to get started, you can choose to purchase my recorded video lessons. It details the development architecture and the development process of the entire software and helps you develop QtScrcpy from scratch.

Course introduction:https://blog.csdn.net/rankun1/article/details/87970523

You can join my QQ group for QtScrcpy and exchange ideas with like-minded friends.:

QQ Group number:901736468

Requirements

Android API >= 21 (Android 5.0).

Make sure you have enabled ADB debugging on your device(s).

Download

Windows

On Windows, for simplicity, prebuilt archives with all the dependencies (including ADB) are available at Releases:

or you can build it yourself

Mac OS

On Mac OS, for simplicity, prebuilt archives with all the dependencies (including ADB) are available at Releases:

or you can build it yourself

Linux

For Arch Linux Users, you can use AUR to install: yay -Syu qtscrcpy (may be outdated; maintainer: yochananmarqos)

For users in other distros, you can use the prebuilt archives from Releases:

or you can get it at GitHub Actions, in branch dev and download the latest artifact.

or you can build it yourself (not recommended, get it in Actions if you can)

Run

Connect to your Android device on your computer, then run the program and click USB connect or WiFi connect

Wireless connection steps (ensure that the mobile phone and PC are on the same LAN):

  1. Enable USB debugging in developer options on the Android device
  2. Connect the Android device to the computer via USB
  3. Click update device, and you will see that the device number is updated
  4. Click get device IP
  5. Click start adbd
  6. Click wireless connect
  7. Click update device again, and another device with an IP address will be found. Select this device.
  8. Click start service

Note: it is not necessary to keep your Android device connected via USB after you start adbd.

Interface button introduction:

  • Start config: function parameter settings before starting the service

    You can set the bit rate, resolution, recording format, and video save path of the locally recorded video.

    • Background record: the Android device screen is not displayed after starting the service. It is recorded in the background.
    • Always on top: the video window for Android devices will be kept on the top
    • Close screen: automatically turn off the Android device screen to save power after starting the service
    • Reverse connection: service startup mode. You can uncheck it if you experience connection failure with a message more than one device
  • Refresh devices: Refresh the currently connected device

  • Start service: connect to the Android device

  • Stop service: disconnect from the Android device

  • Stop all services: disconnect all connected Android devices

  • Get device IP: Get the IP address of the Android device and update it to the "Wireless" area for the ease of wireless connection setting.

  • Start adbd: Start the adbd service of the Android device. You must start it before the wireless connection.

  • Wireless connect: Connect to Android devices wirelessly

  • Wireless disconnect: Disconnect wirelessly connected Android devices

  • adb command: execute customized ADB commands (blocking commands are not supported now, such as a shell)

The main function

  • Display Android device screens in real-time

  • Real-time mouse and keyboard control of Android devices

  • Screen recording

  • Screenshot to png

  • Wireless connection

  • Supports multiple device connections

  • Full-screen display

  • Display on the top

  • Install apk: drag and drop apk to the video window to install

  • Transfer files: Drag files to the video window to send files to Android devices

  • Background recording: record only, no display interface

  • Copy-paste

    It is possible to synchronize clipboards between the computer and the device, in both directions:

    • Ctrl + c copies the device clipboard to the computer clipboard;
    • Ctrl + Shift + v copies the computer clipboard to the device clipboard;
    • Ctrl + v pastes the computer clipboard as a sequence of text events (non-ASCII characters does not yet work).
  • Group control

  • Sync device speaker sound to the computer (based on sndcpy, Android 10+ only)

Shortcuts

Action Shortcut (Windows) Shortcut (macOS)
Switch fullscreen mode Ctrl+f Cmd+f
Resize window to 1:1 (pixel-perfect) Ctrl+g Cmd+g
Resize window to remove black borders Ctrl+w | Double-click¹ Cmd+w | Double-click¹
Click on HOME Ctrl+h | Middle-click Ctrl+h | Middle-click
Click on BACK Ctrl+b | Right-click² Cmd+b | Right-click²
Click on APP_SWITCH Ctrl+s Cmd+s
Click on MENU Ctrl+m Ctrl+m
Click on VOLUME_UP Ctrl+ (up) Cmd+ (up)
Click on VOLUME_DOWN Ctrl+ (down) Cmd+ (down)
Click on POWER Ctrl+p Cmd+p
Power on Right-click² Right-click²
Turn device screen off (keep mirroring) Ctrl+o Cmd+o
Expand notification panel Ctrl+n Cmd+n
Collapse notification panel Ctrl+Shift+n Cmd+Shift+n
Copy to clipboard³ Ctrl+c Cmd+c
Cut to clipboard³ Ctrl+x Cmd+x
Synchronize clipboards and paste³ Ctrl+v Cmd+v
Inject computer clipboard text Ctrl+Shift+v Cmd+Shift+v

¹Double-click on black borders to remove them.

²Right-click turns the screen on if it was off, presses BACK otherwise.

³Only on Android >= 7.

TODO

TODO

FAQ

FAQ

DEVELOP

DEVELOP

Everyone is welcome to maintain this project and contribute your own code, but please follow these requirements:

  1. Please open PRs to the dev branch instead of the master branch
  2. Please rebase the original project before opening PRs
  3. Please submit PRs on the principle of "small amounts, many times" (one PR for a change is recommended)
  4. Please keep the code style consistent with the existing style.

Why develop QtScrcpy?

There are several reasons listed below according to importance (high to low).

  1. In the process of learning Qt, I need a real project to try.
  2. I have some background skills in audio and video and I am interested in them.
  3. I have some Android development skills. But I have used it for a long time. I want to consolidate it.
  4. I found scrcpy and decided to re-make it with the new technology stack (C++ + Qt + Opengl + FFmpeg).

Build

All the dependencies are provided and it is easy to compile.

QtScrcpy

Non-Arch Linux Users

  1. Set up the Qt development environment with the official Qt installer or third-party tools such as aqt on the target platform. Qt version bigger than 5.12 is required. (use MSVC 2019 on Windows)
  2. Clone the project with git clone --recurse-submodules [email protected]:barry-ran/QtScrcpy.git
  3. For Windows, open CMakeLists.txt with QtCreator and compile Release
  4. For Linux, directly run ./ci/linux/build_for_linux.sh "Release" Note: compiled artifacts are located at output/x64/Release

Arch Linux Users

  1. Install packages: base-devel cmake qt5-base qt5-multimedia qt5-x11extras (qtcreator is recommended)
  2. Clone the project with git clone --recurse-submodules [email protected]:barry-ran/QtScrcpy.git
  3. Run ./ci/linux/build_for_linux.sh "Release"

Scrcpy-Server

  1. Set up Android development environment on the target platform
  2. Open server project in project root with Android Studio
  3. The first time you open it, if you do not have the corresponding version of Gradle, you will be prompted to find Gradle, whether to upgrade Gradle or create it. Select Cancel. After cancelling, you will be prompted to select the location of existing Gradle. Cancel it too and it will download automatically.
  4. After compiling the apk, rename it to scrcpy-server and replace QtScrcpy/QtScrcpyCore/src/third_party/scrcpy-server.

Licence

Since it is based on scrcpy, it uses the same license as scrcpy

Copyright (C) 2025 Rankun

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About the author

Barry CSDN

An ordinary programmer, working mainly in C++ for desktop client development, graduated from Shandong for more than a year of steel simulation education software, and later moved to Shanghai to work in security, online education-related fields, familiar with audio and video. I have an understanding of audio and video fields such as voice calls, live education, video conferencing and other related solutions. I also have experience in Android, Linux servers and other kinds of development.

Contributors

Code Contributors

This project exists thanks to all the people who contribute. [Contribute].

Financial Contributors

Become a financial contributor and help us sustain our community. [Contribute]

Individuals

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]

qtscrcpy's People

Contributors

barry-ran avatar feyxiexzf avatar frzmtrsprt avatar ifdu-code avatar jabin-ma avatar jaredtao avatar leiyu-uniontech avatar liangent avatar matteobaccan avatar msnh2012 avatar rainbowxie avatar re2zero avatar shengyu7697 avatar shenzhigang avatar thelumbee avatar yamakuzure avatar yxtj avatar zeroo28 avatar zxfksie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qtscrcpy's Issues

一些建议

建议做一个选项去处边框(这个软件很低的延迟和流畅度真的是很好,但是直播的话会有个大边框)
建议做一个设置保存(因为每次打开软件都要重新设置更高的码率分辨率)
开放更高的码率(这个我觉得可做可不做233)

无线功能很不稳定

Android:9
rom:funtouchOS_9
打开了usb调试模式
7月第一次安装是可以无线的 后来就一直不行了
按教程走到启动adbd后
点击无线连接会等待1min 然后返回链接失败 可是重复点击就显示已经链接了 哪怕是点击无线断开后点击无线连接 仍然显示已经链接 然后刷新列表
`update devices...
adb run
AdbProcess::out:List of devices attached

AdbProcess::error:* daemon not running; starting now at tcp:5037

  • daemon started successfully

update devices...
adb run
AdbProcess::out:List of devices attached
9bbd2b54 device

get ip...
adb run
AdbProcess::out:wlan0 Link encap:UNSPEC Driver icnss
inet addr:192.168.8.100 Bcast:192.168.8.255 Mask:255.255.255.0
inet6 addr: fe80::9663:72ff:fe8c:d09f/64 Scope: Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4541 errors:0 dropped:0 overruns:0 frame:0
TX packets:5580 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3000
RX bytes:3178241 TX bytes:791819

start devices adbd...
adb run
AdbProcess::out:restarting in TCP mode port: 5555

wireless connect...
adb run
AdbProcess::out:failed to connect to 192.168.8.100:5555

wireless connect...
adb run
AdbProcess::out:already connected to 192.168.8.100:5555

wireless disconnect...
adb run
AdbProcess::out:disconnected 192.168.8.100

update devices...
adb run
AdbProcess::out:List of devices attached
9bbd2b54 device
192.168.8.100:5555 offline

wireless connect...
adb run
wait for the end of the current command to run

AdbProcess::out:failed to connect to 192.168.8.100:5555

wireless connect...
adb run
AdbProcess::out:already connected to 192.168.8.100:5555

update devices...
adb run
AdbProcess::out:List of devices attached
9bbd2b54 device
192.168.8.100:5555 offline
`

关于和平精英脚本

很高兴大佬弄了和平精英按键脚本映射支持,我和朋友试玩了几局,发现有一点小bug,就是小眼睛按键能用但是视角转不动,我不会编程搜了好多看了好多关于脚本的修改,自己弄了好多天还是搞不定,就连某个按键想要换成左下角的Ctrl都不会了。。。。我太难了,希望大佬更新一下脚本呗~~感激不尽

VideoForm::mouseReleaseEvent函数判断逻辑不严谨

void VideoForm::mouseReleaseEvent(QMouseEvent *event)
{
if (ui->videoWidget->geometry().contains(event->pos())) {
if (!m_controller) {
return;
}
event->setLocalPos(ui->videoWidget->mapFrom(this, event->localPos().toPoint()));
m_controller->mouseEvent(event, ui->videoWidget->frameSize(), ui->videoWidget->size());
}
}

如果这时候坐标越界了(即超过可是的video区域),界面可能处在拖动位置的中间。

Video aspect is permanent

Try to connect devices with different aspect ratio (tablets for example) and picture would look stretched/narrow

是否考虑支持音频?

barry你好,
我是一名手机开发者,想问一下是否有考虑过接一下音频的部分。
android Q版本之后可以通过capture audio的权限获取音频了

自定义视频尺寸为480p, 720p, 1080p 以及全屏显示的时候, 对于全面屏手机, 横纵比例会失调

自定义视频尺寸为480p, 720p, 1080p 以及全屏显示的时候, 对于全面屏手机, 横纵比例会失调
如下图1所示为自适应尺寸:
图1

如下图2为启动分辨率为720p的时候, 出现了横纵比例失调:
图片

如下图为竖屏全屏的时候, 只是填充屏幕了:
图片

建议自定义视频尺寸的时候可以先获取屏幕分辨率, 得到x, y的比例, 保持原屏幕的比例; 也建议全屏填充的时候能保持投屏比例.

能否支持坚果R1,三星、华为的大屏模式呢?

可以通过一线通接上一个HDMI的欺骗器,启动大屏模式后,在通过无线的方式或其他方式连接到锤子坚果的TNT或三星的DEX模式,那就太牛了。现在有太多人为了使用大屏模式,买了触控屏。但也有很多人喜欢大屏模式,比如TNT,但是已经有笔记本或PC了,如果能用这种方式解决,应该还是很有市场的,哪怕收费,都会有很多人买的呢。

关于适配屏幕

Hi~ 大佬你好鸭,有一些异形屏手机投屏之后,尺寸会被挤压,希望能更新拉伸~ 谢谢大佬_(:з」∠)_

鼠标滚动问题

很好用,比SCRCPY流畅,用起来也更方便。只有一个小问题:

我的手机是三星S7 Edge/Android 8.0。鼠标滚轮对于PC应用而言,每滚动一下相当于3行。在手机上每滚动一下相当于翻页,和空格键或者翻页键的效果差不多,这个可以接受。微信朋友圈也OK,但是公众号文章的话,每滚动一次会翻十几页,短文章直接就到底了。

在64位Windows 7和10下面均测试过,同样的问题。麻烦看一下。

画面颜色失真

电脑的画面颜色没有手机的鲜艳,比如看直播时,颜色严重偏黄。

添加界面语言手动选择功能

目前的自动选择逻辑是自动根据系统语言选择。对于需要使用英文系统的中文用户不太方便。

而且我发现英文有一些错误,比如录像保存路径被误写成了record save psth。这个错误比较容易发现,但是如果有更复杂的一些问题,不能双语对比会很难发现并引起误解。

发生转屏动作后,比例异常

问题流程如下:
例如此时状态为竖屏切换至横屏.
1.帧大小发生改变.
2.updateShowSize.
3.contentsMargins().
4.根据Margins重新设置宽高
5.resize
6.切换至横屏完成.

问题点在于第3点,由于此时还是处于竖屏状态,所以获取到的实际上是竖屏状态的margins.
将这个竖屏的值应用到横屏宽高的计算中,出现比例异常.

在按键映射功能中添加对游戏手柄的支持

对于很多游戏来说(比如崩坏三,第五人格,阴阳师和一些动作或格斗类游戏),手柄会比鼠标键盘更适合。目前QtScrcpy已经支持了鼠标键盘的按键映射,希望添加对于游戏手柄的按键映射。
技术上可以考虑使用qt的gamepad包来实现游戏手柄的输入逻辑,接下来就可以使用现有的方法映射并传给手机了。
可能的难点在摇杆(D-pad)的映射上。摇杆是360度的,不能简单地对应成某个按键,需要单独添加一类操作。

获取ip地址不严谨

现在的方法只能获取手机和电脑都通过wifi连接下,实际上是无法获取到用户手机的真实IP地址的,

另外一种情况是手机开热点,电脑连接,这时候手机和电脑也在同一个局域网;

adb -s **** shell ifconfig

可以考虑通过,获取wlan swlan rmnet_data下的ip地址;
wlan对于手机和电脑普通wifi连接;
swlan,手机开热点给电脑连接;
rmnet_data手机的真实ip地址;

也不可以不用考虑的这么细致,这个只是个人看法;

VideoForm::mouseMoveEvent界面拖动的BUG;

void VideoForm::mouseMoveEvent(QMouseEvent *event)
{
if (ui->videoWidget->geometry().contains(event->pos())) {
if (!m_controller) {
return;
}
event->setLocalPos(ui->videoWidget->mapFrom(this, event->localPos().toPoint()));
m_controller->mouseEvent(event, ui->videoWidget->frameSize(), ui->videoWidget->size());
} else {
if (event->buttons() & Qt::LeftButton) {
move(event->globalPos() - m_dragPosition);
event->accept();
}
}
}

move(event->globalPos() - m_dragPosition);这会导致拖动的时候,界面被误操作拖动;

How to get correct Phone size?

is there any way to fix screen resolution? my phone looks as if its been squashed since the app shows the phone to be shorter and wider than my phone's actual res which is 1080 x 2340 pixels, 19.5:9 ratio

无法使用

启动或提示 libpng warning:known incorrect sRGB profile

server模块重试机制待完善

正向代理连接的逻辑可以进一步完善,重连socket可能一直连接不上,这时候可以之后,尝试在server模块内,重启服务;

画面问题

屏幕横屏之后,退出横屏,画面会出现拉伸(王牌战士)

Can't we Install after building ?

PC client
Set up the Qt development environment on the target platform (Qt >= 5.9.7, vs >= 2015 (not support mingw))
Clone the project
Open the project root directory all.pro with QtCreator
Compile and run

@barry-ran ... i was wondering how do i install it permanently on my linux system !
Do i have to always run it through QtCreator ?
Would be nice if i could install it as an app and launch it directly !!!

画面上下颠倒

设备型号: ZTEBA610T

问题:
画面与手机外框垂直方向颠倒,但操作与外框方向一致(自上向下滑动可以划出通知栏)

使用安兔兔软件测试多点触控,对比scrcpy的延迟比较明显,对比感觉是数据接收对比比较耗时

1、手机上安装安兔兔测试软件,使用多点触控测试
2、鼠标点击窗口,发现手机上先显示点击的红圈,然后投屏窗口上后显示,对比scrcpy显示是同步的
3、从手机上很快显示点击效果来看说明点击事件传送是ok的,那就是从接受画面数据到渲染的过程不如scrcpy,对比代码看怀疑是接收视频数据的方式qt的信号槽不如c的直接调用

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.