Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
108.58k stars 10.45k forks source link

Texture resolution does not match the device resolution. #4359

Open muenraisi opened 10 months ago

muenraisi commented 10 months ago

Environment

Describe the bug

The emulator resolution is 960X540, which is verified by scrcpy and adb cmd.

>adb shell wm size

Physical size: 540x960

or

>scrcpy  --list-displays

scrcpy 2.1.1 <https://github.com/Genymobile/scrcpy>
INFO: ADB device found:
INFO:     --> (tcpip)       127.0.0.1:16384            device  V2199GA
scr...1 file pushed, 0 skipped. 1.6 MB/s (56995 bytes in 0.034s)
[server] INFO: List of displays:
    --display=0    (960x540)
    --display=2    (960x540)

However, when I use scrcpy, the screen resolution is 960X536. The display resolution height (536) is a little lower than origin height (540), as shown by the scrcpy cmd.

>scrcpy --display=0

scrcpy 2.1.1 <https://github.com/Genymobile/scrcpy>
INFO: ADB device found:
INFO:     --> (tcpip)       127.0.0.1:16384            device  V2199GA
scr...1 file pushed, 0 skipped. 1.6 MB/s (56995 bytes in 0.034s)
[server] INFO: Device: [vivo] vivo V2199GA (Android 12)
INFO: Renderer: direct3d
INFO: Texture: 960x536

When I set the emulator device resolution to any other value e.g.1920X1080, 1280X720, the texture resolution keeps the same.

Once I set the emulator device resolution to 960X540, the texture resolution is 960X536.

rom1v commented 10 months ago

scrcpy rounds the size to a multiple of 8, because many encoders do not support a size which is not multiple of 8.

muenraisi commented 10 months ago

Got it. Many thanks for you help. @rom1v

rom1v commented 10 months ago

You could try to disable this rounding and see if it works for you: https://github.com/Genymobile/scrcpy/blob/1ee46970e373ea3c34c3d9b632fef34982d7a52b/server/src/main/java/com/genymobile/scrcpy/ScreenInfo.java#L110-L135

muenraisi commented 10 months ago

Thanks, this is exact what I am looking for. @rom1v