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

Black screen in Arch but not under Fedora Same phone, same computer, same version. #3940

Open
rarsamx opened this issue Apr 22, 2023 · 18 comments

Comments

@rarsamx
Copy link

rarsamx commented Apr 22, 2023

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

Environment

  • OS: Arch Linux
  • Window Manager: Xmonad
  • scrcpy version: 2.0
  • Dependencies (compiled / linked):
  • SDL: 2.26.4 / 2.26.5
  • libavcodec: 60.3.100 / 60.3.100
  • libavformat: 60.3.100 / 60.3.100
  • libavutil: 58.2.100 / 58.2.100
  • libavdevice: 60.1.100 / 60.1.100
  • libusb: - / 1.0.26
  • installation method: pacman official arch repository
  • device model: samsung SM-G950W
  • Android version: Android 9

Describe the bug
When I execute the application it only mirrors a black screen although the phone responds to keyboard and mouse interaction: Middle click turns on the phone screen, swiping up lets me enter the pin, I can enter the pin with the keybaord, etc, but the window in the computer remains all black.
If I record the screen, the recording contains the image of the phone as I would have expected to see on the screen.
Sometimes I can see an image of the screen but while the phone responds to input, the image remains static.

Using the same computer, same phone it works under Fedora 38 running under Xmonad under X11

I executed verbose and didn't see any meaningful difference between the Fedora output and the Arch output

I tried with different renderers. Same result.

Arch output

scrcpy -V verbose -m 1024 --record=file.mp4
scrcpy 2.0 https://github.com/Genymobile/scrcpy
DEBUG: ADB device found:
DEBUG: --> (tcpip) 192.168.2.13:5555 device SM_G950W
DEBUG: Device serial: 192.168.2.13:5555
DEBUG: Using server: /usr/share/scrcpy/scrcpy-server
/usr/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 98.1 MB/s (52867 bytes in 0.001s)
[server] INFO: Device: samsung SM-G950W (Android 9)
[server] WARN: Audio disabled: it is not supported before Android 11
[server] DEBUG: Audio encoder stopped
DEBUG: Server connected
DEBUG: Starting controller thread
DEBUG: Starting receiver thread
INFO: Recording started to mp4 file: file.mp4
INFO: Renderer: opengl
INFO: OpenGL version: 4.6 (Compatibility Profile) Mesa 23.0.2
INFO: Trilinear filtering enabled
DEBUG: Using icon: /usr/share/icons/hicolor/256x256/apps/scrcpy.png
DEBUG: Demuxer 'video': starting thread
DEBUG: Demuxer 'audio': starting thread
WARN: Demuxer 'audio': stream explicitly disabled by the device
WARN: Audio stream recording disabled
[server] DEBUG: Using encoder: 'OMX.qcom.video.encoder.avc'
INFO: Initial texture: 496x1024

Fedora output (the screen mirrors properly)

scrcpy -V verbose -m 1024
scrcpy 2.0 https://github.com/Genymobile/scrcpy
* daemon not running; starting now at tcp:5037
* daemon started successfully
INFO: Connecting to 192.168.2.13:5555...
INFO: Connected to 192.168.2.13:5555
DEBUG: Device serial: 192.168.2.13:5555
DEBUG: Using server: /usr/share/scrcpy/scrcpy-server
/usr/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 6.9 MB/s (52867 bytes in 0.007s)
[server] INFO: Device: samsung SM-G950W (Android 9)
[server] WARN: Audio disabled: it is not supported before Android 11
[server] DEBUG: Audio encoder stopped
DEBUG: Server connected
DEBUG: Starting controller thread
DEBUG: Starting receiver thread
[server] DEBUG: Using encoder: 'OMX.qcom.video.encoder.avc'
INFO: Renderer: opengl
INFO: OpenGL version: 4.6 (Compatibility Profile) Mesa 23.0.2
INFO: Trilinear filtering enabled
DEBUG: Using icon: /usr/share/icons/hicolor/256x256/apps/scrcpy.png
DEBUG: Demuxer 'video': starting thread
DEBUG: Demuxer 'audio': starting thread
WARN: Demuxer 'audio': stream explicitly disabled by the device
INFO: Initial texture: 496x1024

@rom1v
Copy link
Collaborator

rom1v commented Apr 23, 2023

Looks like a graphics driver issue. Does it "work" with scrcpy --render-driver=software?

@rarsamx
Copy link
Author

rarsamx commented Apr 24, 2023

I tried with all the renderers. Only a black window on the computer but the phone reacts to input.

I tried USB connected and through Wifi.

I don't have any trouble connecting. just seeing the phone image.

@Jaz-z
Copy link

Jaz-z commented Feb 3, 2024

Screen Share problem: Black screen
Similar Black screen issue for Murena 2 phone running e/OS
The difference was no input was possible

Murena Two
e/OS version: 1.19.1-t-20240109372021-stable two
android version: 13

Desktop OS: Kubuntu 22.04
KDE Plasma Version: 5.24.7
KDE Frameworks Version: 5.92.0
Qt Version: 5.15.3
Kernel Version: 5.15.0-92-generic (64-bit)
Graphics Platform: X11

It is not possible to share Murena 2 Screen using scrcpy. The resulting share on desktop showed a fuzzy black screen for the Murena 2 android. It worked with Galaxy J3 android 5.1.1

Using scrcpy produced the following error

scrcpy 1.25 https://github.com/Genymobile/scrcpy
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed. 1.4 MB/s (42151 bytes in 0.028s)
[server] INFO: Device: Murena Murena Two (Android 13)
INFO: Renderer: opengl
INFO: OpenGL version: 3.1 Mesa 20.0.8
INFO: Trilinear filtering enabled
INFO: Initial texture: 1080x2400
[server] ERROR: Encoding error: java.lang.IllegalStateException: null
[server] INFO: Retrying with -m1920…
INFO: New texture: 864x1920

I tried updating scrcpy it did not go well. I had to uninstall new version and reinstall from kubuntu packages.
After changes for scrcpy the following error is shown when running scrcpy on desktop for Murena 2- now it disconnects, so it does not even show the black screen anymore. Samsung Galaxy J3 / android 5.1.1 still connects and is workable.

scrcpy
scrcpy 1.21 https://github.com/Genymobile/scrcpy

daemon not running; starting now at tcp:5037
daemon started successfully
/usr/share/scrcpy/scrcpy-server: 1 file pushed. 1.5 MB/s (39473 bytes in 0.025s)
[server] INFO: Device: Murena Murena Two (Android 13)
[server] ERROR: Could not invoke method
java.lang.NoSuchMethodException: android.content.IClipboard$Stub$Proxy.addPrimaryClipChangedListener [interface android.content.IOnPrimaryClipChangedListener, class java.lang.String, int]
at java.lang.Class.getMethod(Class.java:2103)
at java.lang.Class.getMethod(Class.java:1724)
at com.genymobile.scrcpy.wrappers.ClipboardManager.getAddPrimaryClipChangedListener(ClipboardManager.java:103)
at com.genymobile.scrcpy.wrappers.ClipboardManager.addPrimaryClipChangedListener(ClipboardManager.java:111)
at com.genymobile.scrcpy.Device.(Device.java:93)
at com.genymobile.scrcpy.Server.scrcpy(Server.java:63)
at com.genymobile.scrcpy.Server.main(Server.java:309)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:355)
[server] ERROR: Exception on thread Thread[main,5,main]
java.lang.IllegalStateException
at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method)
at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:3572)
at com.genymobile.scrcpy.ScreenEncoder.encode(ScreenEncoder.java:110)
at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:91)
at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:65)
at com.genymobile.scrcpy.Server.scrcpy(Server.java:93)
at com.genymobile.scrcpy.Server.main(Server.java:309)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:355)
INFO: Renderer: opengl
INFO: OpenGL version: 4.5 (Compatibility Profile) Mesa 23.0.4-0ubuntu1~22.04.1
INFO: Trilinear filtering enabled
INFO: Initial texture: 1080x2400
WARN: Device disconnected
WARN: Killing the server...
scrcpy 1.25 on the same desktop correctly shares android display for Galaxy J3 running android 5.1.1

about Murena 2:
https://murena.com/shop/smartphones/brand-new/murena-2/
also reported on e/Os gitlab:
https://gitlab.e.foundation/e/backlog/-/issues/7732

The uploaded screenshot shows Murena two sharing screen showing black and a Galaxy J3 sharing screen, with the same scrcpy before making changes to scrcpy .
After the changes only Galaxy J3 is correctly displaying screen on desktop, scrcpy doesn't connect Murena 2 any more so not even a black screen now.

blank screen

@rom1v
Copy link
Collaborator

rom1v commented Feb 3, 2024

with the same scrcpy before making changes to scrcpy

After the changes …

Which changes did you make to scrcpy?

In any case, you're using old scrcpy versions (the one from the packages are old).

Install the latest manually: https://github.com/Genymobile/scrcpy/blob/master/doc/linux.md#latest-version

Then you might need to try another encoder or reduce the resolution.

@Jaz-z
Copy link

Jaz-z commented Feb 4, 2024

Thank you for your advice.

By changes, I meant updated scrcpy to latest version from instructions on the website (the same link as you have provided). First I uninstalled the older version. During update installation, terminal feedback was to run auto remove after installation which I did and many things were removed by it.

After this update process scrcpy didn't work, not even with the older android.

Maybe there was something wrong with ADB , tried to change environmental path but didn't quite understand and made a mistake making things worse, since KDE connect also stopped working maybe because of what I did.

So I carried out a simple uninstall of the latest scrcpy version following instructions on https://github.com/Genymobile/scrcpy/blob/master/doc/linux.md#latest-version

then from Kubuntu depository, I installed Android SDK manger hoping to correct ADB errors if any existed.

and from Kubuntu depository reinstalled scrcpy which is the older version. After re-installation of old version, scrcpy works with old android 5 but not with Murena2 android 13 giving errors which I have pasted in previous post.

KDE connect is also working now.

I am not very knowledgeable with IT, can only follow tasks from guides but if something goes wrong, I cannot solve it.

I could not find out about encoder:

scrcpy --list-encoders
scrcpy 1.21 https://github.com/Genymobile/scrcpy
scrcpy: unrecognized option '--list-encoders'

I don't know, if 'reduce the resolution' refers to the phone or scrcpy and how?

@rom1v
Copy link
Collaborator

rom1v commented Feb 4, 2024

After this update process scrcpy didn't work, not even with the older android.

With the latest version (currently 2.3.1), you say it does not work: what is the full output in the console?

@Jaz-z
Copy link

Jaz-z commented Feb 5, 2024

Hadn't copied the output last time, so Uninstalled scrcpy snap version 1.25
reinstalled version 2.3.1 following instructions: https://github.com/Genymobile/scrcpy/blob/master/doc/linux.md#latest-version

Running scrcpy immediately after installation - nothing happened - there was no phone display. Terminal only gave one line:
: ~$ scrcpy
scrcpy 2.3.1 https://github.com/Genymobile/scrcpy
When closing the terminal, a dialogue box warned: there is a process running in this window do you still want to quit?
Tried a few times, same result and on one occasion there was a message ADB has failed (sorry didn't copy the message) - {?? this was possibly because I mistakenly pressed control+c on keyboard while on the terminal wanting to copy terminal text}.

Restart of computer made a difference
restarted the computer and ran scrcpy for Murena two (android 13) - the result was a black screen as in the photo in comments above and out put in terminal was:
: ~ $ scrcpy
scrcpy 2.3.1 https://github.com/Genymobile/scrcpy
INFO: ADB device found:
INFO:     -->   (usb)  B1202312000626                  device  Murena_Two
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed. 4.5 MB/s (66007 bytes in 0.014s)
[server] INFO: Device: [Murena] Murena Murena Two (Android 13)
[server] ERROR: Encoding error: java.lang.IllegalStateException: null
[server] INFO: Retrying with -m1920...
[server] INFO: Retrying...
INFO: Renderer: opengl
INFO: OpenGL version: 4.5 (Compatibility Profile) Mesa 23.0.4-0ubuntu1~22.04.1
INFO: Trilinear filtering enabled
INFO: Texture: 1080x2400
INFO: Texture: 864x1920

On the first step of installation, it seems nothing was installed and the terminal reported all the newest versions were already there.

On the second step clone, at the beginning it gave the following message:
fatal: destination path 'scrcpy' already exists and is not an empty directory.
but continued process apparently successfully, just one warning:
[64/64] Linking target app/scrcpy
lto-wrapper: warning: using serial compilation of 2 LTRANS jobs

I also ran scrcpy for Galaxy J3 (android 5.1) it is showing the display correctly and the terminal out put is:
: ~ $ scrcpy
scrcpy 2.3.1 https://github.com/Genymobile/scrcpy
INFO: ADB device found:
INFO: --> (usb) 4200ea52b8611400 device SM_J320FN
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed. 3.8 MB/s (66007 bytes in 0.017s)
[server] INFO: Device: [samsung] samsung SM-J320FN (Android 5.1.1)
INFO: Renderer: opengl
INFO: OpenGL version: 4.5 (Compatibility Profile) Mesa 23.0.4-0ubuntu1~22.04.1
INFO: Trilinear filtering enabled
[server] WARN: Audio disabled: it is not supported before Android 11
WARN: Demuxer 'audio': stream explicitly disabled by the device
INFO: Texture: 720x1280

https://github.com/Genymobile/scrcpy/blob/master/doc/video.md#encoder

Encoder list for Murena2 Android 13:
: ~$ scrcpy --list-encoders
scrcpy 2.3.1 https://github.com/Genymobile/scrcpy
INFO: ADB device found:
INFO:     -->   (usb)  B1202312000626                  device  Murena_Two
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed. 10.7 MB/s (66007 bytes in 0.006s)
[server] INFO: Device: [Murena] Murena Murena Two (Android 13)
[server] INFO: List of video encoders:
   --video-codec=h264 --video-encoder='OMX.MTK.VIDEO.ENCODER.AVC'
   --video-codec=h264 --video-encoder='c2.android.avc.encoder'
   --video-codec=h264 --video-encoder='OMX.google.h264.encoder'
[server] INFO: List of audio encoders:
   --audio-codec=opus --audio-encoder='c2.android.opus.encoder'
   --audio-codec=aac --audio-encoder='c2.android.aac.encoder'
   --audio-codec=aac --audio-encoder='OMX.google.aac.encoder'
   --audio-codec=flac --audio-encoder='c2.android.flac.encoder'
   --audio-codec=flac --audio-encoder='OMX.google.flac.encoder'

Encoder for Samsung Galaxy J3 Android 5.1.1
: ~$ scrcpy --list-encoders
scrcpy 2.3.1 https://github.com/Genymobile/scrcpy
INFO: ADB device found:
INFO:     -->   (usb)  4200ea52b8611400                device  SM_J320FN
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed. 2.2 MB/s (66007 bytes in 0.029s)
[server] INFO: Device: [samsung] samsung SM-J320FN (Android 5.1.1)
[server] INFO: List of video encoders:
   --video-codec=h264 --video-encoder='OMX.sprd.h264.encoder'
   --video-codec=h264 --video-encoder='OMX.google.h264.encoder'
[server] INFO: List of audio encoders:
   --audio-codec=aac --audio-encoder='OMX.google.aac.encoder'
   --audio-codec=aac --audio-encoder='OMX.SEC.naac.enc'
   --audio-codec=flac --audio-encoder='OMX.google.flac.encoder'

Trying encoder change for Murena 2 gave error:
: ~ $ scrcpy --video-codec=h264 --video-encoder='OMX.qcom.video.encoder.avc'
scrcpy 2.3.1 https://github.com/Genymobile/scrcpy
INFO: ADB device found:
INFO:     -->   (usb)  B1202312000626                  device  Murena_Two
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed. 13.2 MB/s (66007 bytes in 0.005s)
[server] INFO: Device: [Murena] Murena Murena Two (Android 13)
INFO: Renderer: opengl
INFO: OpenGL version: 4.5 (Compatibility Profile) Mesa 23.0.4-0ubuntu1~22.04.1
INFO: Trilinear filtering enabled
[server] ERROR: Video encoder 'OMX.qcom.video.encoder.avc' for h264 not found
List of video encoders:
   --video-codec=h264 --video-encoder='OMX.MTK.VIDEO.ENCODER.AVC'
   --video-codec=h264 --video-encoder='c2.android.avc.encoder'
   --video-codec=h264 --video-encoder='OMX.google.h264.encoder'
ERROR: Demuxer 'audio': stream disabled due to connection error
ERROR: Demuxer error
ERROR: Demuxer 'video': stream disabled due to connection error

Murena 2 only has one display
[server] INFO: List of displays:
--display-id=0 (1080x2400)

I don't know how to change scrcpy resolution if that is needed.

Summary: Latest version is working correctly for Galaxy J3 (android 5) but with Black screen for Murena 2 (android 13).

@rom1v
Copy link
Collaborator

rom1v commented Feb 5, 2024

Running scrcpy immediately after installation - nothing happened - there was no phone display. Terminal only gave one line:
: ~$ scrcpy
scrcpy 2.3.1 https://github.com/Genymobile/scrcpy
When closing the terminal, a dialogue box warned: there is a process running in this window do you still want to quit?

Please retry, and if you reproduce this issue, in a separate terminal, run adb devices -l. What is the output?

restarted the computer and ran scrcpy for Murena two (android 13) - the result was a black screen as in the photo in comments above and out put in terminal was […]

Everything looks correct in the logs. Is the screen black on every app, or just on some of them (like the lock screen on some devices, due to "secure flag" #2129)?

What if you record with adb shell screenrecord /sdcard/file.mp4, is the recording black?

@Jaz-z
Copy link

Jaz-z commented Feb 5, 2024

  • For the first it is not reproducible now I will have to uninstall and reinstall to reproduce. which I will do for you shortly.

  • second question: The screen is black as soon as scrcpy connect to the phone. It is black for every app. I can use mouse and keyboard on the black screen and it will do actions on the phone. e.g. clicking on the black screen clicks on an app icon that is located there and opens it on the phone, the screen still stays black on desktop and keyboard is also connect e.g. I can move the cursor over the phone with desktop keyboard.

  • while still on this installation with black screen running adb device:
    : ~ $ adb devices -l
    List of devices attached
    B1202312000626 device usb:2-1.6 product:lineage_two model:Murena_Two device:two transport_id:1

  • does recording with adb shell screenrecord /sdcard/file.mp4 need a sd card in the phone - while there is no SD card in the phone? I ran it on the terminal where scrcpy was active, no result, then ran it on a second terminal it gave error:
    : ~ $ adb shell screenrecord /sdcard/file.mp4
    Encoder failed (err=-38)

@rom1v
Copy link
Collaborator

rom1v commented Feb 5, 2024

Looks like there is a capture/encoding issue on your device system.

@Jaz-z
Copy link

Jaz-z commented Feb 5, 2024

Looks like there is a capture/encoding issue on your device system.

Do you mean on the phone and what can be done about; if it is something I should communicate to Murena2 or e/os foundation, could you give more specifics that can send them

@Jaz-z
Copy link

Jaz-z commented Feb 5, 2024

after closing the phone display on desktop, with the scrcpy that had adb shell screenrecord /sdcard/file.mp4 at the end, I got:
: ~ $ adb shell screenrecord /sdcard/file.mp4
Unable to get output buffers (err=-38)
Encoder failed (err=-38)
Maybe because there is no sd card there

@rom1v
Copy link
Collaborator

rom1v commented Feb 5, 2024

No, it's an encoding problem (all Android devices use /sdcard even if there is no phsical sdcard).

@Jaz-z
Copy link

Jaz-z commented Feb 5, 2024

Please retry, and if you reproduce this issue, in a separate terminal, run adb devices -l. What is the output?

Tried to reproduce the previous issue, without success.
In uninstalling gave errors:

: ~ $ sudo ninja -Cbuild-auto uninstall
[sudo] password for..:  
ninja: Entering directory `build-auto'
ninja: fatal: chdir to 'build-auto' - No such file or directory

Opened terminal from within directory:

  • uninstalled:

:~/scrcpy/build-auto$ sudo ninja uninstall
....
Uninstall finished.
Deleted: 19
Failed: 0
Remember that files created by custom scripts have not been removed.

  • restarted computer

prior to re-installation ran scrcpy did not work although the server still there after uninstall
on separate terminal ran

:~$ adb devices -l
List of devices attached
B1202312000626         device usb:2-1.5 product:lineage_two model:Murena_Two device:two transport_id:1

  • Reinstalled latest version again / there was nothing to install all files already there.

  • Carried out clone / result as before.

  • ran scrcpy (this is the point it should have given the previous issue of just one line in terminal and nothing happening - but that issue did not repeat).

scrcpy worked with black screen for Murena 2
Testing adb devices -l on separate window gave same result as before.

@rom1v
Copy link
Collaborator

rom1v commented Feb 5, 2024

ninja: fatal: chdir to 'build-auto' - No such file or directory

ninja -C XXX in equivalent to cd XXX && ninja, so you must execute it from the scrcpy repo root directory.

@rom1v
Copy link
Collaborator

rom1v commented Feb 5, 2024

Do you mean on the phone and what can be done about; if it is something I should communicate to Murena2 or e/os foundation, could you give more specifics that can send them

Report that the native recorder adb shell screenrecord /sdcard/file.mp4 does not work, and mention that a similar problem occurs with scrcpy on that device.

@Jaz-z
Copy link

Jaz-z commented Feb 5, 2024

Do you mean on the phone and what can be done about; if it is something I should communicate to Murena2 or e/os foundation, could you give more specifics that can send them

Report that the native recorder adb shell screenrecord /sdcard/file.mp4 does not work, and mention that a similar problem occurs with scrcpy on that device.

Thank you reported it: https://gitlab.e.foundation/e/backlog/-/issues/7732

@Jaz-z
Copy link

Jaz-z commented Feb 20, 2024

Murena 2 offered the following solution which is working for my phone, see bottom of page gitlab link above:

Works with the following command: scrcpy --video-codec=h264 --video-encoder='c2.android.avc.encoder'

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

No branches or pull requests

3 participants