Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
105.53k stars 10.24k forks source link

scrcpy fails to start with Oppo Android 12 Device #5037

Open Yunheng opened 1 week ago

Yunheng commented 1 week ago

Environment

Describe the bug

The adb and scrcpy setup works fine with almost every other device, except this one device that I have issues with. Another Oppo device (different model) has no issue.

Referencing #1518, I have tried to use the -m 800 and -m 1920 or even as low as -m 200 parameter but the same issue occurs.

All other devices that work use the tunnel-host parameter to connect to an externally hosted adb server. adb devices -l on the machine running scrcpy shows the Oppo A17 device

scrcpy -Vdebug --no-audio -m 800 --tunnel-host=xxx
scrcpy 2.4 <https://github.com/Genymobile/scrcpy>
INFO: Tunnel host/port is set, --force-adb-forward automatically enabled.
INFO: ADB device found:
...
DEBUG: Device serial: ...
DEBUG Using server: scrcpy-server
scrcpy-server: 1 file pushed 4.2MB/s (69007  bytes in 0.016s)
DEBUG: Remaining connection attempts: 100
DEBUG: Remaining connection attempts: 99
...
DEBUG: Remaining connection attempts: 1
DEBUG: Server disconnected
DEBUG: Server terminated
ERROR: Server connection failed

I have also tried running it without the ---tunnel-host parameter, which results in the following:

scrcpy -Vverbose --no-audio -m 800
scrcpy 2.4 <https://github.com/Genymobile/scrcpy>
INFO: Tunnel host/port is set, --force-adb-forward automatically enabled.
INFO: ADB device found:
...
DEBUG: Device serial: ...
DEBUG Using server: scrcpy-server
scrcpy-server: 1 file push,ed 4.2MB/s (69007 bytes in 0.016s)
[server] INFO: Device [OPPO] OPPO CPH2477 (Android 12)
[server] DEBUG: Using video encoder: 'c2.mtk.avc.encoder'
[server] DEBUG: Display: using Surface Control API
[server] DEBUG: Controller stopped
[server] DEBUG: Device message sender stopped 
[server] DEBUG: Screen streaming stopped
DEBUG: Interrupting socket
DEBUG: Server disconnected
DEBUG: Server terminated
ERROR: Server connection failed

Since it would appear that --tunnel-host isn't necessary, I tried --list-encoders and used other h264 encoders too, but it still does not start scrcpy.

c2.mtk.avc.encoder
OMX.MTK.VIDEO.ENCODER.AVC
c2.android.avc.encoder
OMX.google.h264.encoder

log lines that appear to relate to scrcpy as follows:

ziparchive: Unable to open '/data/local/tmp/scrcpy-server.dm': No such file or directory
AndroidRuntime: Calling main entry com.genymobile.scrcpy.Server
scrcpy  : Device: [OPPO] OPPO CPH2477 (Android 12)
OplusPerfParmCount: The num of client composition of scrcpy in last 150341 ms is: 18
scrcpy  : Using video encoder: 'c2.mtk.avc.encoder'
MediaCodec: [c2.mtk.avc.encoder] configure, format : AMessage(what = 0x00000000) = {
MediaCodec:   int32_t color-format = 2130708361
MediaCodec:   int32_t i-frame-interval = 10
MediaCodec:   string mime = "video/avc"
MediaCodec:   int32_t width = 360
MediaCodec:   int32_t bitrate = 8000000
MediaCodec:   int32_t frame-rate = 60
MediaCodec:   int64_t repeat-previous-frame-after = 100000
MediaCodec:   int32_t height = 800
MediaCodec: }
SurfaceFlinger: specificKindDisplay dpyName:scrcpy is not WIFI display
BufferQueueProducer: [VDS: scrcpy](id:3ff0000000c,api:1,p:1023,c:1023) connect: api=1 producerControlledByApp=false
BufferQueueDebug: [VDS-scrcpy SINK](this:0xb40000759256cdb0,id:-1,api:0,p:-1,c:-1) BufferQueue core=(1023:/system/bin/surfaceflinger)
BufferQueueDebug: [VDS-scrcpy SCRATCH](this:0xb40000759256ce40,id:-1,api:0,p:-1,c:-1) BufferQueue core=(1023:/system/bin/surfaceflinger)
D scrcpy  : Display: using SurfaceControl API
scrcpy  : Controller stopped
scrcpy  : Device message sender stopped
CompositionEngine: ANativeWindow::dequeueBuffer failed for display [scrcpy] with error: -19
CompositionEngine: Dequeuing buffer for display [scrcpy] failed, bailing out of client composition for this frame
CompositionEngine: ANativeWindow::dequeueBuffer failed for display [scrcpy] with error: -19
CompositionEngine: Dequeuing buffer for display [scrcpy] failed, bailing out of client composition for this frame
scrcpy  : Screen streaming stopped
CompositionEngine: ANativeWindow::dequeueBuffer failed for display [scrcpy] with error: -19
CompositionEngine: Dequeuing buffer for display [scrcpy] failed, bailing out of client composition for this frame
BufferQueueConsumer: [VDS: scrcpy](id:3ff0000000c,api:1,p:1023,c:1023) disconnect
BufferQueueProducer: [VDS: scrcpy](id:3ff0000000c,api:1,p:1023,c:1023) disconnect: api 1
BufferQueueDebug: [VDS-scrcpy SINK](this:0xb40000759256cdb0,id:-1,api:1,p:1023,c:1023) onDestructor()
BufferQueueDebug: [VDS-scrcpy SCRATCH](this:0xb40000759256ce40,id:-1,api:1,p:1023,c:1023) onDestructor()
ziparchive: Unable to open '/data/local/tmp/scrcpy-server.dm': No such file or directory
AndroidRuntime: Calling main entry com.genymobile.scrcpy.CleanUp
scrcpy  : Cleaning up

Thank you!

rom1v commented 1 week ago

I tried --list-encoders and used other h264 encoders too, but it still does not start scrcpy.

Does screenrecord work?

adb shell screenrecord /sdcard/file.mp4
adb pull /sdcard/file.mp4
Yunheng commented 1 week ago

Oh yes, I did try screenrecord as well, but it doesn't seem to work.

"/system/bin/sh: screenrecord: inaccessible or not found"

ColorOS has a built in screen recorder though.