scrcpy icon indicating copy to clipboard operation
scrcpy copied to clipboard

Screen Mirrored is Inverted

Open kushhh01 opened this issue 4 years ago • 18 comments

  • [ yes ] I have read the FAQ.
  • [ yes ] I have searched in existing issues.

Environment

  • OS: [e.g. Debian (Kali Linux),Windows]
  • scrcpy version: [e.g. 1.13]
  • installation method: [e.g. apt, Windows release...]
  • device model:
  • Android version: [e.g. 10]

Describe the bug A clear and concise description of what the bug is.

On errors, please provide the output of the console (and adb logcat if relevant).

Please paste terminal output in a code block.
INFO: scrcpy 1.12.1 <https://github.com/Genymobile/scrcpy>
/usr/share/scrcpy/scrcpy-server: 1 fil...shed. 0.0 MB/s (24773 bytes in 1.200s)
error: more than one device/emulator
ERROR: "adb reverse" returned with value 1
WARN: 'adb reverse' failed, fallback to 'adb forward'
INFO: Initial texture: 1600x896

Please do not post screenshots of your terminal, just post the content as text instead. When ever I screen mirror any device it gets mirror but inverted like every thing is inverted.

kushhh01 avatar May 11 '20 05:05 kushhh01

Inverted how? Vertically?

If you record with:

adb shell screen record /sdcard/file.mp4
adb pull /sdcard/file.mp4

Is the video "inverted" too?

rom1v avatar May 11 '20 06:05 rom1v

Yes the video too is inverted

On Mon, 11 May, 2020, 12:18 pm Romain Vimont, [email protected] wrote:

Inverted how? Vertically?

If you record with:

adb shell screen record /sdcard/file.mp4 adb pull /sdcard/file.mp4

Is the video "inverted" too?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Genymobile/scrcpy/issues/1380#issuecomment-626506427, or unsubscribe https://github.com/notifications/unsubscribe-auth/APRBYVZATGC6ZBFJYD6TWD3RQ6NVLANCNFSM4M5SYUBQ .

kushhh01 avatar May 11 '20 07:05 kushhh01

OK, so there is a bug in your device ROM.

Is it flipped vertically, or rotated 180°?

If you rotate it twice with Ctrl+ (or scrcpy --rotation 2), does it workaround the problem?

rom1v avatar May 11 '20 08:05 rom1v

It is not flipped it is inverted

On Mon, 11 May, 2020, 1:39 pm Romain Vimont, [email protected] wrote:

Is it flipped vertically, or rotated 180°?

If you rotate it twice with Ctrl+→ (or scrcpy --rotation 2), does it fix the problem?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Genymobile/scrcpy/issues/1380#issuecomment-626544540, or unsubscribe https://github.com/notifications/unsubscribe-auth/APRBYVZBHUDJLQLTEQMFU7TRQ6XFFANCNFSM4M5SYUBQ .

kushhh01 avatar May 11 '20 08:05 kushhh01

What do you mean by inverted, then? Cold you post a screenshot?

rom1v avatar May 11 '20 08:05 rom1v

Yes wait I'll email you the screenshot

On Mon, 11 May, 2020, 1:50 pm Romain Vimont, [email protected] wrote:

What do you mean by inverted, then? Cold you post a screenshot?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Genymobile/scrcpy/issues/1380#issuecomment-626549980, or unsubscribe https://github.com/notifications/unsubscribe-auth/APRBYV6H6KNDALWUVLEE4Y3RQ6YNLANCNFSM4M5SYUBQ .

kushhh01 avatar May 11 '20 08:05 kushhh01

Here is screenshot of how actually inverted it is.

On Mon, 11 May, 2020, 1:54 pm MH12 l Kushhh, [email protected] wrote:

Yes wait I'll email you the screenshot

On Mon, 11 May, 2020, 1:50 pm Romain Vimont, [email protected] wrote:

What do you mean by inverted, then? Cold you post a screenshot?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Genymobile/scrcpy/issues/1380#issuecomment-626549980, or unsubscribe https://github.com/notifications/unsubscribe-auth/APRBYV6H6KNDALWUVLEE4Y3RQ6YNLANCNFSM4M5SYUBQ .

kushhh01 avatar May 11 '20 08:05 kushhh01

You can't send it by email that way, you have to post it on the GitHub thread.

rom1v avatar May 11 '20 08:05 rom1v

Screenshot from 2020-05-11 10-35-18

kushhh01 avatar May 11 '20 09:05 kushhh01

OK so it's flipped (horizontally). This is a bug on your device, and scrcpy does not provide any option to workaround that.

You could force a flip by modifying the source code and building:

diff --git a/app/src/screen.c b/app/src/screen.c
index 0af8de8..14c478e 100644
--- a/app/src/screen.c
+++ b/app/src/screen.c
@@ -444,7 +444,7 @@ screen_update_frame(struct screen *screen, struct video_buffer *vb) {
 void
 screen_render(struct screen *screen) {
     SDL_RenderClear(screen->renderer);
-    if (screen->rotation == 0) {
+    if (false && screen->rotation == 0) {
         SDL_RenderCopy(screen->renderer, screen->texture, NULL, NULL);
     } else {
         // rotation in RenderCopyEx() is clockwise, while screen->rotation is
@@ -464,7 +464,7 @@ screen_render(struct screen *screen) {
         }
 
         SDL_RenderCopyEx(screen->renderer, screen->texture, NULL, dstrect,
-                         angle, NULL, 0);
+                         angle, NULL, SDL_FLIP_HORIZONTAL);
     }
     SDL_RenderPresent(screen->renderer);
 }

rom1v avatar May 11 '20 10:05 rom1v

I have installed it using apt. I haven't built this. So in order to build where exactly can I change source code?

kushhh01 avatar May 12 '20 08:05 kushhh01

I wanted to view my screen flipped for a video-recording studio. This issue has helped me instead. Going to rebuild on Windows.

Where can I see what are the other options instead of SDL_FLIP_HORIZONTAL?

pokekrishna avatar Jul 04 '20 08:07 pokekrishna

We can keep a command-line argument for showing the flipped video (both horizontal and vertical), much like other switches. Food for thought

pokekrishna avatar Jul 04 '20 08:07 pokekrishna

In case someone still needs this, here is a Windows build of the current commit on master w/ changes suggested by @rom1v scrcpy-v1.21-2-g5704ec6.zip

mostm avatar Dec 02 '21 10:12 mostm

@rom1v The addition of a switch such as --flip [v,h] would be appreciated!

DRSDavidSoft avatar Feb 13 '22 10:02 DRSDavidSoft

In case someone still needs this, here is a Windows build of the current commit on master w/ changes suggested by @rom1v scrcpy-v1.21-2-g5704ec6.zip

Build sadly doesn't work, always returns "could not execute adb push" (whereas the 1.21 release from here works just fine... with the image flipped horizontally).

FinlayDaG33k avatar Sep 16 '22 10:09 FinlayDaG33k

set bluestacks graphic engine mode to "Compatibility", it will show normal display then

jz1 avatar Sep 23 '22 20:09 jz1

In case someone still needs this, here is a Windows build of the current commit on master w/ changes suggested by @rom1v scrcpy-v1.21-2-g5704ec6.zip

hey mostm, I built it as well with those changes but get error when running scrcpy (rasp pi 400, debian bullseye) ERROR: Could not initialize SDL: displayIndex must be in the range 0 - -1

were there any other changes required? or would something else be required for v1.24?

gac123 avatar Nov 11 '22 13:11 gac123

Please test #4441.

rom1v avatar Nov 20 '23 23:11 rom1v

Implemented in v2.3.

rom1v avatar Nov 25 '23 21:11 rom1v