scrcpy icon indicating copy to clipboard operation
scrcpy copied to clipboard

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

Open rarsamx opened this issue 2 years ago • 17 comments

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

rarsamx avatar Apr 22 '23 23:04 rarsamx

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

rom1v avatar Apr 23 '23 09:04 rom1v

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.

rarsamx avatar Apr 24 '23 03:04 rarsamx

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

Jaz-z avatar Feb 03 '24 02:02 Jaz-z

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.

rom1v avatar Feb 03 '24 09:02 rom1v

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?

Jaz-z avatar Feb 04 '24 01:02 Jaz-z

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?

rom1v avatar Feb 04 '24 07:02 rom1v

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

Jaz-z avatar Feb 05 '24 02:02 Jaz-z

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?

rom1v avatar Feb 05 '24 07:02 rom1v

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

Jaz-z avatar Feb 05 '24 14:02 Jaz-z

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

rom1v avatar Feb 05 '24 14:02 rom1v

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 avatar Feb 05 '24 14:02 Jaz-z

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

Jaz-z avatar Feb 05 '24 14:02 Jaz-z

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

rom1v avatar Feb 05 '24 14:02 rom1v

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.

Jaz-z avatar Feb 05 '24 17:02 Jaz-z

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 avatar Feb 05 '24 17:02 rom1v

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.

rom1v avatar Feb 05 '24 17:02 rom1v

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 avatar Feb 05 '24 17:02 Jaz-z

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'

Jaz-z avatar Feb 20 '24 02:02 Jaz-z