Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Screen Mirrored is Inverted #1380

Closed
kushhh01 opened this issue May 11, 2020 · 20 comments
Closed

Screen Mirrored is Inverted #1380

kushhh01 opened this issue May 11, 2020 · 20 comments

Comments

@kushhh01
Copy link

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

@rom1v
Copy link
Collaborator

rom1v commented May 11, 2020

Inverted how? Vertically?

If you record with:

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

Is the video "inverted" too?

@kushhh01
Copy link
Author

kushhh01 commented May 11, 2020 via email

@rom1v
Copy link
Collaborator

rom1v commented May 11, 2020

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?

@kushhh01
Copy link
Author

kushhh01 commented May 11, 2020 via email

@rom1v
Copy link
Collaborator

rom1v commented May 11, 2020

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

@kushhh01
Copy link
Author

kushhh01 commented May 11, 2020 via email

@kushhh01
Copy link
Author

kushhh01 commented May 11, 2020 via email

@rom1v
Copy link
Collaborator

rom1v commented May 11, 2020

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

@kushhh01
Copy link
Author

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

@rom1v
Copy link
Collaborator

rom1v commented May 11, 2020

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

@kushhh01
Copy link
Author

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

@pokekrishna
Copy link

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
Copy link

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

@mostm
Copy link

mostm commented Dec 2, 2021

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

@DRSDavidSoft
Copy link

DRSDavidSoft commented Feb 13, 2022

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

@rom1v rom1v mentioned this issue Jul 26, 2022
@FinlayDaG33k
Copy link

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).

@jz1
Copy link

jz1 commented Sep 23, 2022

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

@gac123
Copy link

gac123 commented Nov 11, 2022

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?

@rom1v
Copy link
Collaborator

rom1v commented Nov 20, 2023

Please test #4441.

@rom1v rom1v closed this as completed in bb88b60 Nov 25, 2023
@rom1v
Copy link
Collaborator

rom1v commented Nov 25, 2023

Implemented in v2.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants