MENU

#笔记#利用Scrcpy进行安卓投屏

June 24, 2019 • Read: 1257 • 网络笔记

这里主要使用的是Linux,更多的还是介绍这个项目,因为大家的操作系统不一,而我又没有现成的Windows给大家测试,而且如果真的需要投屏的话,Windows上还是有很多优秀的软件的,所以这里我只用了Linux跟Mac来进行测试。

项目地址:https://github.com/Genymobile/scrcpy/

开始

首先我们需要将手机的USB调试打开,各个机型不一样,大家可以百度一下手机型号+USB调试打开。

Macbook上使用

根据提示在终端输入

brew install scrcpy
brew cask install android-platform-tools

等待安装完成后在终端输入scrcpy即可连接。

Linux上使用

Linux上主要看文档,因为发行版本有很多。

arch linux 安装需要使用sudo pacman -S scrcpy

Scrcpy命令行使用

Options:

    -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). 支持单位后缀 K 和 M
        Default is 8000000. 默认是8M
假设要设置为2M 2K
scrcpy -b 2m  
scrcpy -b 2K
    -c, --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.

    -h, --help  //命令行帮助说明
        Print this help.

    -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).

    -p, --port port 
        Set the TCP port the client listens on. 设置客户端tcp监听端口
        Default is 27183. 默认是27183

    -s, --serial
        The device serial number. Mandatory only if several devices 安卓设备序列号
        are connected to adb.

    -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. 显示scrcpy 版本

Shortcuts: 快捷键

    Ctrl+f
        switch fullscreen mode  切换显示全屏

    Ctrl+g
        resize window to 1:1 (pixel-perfect) 切换显示为安卓设备分辨率1:1效果

    Ctrl+x
    Double-click on black borders 也可以显示界面黑边双击
        resize window to remove black borders 来去除黑边

    Ctrl+h
    Home
    Middle-click 也可以使用鼠标中键
        click on HOME 来返回home界面

    Ctrl+b
    Ctrl+Backspace
    Right-click (when screen is on) 当屏幕唤醒时可以使用鼠标右键
        click on BACK 来返回

    Ctrl+s
        click on APP_SWITCH app切换界面

    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) 显示界面黑屏时
        turn screen on 来打开屏幕

    Ctrl+v
        paste computer clipboard to device 电脑剪贴板的文字粘贴到安卓设备上

    Ctrl+i
        enable/disable FPS counter (print frames/second in logs) 控制fps的显示

    Drag & drop APK file 拖动apk文件
        install APK from computer 来安装apk文件
Archives QR Code Tip
QR Code for this page
Tipping QR Code
Leave a Comment

2 Comments
  1. 这种效果如何,延迟大不大

    1. @奶爸建网站笔记上班摸鱼就是用这个玩点小游戏的,延迟我感觉还可以,非常好。