scrcpy icon indicating copy to clipboard operation
scrcpy copied to clipboard

[Question] scrcpy and waydroid

Open mizzunet opened this issue 3 years ago • 15 comments

I'm following error when I try to scrcpy for waydroid

~ scrcpy
INFO: scrcpy 1.20 <https://github.com/Genymobile/scrcpy>
/usr/share/scrcpy/scrcpy-server: 1 file...pped. 36.9 MB/s (37139 bytes in 0.001s)
[server] INFO: Device: Waydroid WayDroid x86_64 Device (Android 10)
INFO: Renderer: opengl
INFO: OpenGL version: 3.0 Mesa 21.2.5
INFO: Trilinear filtering enabled
INFO: Initial texture: 440x744
WARN: Device disconnected
[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:2792)
	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:80)
	at com.genymobile.scrcpy.Server.main(Server.java:255)
	at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
	at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:340)

adb has connected

~  adb devices
List of devices attached
192.168.250.112:5555	device

But I cannot access adb shell I have error: fork failed: No such device adb

While shell can be accessed by via waydroid shell. No waydroid push though, scrcpy pushes something right?

In this case, by any chance, can I make scrcpy working?

Thank you very much

mizzunet avatar Nov 24 '21 22:11 mizzunet

But I cannot access adb shell

It seems you have, at least to execute a command non-interactively, since the server is executing.

Try:

adb shell echo hello
INFO: Initial texture: 440x744
…
[server] ERROR: Exception on thread Thread[main,5,main]
java.lang.IllegalStateException
  at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method)

Probably no hardware encoder available to encode the screen surface.

Btw, you could try to list the encoders.

rom1v avatar Nov 24 '21 22:11 rom1v

adb shell echo hello

Great, it executes

mizzunet avatar Nov 24 '21 22:11 mizzunet

Btw, you could try to list the encoders.

 ~  scrcpy --encoder _
INFO: scrcpy 1.20 <https://github.com/Genymobile/scrcpy>
/usr/share/scrcpy/scrcpy-...s (37139 bytes in 0.001s)
[server] INFO: Device: Waydroid WayDroid x86_64 Device (Android 10)
INFO: Renderer: opengl
INFO: OpenGL version: 3.0 Mesa 21.2.5
INFO: Trilinear filtering enabled
INFO: Initial texture: 440x744
WARN: Device disconnected
[server] ERROR: Exception on thread Thread[main,5,main]
com.genymobile.scrcpy.InvalidEncoderException: There is no encoder having name '_"
	at com.genymobile.scrcpy.ScreenEncoder.createCodec(ScreenEncoder.java:173)
	at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:74)
	at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:65)
	at com.genymobile.scrcpy.Server.scrcpy(Server.java:80)
	at com.genymobile.scrcpy.Server.main(Server.java:255)
	at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
	at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:340)
[server] ERROR: Try to use one of the available encoders:
[server] ERROR:     scrcpy --encoder 'OMX.google.h264.encoder'

Then

 scrcpy --encoder 'OMX.google.h264.encoder'
INFO: scrcpy 1.20 <https://github.com/Genymobile/scrcpy>
/usr/share/scrcpy/scrcpy-...s (37139 bytes in 0.001s)
[server] INFO: Device: Waydroid WayDroid x86_64 Device (Android 10)
INFO: Renderer: opengl
INFO: OpenGL version: 3.0 Mesa 21.2.5
INFO: Trilinear filtering enabled
INFO: Initial texture: 440x744
WARN: Device disconnected
[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:2792)
	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:80)
	at com.genymobile.scrcpy.Server.main(Server.java:255)
	at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
	at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:340)

Fails

mizzunet avatar Nov 24 '21 22:11 mizzunet

~  sudo waydroid shell
/system/bin/sh: No controlling tty: open /dev/tty: No such file or directory
/system/bin/sh: warning: won't have full job control
:/ # 

I have these two warning, that might be why adb shell fails

mizzunet avatar Nov 24 '21 22:11 mizzunet

adb push fails as well

~ adb push test /sdcard
test: 1 file pushed, 0 skipped.
adb: error: failed to copy 'test' to '/sdcard/test': remote fchown failed: Operation not permitted

mizzunet avatar Nov 24 '21 22:11 mizzunet

Hi @mizzunet ! I think I can answer your issue. Probably you are working as described here: https://docs.waydro.id/faq/get-waydroid-to-work-through-a-vm . Simply, the encoder used from scrcpy on the android side doesn't work with that.

I didn't try directly on bare metal (as I've a nvidia gpu), but with the default base.prop (so not following gudelines for nvidia/vm), but using it in vm, using a virtio-gpu (with accel enabled an properly setup), it works without issues :)

INFO: Renderer: opengl
INFO: OpenGL version: 3.1 Mesa 21.2.2
INFO: Trilinear filtering enabled
INFO: Initial texture: 1848x952
WARN: Killing the server...

So at least with waydroid 1.2.0 from the official debian package from the official repo.

Feedbacks are welcome!

mibofra avatar Feb 06 '22 07:02 mibofra

Hi @mibofra, sorry late reply.

Probably you are working as described here: https://docs.waydro.id/faq/get-waydroid-to-work-through-a-vm .

No, I'm running normally, not on a VM.

I have waydroid 1.2.1 and graphics is Intel i965.

But scrcpy doesn't work. LOS 17.1 is installed. Some user have reported scrpy got working on LOS 18.1

mizzunet avatar May 18 '22 01:05 mizzunet

Yo, any updates on this situation? I got Waydroid installed and working recently, and I get a slightly different log from scrcpy:

scrcpy 1.23 <https://github.com/Genymobile/scrcpy>
/usr/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 18.3 MB/s (41123 bytes in 0.002s)
[server] INFO: Device: Waydroid WayDroid x86 Device (Android 10)
INFO: Renderer: opengl
INFO: OpenGL version: 3.3.0 NVIDIA 340.108
INFO: Trilinear filtering enabled
INFO: Initial texture: 1280x688
[server] ERROR: Encoding error: android.media.MediaCodec$CodecException: Error 0x80000000
[server] INFO: Retrying with -m1024...
[server] ERROR: Encoding error: android.media.MediaCodec$CodecException: Error 0x80000000
[server] INFO: Retrying with -m800...
[server] ERROR: Encoding error: android.media.MediaCodec$CodecException: Error 0x80000000
WARN: Device disconnected
[server] ERROR: Exception on thread Thread[main,5,main]
android.media.MediaCodec$CodecException: Error 0x80000000
        at android.media.MediaCodec.native_configure(Native Method)
        at android.media.MediaCodec.configure(MediaCodec.java:2026)
        at android.media.MediaCodec.configure(MediaCodec.java:1954)
        at com.genymobile.scrcpy.ScreenEncoder.configure(ScreenEncoder.java:282)
        at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:97)
        at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:74)
        at com.genymobile.scrcpy.Server.scrcpy(Server.java:101)
        at com.genymobile.scrcpy.Server.main(Server.java:331)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:340)

I use LOS 17.1 as 18.1 is still in development.

gaussandhisgun avatar Jul 13 '22 15:07 gaussandhisgun

i have the same issue with latest 2022-07-23 waydroid 10 LOS 17.1

$ scrcpy -s 192.168.240.112:5555
scrcpy 1.21 <https://github.com/Genymobile/scrcpy>
/usr/share/scrcpy/scrcpy-server: 1 file pushed. 23.8 MB/s (39473 bytes in 0.002s)
[server] INFO: Device: Waydroid WayDroid x86_64 Device (Android 10)
INFO: Renderer: opengl
INFO: OpenGL version: 3.1 Mesa 22.0.1
INFO: Trilinear filtering enabled
INFO: Initial texture: 1320x736
WARN: Device disconnected
[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:2792)
	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:340)

Some user have reported scrpy got working on LOS 18.1

you're right i tested 2021-12-13 waydroid 11 LOS 18.1 and it's working BUT 2021-12-13 IT'S TOO OLD and i can't use it because scrolling inverted

assiless avatar Jul 31 '22 14:07 assiless

any update for this?

gasacchi avatar Nov 09 '22 01:11 gasacchi

I think this is not priority =(

jaysonwcs avatar Aug 25 '23 20:08 jaysonwcs

Getting different issue on Linux mint 21.1 with Waydroid gapps

scrcpy 1.21 <https://github.com/Genymobile/scrcpy>
/usr/share/scrcpy/scrcpy-server: 1 fil...ed. 122.6 MB/s (39473 bytes in 0.000s)
[server] INFO: Device: Waydroid WayDroid x86_64 Device (Android 11)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6.0 NVIDIA 470.199.02
INFO: Trilinear filtering enabled
INFO: Initial texture: 1024x568
WARN: Device disconnected
[server] ERROR: Exception on thread Thread[main,5,main]
android.media.MediaCodec$CodecException: Error 0x80000000
	at android.media.MediaCodec.native_configure(Native Method)
	at android.media.MediaCodec.configure(MediaCodec.java:2127)
	at android.media.MediaCodec.configure(MediaCodec.java:2043)
	at com.genymobile.scrcpy.ScreenEncoder.configure(ScreenEncoder.java:233)
	at com.genymobile.scrcpy.ScreenEncoder.internalStreamScreen(ScreenEncoder.java:86)
	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:399)
WARN: Killing the server...

AndnixSH avatar Sep 16 '23 09:09 AndnixSH