Scrcpy: Screen Mirrored is Inverted

Created on 11 May 2020  Â·  13Comments  Â·  Source: Genymobile/scrcpy

  • [ 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.

Most helpful comment

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);
 }

All 13 comments

Inverted how? Vertically?

If you record with:

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

Is the video "inverted" too?

Yes the video too is inverted

On Mon, 11 May, 2020, 12:18 pm Romain Vimont, notifications@github.com
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
.

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?

It is not flipped it is inverted

On Mon, 11 May, 2020, 1:39 pm Romain Vimont, notifications@github.com
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
.

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

Yes wait I'll email you the screenshot

On Mon, 11 May, 2020, 1:50 pm Romain Vimont, notifications@github.com
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
.

Here is screenshot of how actually inverted it is.

On Mon, 11 May, 2020, 1:54 pm MH12 l Kushhh, kushya0110@gmail.com wrote:

Yes wait I'll email you the screenshot

On Mon, 11 May, 2020, 1:50 pm Romain Vimont, notifications@github.com
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
.

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

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

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);
 }

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

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?

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SuryaElavazhagan picture SuryaElavazhagan  Â·  4Comments

fernandofreamunde picture fernandofreamunde  Â·  4Comments

YurieCo picture YurieCo  Â·  4Comments

singleNeuron picture singleNeuron  Â·  3Comments

tonyyang924 picture tonyyang924  Â·  4Comments