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

Everything appears working but no window opens (on X11, not Wayland) #4519

Open
2 tasks done
haunma opened this issue Dec 9, 2023 · 6 comments
Open
2 tasks done

Everything appears working but no window opens (on X11, not Wayland) #4519

haunma opened this issue Dec 9, 2023 · 6 comments

Comments

@haunma
Copy link

haunma commented Dec 9, 2023

  • I have read the FAQ.
  • I have searched in existing issues.

Environment

  • OS: Linux (Void, kernel 6.5.12), X11, qtile tiling WM
  • scrcpy version: 2.1.1
  • installation method: Void package (xbps)
  • device model: Moto Z Play (addison) with LineageOS 18.1
  • Android version: 11
  • SDL version 2.28.5

After using the scrcpy --otg trick to authorize my phone with adb (the phone screen is dead), I am able to run scrcpy. The default codec fails with java.lang.IllegalStateException in MediaCodec, but the output of scrcpy --list-encoders gives

    --video-codec=h264 --video-encoder='OMX.qcom.video.encoder.avc'
    --video-codec=h264 --video-encoder='c2.android.avc.encoder'
    --video-codec=h264 --video-encoder='OMX.google.h264.encoder'
    --video-codec=h265 --video-encoder='OMX.qcom.video.encoder.hevc'
    --video-codec=h265 --video-encoder='c2.android.hevc.encoder'

and some of these are working. Or at least, they seem to be working. I get no errors or problems indicated in the scrcpy output even at "verbose" level, but no window opens. Typical output is

$ scrcpy --video-codec=h264 --video-encoder='OMX.google.h264.encoder' --no-audio -m1024
scrcpy 2.1.1 <https://github.com/Genymobile/scrcpy>
INFO: ADB device found:
INFO:     -->   (usb)  ZY224D2XM8                      device  Moto_Z_Play
/usr/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 111.5 MB/s (56995 bytes in 0.000s)
[server] INFO: Device: [Motorola] Motorola Moto Z Play (Android 11)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6 (Compatibility Profile) Mesa 23.3.0
INFO: Trilinear filtering enabled
INFO: Texture: 576x1024

I have tried adb shell screenrecord /sdcard/file.mp4 and that works---at least sometimes. It only seems to work when I run it right after unlocking the phone (with fingerprint sensor), otherwise I get a zero length file. I try to run scrcpy the same way but still no luck. Tried all the codecs. Tried various resolutions. Same result: apparent success in every respect except no video.

Also, scrcpy --video-codec=h264 --video-encoder='OMX.google.h264.encoder' --no-audio --record=file.mkv --no-playback seems to work when run but the video file is always zero length. I initially thought the problem could be with my tiling window manager but this seems to indicate that there really is no encoded video coming through the pipe. Correct?

@rom1v
Copy link
Collaborator

rom1v commented Dec 9, 2023

Yes, the problem is on the device, it means that MediaCodec does not produce any frame for some reason.

@haunma
Copy link
Author

haunma commented Dec 10, 2023

So that is basically the end of debugging, then? It just doesn't work for reasons unknown and unknow-able? This just reinforces my prejudice of Android as a steaming pile of **** that we basically treat as non-deterministic because almost nobody understands it deeply enough to problem-solve in the traditional sense :(

@vidoardes
Copy link

This is a Wayland / Scrpy problem and has nothing to do with Android. You can work round it by calling SDL_VIDEODRIVER=x11 scrcpy to force it back to X11.

There is already an issue about it here: #3431

@haunma
Copy link
Author

haunma commented Mar 11, 2024

This is a Wayland / Scrpy problem and has nothing to do with Android.

I usually try not to be snarky, but, wow, did you actually read the subject line on this bug report? I am using X, not Wayland. So unless there is a different bug in scrcpy, this does in fact appear to be an Android problem.

@rom1v
Copy link
Collaborator

rom1v commented Mar 11, 2024

@haunma Btw, does it work with screenrecord?

adb shell screenrecord /sdcard/file.mp4
adb pull /sdcard/file.mp4

@haunma
Copy link
Author

haunma commented Mar 12, 2024

@rom1v, as mentioned in the initial bug report, it is hit or miss. I was able to get a brief recording a couple of times, but it doesn't always work, often leaving a zero-length file.

My phone is old (Moto Z Play) and running LineageOS Android 18.1. I imagine there is something odd about it. Chalk it up to Android fragmentation? Anyway, my use case for scrcpy has passed, for now. Maybe next time I need something like that I will give it another go.

If you're reasonably confident the issue is on the device, I have no objections to closing this.

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