scrcpy icon indicating copy to clipboard operation
scrcpy copied to clipboard

Video stream is not centered in the window

Open deoxal opened this issue 1 year ago • 4 comments

The mirrored screen is displayed on the edges of the window. It the position varies depending the app. Ideally I would like to resize the mirrored screen and potentially stretch it so it fits my entire screen.

Screenshot 2024-08-14_23-40-29

  • OS: [Mint 21.3]
  • Scrcpy version: [2.6.1]
  • Installation method: [manual build]
  • Device model: Pixel 8a
  • Android version: [14]

This is amazing software though. I've wanted to do this for years but couldn't until now.

deoxal avatar Aug 15 '24 05:08 deoxal

One pair of black bars is added by your phone to match the phone aspect ratio. Scrcpy mirrors the whole phone screen (including these bars), but the result does not match your computer screen, so it adds black bars.

To avoid the problem, one solution could be to crop mirroring with --crop=…, unfortunately this is broken since Android 14: #4011.

The other solution is to change your physical device screen resolution to match the aspect ratio of your computer display (adb shell wm size …).

rom1v avatar Aug 16 '24 12:08 rom1v

Is the cropping being done on the phone with that method? Why can't the video be cropped by my PC?

Also this doesn't happen with every app. I'm playing Space Marshals and it happens with 1 but not 2 or 3. I haven't found any other app that does it so far.

deoxal avatar Aug 19 '24 16:08 deoxal

Is the cropping being done on the phone with that method?

Are there any black bars on your phone?

Please run scrcpy but keep the window windowed (not maximized). How is the content? Please post a screenshot.

Also, please record a few seconds on the app you're mirring with scrcpy --record=file.mp4, and post the result.

rom1v avatar Aug 19 '24 17:08 rom1v

Screenshot 2024-08-19_17-38-39

Yes I measured it out by showing the pointer location setting in developer options. A width of 120 pixels are used for a black bar to mask the camera being under the display, it stays with the camera even when I flip the phone. My phone screen is 2400 x 1080

The screenshot shows it on the other side. And shrinking the window causes the black bar to scale down with the rest of the display.

https://youtu.be/rEEeb68QsuQ?si=VCz42n0hNLhxDPzm&t=31

deoxal avatar Aug 19 '24 22:08 deoxal