分享一个好用的Android投屏工具-scrcpy

远程办公,但android设备不在身边,怎么办?

别急,scrcpy来解决!

目录

简单介绍

效果视频

使用步骤

命令行操作

简单介绍

scrcpy可通过adb调试的方式来将手机屏幕投到电脑上,并可以通过电脑控制您的Android设备。它可以通过USB连接,也可以通过网络连接,重要的是,使用这个工具,不需要root权限,不需要在手机里安装任何程序,免费开源。

Github:https://github.com/Genymobile/scrcpy
下载地址:https://github.com/Genymobile/scrcpy/releases

软件安装和使用平台(Linux Windows MacOs)在开源地址上有介绍,这里不做过多介绍。

Windows上使用的工具包可以我网盘下载:

链接:https://pan.baidu.com/s/18D83zM2MCRDAuxezkFiXvw 
提取码:5vz8 
 

效果视频

scrcpy投屏演示效果

 

使用步骤

android设备打开adb调式模式,使用usb数据线连接设备和PC。

鼠标点击解压目录下的scrcpy.exe或者scrcpy-noconsole.exe既可以运行启动投屏界面。

当然直接点击,工具很多功能就无法使用。

如果想使用工具的一些其他功能,建议使用命令行方式加相关参数运行。

命令行操作

scrcpy --help 可以看到工具的命令行用法及界面操作快捷键:

Usage: scrcpy [options]

Options:

    --always-on-top
        Make scrcpy window always on top (above other windows).

    -b, --bit-rate value
        Encode the video at the given bit-rate, expressed in bits/s.
        Unit suffixes are supported: 'K' (x1000) and 'M' (x1000000).
        Default is 8000000.

    --crop width:height:x:y
        Crop the device screen on the server.
        The values are expressed in the device natural orientation
        (typically, portrait for a phone, landscape for a tablet).
        Any --max-size value is computed on the cropped size.

    -f, --fullscreen
        Start in fullscreen.

    -h, --help
        Print this help.

    --max-fps value
        Limit the frame rate of screen capture (only supported on
        devices with Android >= 10).

    -m, --max-size value
        Limit both the width and height of the video to value. The
        other dimension is computed so that the device aspect-ratio
        is preserved.
        Default is 0 (unlimited).

    -n, --no-control
        Disable device control (mirror the device in read-only).

    -N, --no-display
        Do not display device (only when screen recording is
        enabled).

    -p, --port port
        Set the TCP port the client listens on.
        Default is 27183.

    --prefer-text
        Inject alpha characters and space as text events instead of
        key events.
        This avoids issues when combining multiple keys to enter a
        special character, but breaks the expected behavior of alpha
        keys in games (typically WASD).

    --push-target path
        Set the target directory for pushing files to the device by
        drag & drop. It is passed as-is to "adb push".
        Default is "/sdcard/".

    -r, --record file.mp4
        Record screen to file.
        The format is determined by the --record-format option if
        set, or by the file extension (.mp4 or .mkv).

    --record-format format
        Force recording format (either mp4 or mkv).

    --render-expired-frames
        By default, to minimize latency, scrcpy always renders the
        last available decoded frame, and drops any previous ones.
        This flag forces to render all frames, at a cost of a
        possible increased latency.

    -s, --serial serial
        The device serial number. Mandatory only if several devices
        are connected to adb.

    -S, --turn-screen-off
        Turn the device screen off immediately.

    -t, --show-touches
        Enable "show touches" on start, disable on quit.
        It only shows physical touches (not clicks from scrcpy).

    -v, --version
        Print the version of scrcpy.

    --window-borderless
        Disable window decorations (display borderless window).

    --window-title text
        Set a custom window title.

    --window-x value
        Set the initial window horizontal position.
        Default is -1 (automatic).

    --window-y value
        Set the initial window vertical position.
        Default is -1 (automatic).

    --window-width value
        Set the initial window width.
        Default is 0 (automatic).

    --window-height value
        Set the initial window width.
        Default is 0 (automatic).

Shortcuts:

    Ctrl+f
        switch fullscreen mode

    Ctrl+g
        resize window to 1:1 (pixel-perfect)

    Ctrl+x
    Double-click on black borders
        resize window to remove black borders

    Ctrl+h
    Middle-click
        click on HOME

    Ctrl+b
    Ctrl+Backspace
    Right-click (when screen is on)
        click on BACK

    Ctrl+s
        click on APP_SWITCH

    Ctrl+m
        click on MENU

    Ctrl+Up
        click on VOLUME_UP

    Ctrl+Down
        click on VOLUME_DOWN

    Ctrl+p
        click on POWER (turn screen on/off)

    Right-click (when screen is off)
        power on

    Ctrl+o
        turn device screen off (keep mirroring)

    Ctrl+r
        rotate device screen

    Ctrl+n
       expand notification panel

    Ctrl+Shift+n
       collapse notification panel

    Ctrl+c
        copy device clipboard to computer

    Ctrl+v
        paste computer clipboard to device

    Ctrl+Shift+v
        copy computer clipboard to device

    Ctrl+i
        enable/disable FPS counter (print frames/second in logs)

    Drag & drop APK file
        install APK from computer

提几个常用的指令:

启动scrcpy:
scrcpy
如果有多个设备,需要指定序列号:
scrcpy -s 设备序列号

置顶显示投屏窗口
scrcpy --always-on-top

以全屏方式启动:
scrcpy -f

设置端口:
scrcpy -p 27184

查看帮助:
scrcpy -h

设置码率(默认8M):
scrcpy -b 8M

设置最大fps值:
scrcpy --max-fps value

限制投屏尺寸:
scrcpy -m 1024

裁剪投屏屏幕(长:宽:偏移x:偏移y):
scrcpy -c 800:800:0:0

投屏并录屏:
scrcpy -r file.mp4

不投屏只录屏:
scrcpy -Nr file.mp4

手指触摸的时候显示轨迹:
scrcpy -t

显示版本信息:
scrcpy -v

工具的快捷键

动作快捷键
全屏/非全屏切换Ctrl+f
将窗口调整为1:1(完美像素)Ctrl+g
调整窗口大小以删除黑色边框Ctrl+x
设备HomeCtrl+h|鼠标中间键
设备BackCtrl+b | 鼠标右键| Ctrl+Backspace
设备最近任务键Ctrl+s
设备MenuCtrl+m
设备音量↑Ctrl+↑
设备音量↓Ctrl+↓
设备电源键Ctrl+p
亮屏(屏幕灭屏状态)鼠标右键
灭屏Ctrl+o
旋转屏幕Ctrl+r
展开通知栏Ctrl+n
收缩通知栏Ctrl+Shift+n
将设备粘贴板的内容粘贴到PCCtrl+c
将PC粘贴板内容粘贴到设备Ctrl+v|Ctrl+Shift+v
打开关闭FPS计数器(命令行中显示)Ctrl+i
安装apkDrag & drop APK file
  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 5
    评论
Scrcpy是一个用于在计算机上控制和显示Android设备幕的开源工具。它通过USB连接将Android设备与计算机进行通信,并使用ADB(Android Debug Bridge)协议来发送和接收设备幕的图像和输入事件。 Scrcpy的原理可以简单概括为以下几个步骤: 1. 连接设备:Scrcpy首先通过ADB连接到Android设备。ADB是一个用于与Android设备通信的命令行工具,它允许Scrcpy发送和接收设备幕的数据。 2. 获取设备幕信息:Scrcpy获取设备幕的分辨率、像素格式等信息,以便正确地显示设备幕。 3. 创建显示窗口:Scrcpy在计算机上创建一个显示窗口,用于显示设备幕的图像。 4. 接收和解码视频流:Scrcpy通过ADB接收设备幕的视频流数据,并使用FFmpeg库对视频流进行解码。解码后的视频帧可以在计算机上进行显示。 5. 显示视频帧:Scrcpy将解码后的视频帧显示在计算机上的显示窗口中,实现实时显示设备幕。 6. 处理输入事件:Scrcpy通过ADB发送计算机上的输入事件(如鼠标点击、键盘输入)到Android设备,实现对设备的控制。 7. 循环处理事件:Scrcpy使用一个事件循环来处理设备幕的变化和用户输入事件。它等待来自设备的事件,并根据事件类型执行相应的操作,如更新显示窗口、发送输入事件等。 总结起来,Scrcpy通过ADB连接到Android设备,接收和解码设备幕的视频流,并将解码后的视频帧显示在计算机上的窗口中,同时将计算机上的输入事件发送到Android设备,实现对设备幕的控制。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

IT_熊

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值