v1.18

Genymobile/scrcpyv1.18Jun 20, 2021by rom1v

AI Summary

This release adds support for Android 12 and introduces V4L2 webcam support for Linux, allowing the device screen to be used as a camera source.

Key Highlights

  • Native support for Android 12 with adjustments for secure displays and settings access.
  • New V4L2 sink option for Linux to expose the device screen as a webcam.
  • New `--power-off-on-close` option to automatically turn off the device when closing the mirror window.
  • New bindings for the 4th and 5th mouse buttons (APP_SWITCH and notification panel).

New Features

  • Android 12 support
  • V4L2 webcam sink
  • Power off on close
  • New mouse button bindings
  • Resize-to-fit window centering
  • Log input events in verbose mode

Full Release Notes

_To receive a notification on new releases, click on **Watch > Releases only** on the top._

---

**scrcpy v1.18**

Changes since v1.17:
 - Add support for Android 12 (#2129, #2402)
 - Add support for V4L2 (device screen capture as a webcam) (#2232, #2233, #2268)
 - Add an option to lock the initial video orientation
 - Add an option to power off the device on close (#824)
 - Bind 4th mouse button to APP_SWITCH (#2258)
 - Bind 5th mouse button to expand notification panel (#2258)
 - Expand settings panel on double-expand notification panel (#2260, #2264)
 - Push to /sdcard/Download by default (#2384)
 - Center the window on resize-to-fit (#2387)
 - Increase possible display id range (#2009)
 - Log input events in verbose mode (#2371)
 - Fix touch events parameters (#2125)
 - Fix left click on Samsung Browser (#2169)
 - Remove option --render-expired-frames (#2268)
 - Pass scrcpy-noconsole arguments through to scrcpy on Windows (#2052)
 - Upgrade platform-tools to 31.0.2 (adb) in Windows releases
 - Various technical fixes

---

# Highlights


## Android 12

Since Android 12, creating a secure display with shell permissions is not permitted anymore (#2129). As a consequence, [protected content] may not be mirrored on Android 12. To avoid an immediate crash when mirroring a device with Android 12 (preview), create a non-secure display. This is basically a revert of the fix for #36.

[protected content]: https://developer.android.com/reference/android/view/WindowManager.LayoutParams#FLAG_SECURE

Android 12 also required some changes from scrcpy to write to the settings, needed for `--stay-awake` and `--show-touches` (#2402).


## V4L2 (device screen capture as a webcam)

On Linux, a [V4L2] sink (#2268) allows to expose the device screen as a webcam on the computer.

Once a new video device is created with `v4l2loopback` (for example `/dev/video1`), scrcpy can expose the video stream as a webcam instead of (or in addition to) displaying it in a window:

```
scrcpy --v4l2-sink=/dev/video1 --no-display
```

More details [here](https://github.com/Genymobile/scrcpy#v4l2loopback).

The stream can then be opened with any V4L2-capable software. This allows for example expose the device screen to your favorite video-conference tool or to capture it directly from [OBS] (select `Video Capture Device (V4L2)` as a source).

[V4L2]: https://en.wikipedia.org/wiki/Video4Linux
[OBS]: https://obsproject.com/


## Lock video orientation

The option to [lock the video orientation](https://github.com/Genymobile/scrcpy#lock-video-orientation) now allows to lock the initial orientation. This avoids to pass an explicit orientation value.

It also simplifies V4L2 usage, which does not support video dimension changes.


## Power off on close

On closing scrcpy, a new option to power off the device automatically (#824):

```
scrcpy --power-off-on-close
```


## New shortcuts

The 4th and 5th buttons were not used. Now, the 4th button triggers `APP_SWITCH` and the 5th expands the notification panel on single click and the settings panel on double click (#2258, #2260, #2264).

The keyboard shortcut <kbd>MOD</kbd>+<kbd>n</kbd>+<kbd>n</kbd> has also been added to expand the settings panel.


## Resize to fit

When the scrcpy window is resized, black borders may be added to preserve the aspect ratio of the device screen. It is possible to automatically resize the window to remove them (<kbd>MOD</kbd>+<kbd>w</kbd> or double click).

However, it preserved the left-corner location of the window. Now, it preserves the device screen content location (#2387).


## Push to `/sdcard/Download/`

A file drag&drop to the scrcpy window used to push to `/sdcard/` by default. Now the default is `/sdcard/Download/`.
    
It can still be changed by `--push-target`.


## Log input events

In verbose mode (`scrcpy -Vverbose`), all input events sent to the device are printed in the console (#2371). This can be useful for debugging.