scrcpy: Fails to initialize on Android Wear smartwatch

[parker@gpdpocket x]$ scrcpy 
/usr/local/share/scrcpy/scrcpy-server.jar: 1 file pushed. 2.5 MB/s (19334 bytes in 0.007s)
ERROR: Exception on thread Thread[main,5,main]
java.lang.IllegalArgumentException: Failed to initialize video/avc, error 0xfffffffe
        at android.media.MediaCodec.native_setup(Native Method)
        at android.media.MediaCodec.<init>(MediaCodec.java:1776)
        at android.media.MediaCodec.createEncoderByType(MediaCodec.java:1742)
        at com.genymobile.scrcpy.ScreenEncoder.createCodec(ScreenEncoder.java:115)
        at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:57)
        at com.genymobile.scrcpy.Server.scrcpy(Server.java:22)
        at com.genymobile.scrcpy.Server.main(Server.java:78)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:262)
Invalid return value 0 for stream protocol
Invalid return value 0 for stream protocol
Invalid return value 0 for stream protocol
Invalid return value 0 for stream protocol
Invalid return value 0 for stream protocol
ERROR: Could not open video stream
INFO: Initial texture: 320x320

Asus Zenwatch 2 on Android Wear 2.0.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 19

Most upvoted comments

I wonder if this could be fixed by using “video/raw” encoding instead of “video/avc”? Wear does support raw video encoding, and ffmpeg can convert it: https://developer.android.com/training/wearables/apps/debugging?hl=en#screenrecord

I just realized the watch has NO encoders. Only decoders. screen1

That’s probably the issue.