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

Scrcpy crashes when using --no-window mode and turning off the PC's monitor #5902

Open
SadSock opened this issue Mar 5, 2025 · 7 comments
Open

Comments

@SadSock
Copy link

SadSock commented Mar 5, 2025

Environment

  • OS: ubuntu 24.10
  • Scrcpy version: 3.1
  • Installation method: brew
  • Device model: xiaomi
  • Android version: 14

Describe the bug

  1. Start scrcpy with scrcpy --v4l2-sink=/dev/video0 --no-window --audio-source=playback --audio-dup

  2. Turn off the PC's monitor

Image

@rom1v
Copy link
Collaborator

rom1v commented Mar 5, 2025

What's the error? (something is written in chinese in the screenshot)

Please post the console output as text.

Can you reproduce with scrcpy --record=file.mp4 --no-window?

@SadSock
Copy link
Author

SadSock commented Mar 6, 2025

What's the error? (something is written in chinese in the screenshot)

Please post the console output as text.

Can you reproduce with scrcpy --record=file.mp4 --no-window?

still crash, the output is

C(base) xwu@5600g:~$ scrcpy --record=file.mp4 --no-window
scrcpy 3.1 <https://github.com/Genymobile/scrcpy>
INFO: ADB device found:
INFO:     -->   (usb)  8f5dca0c                        device  2211133C
/home/linuxbrew/.linuxbrew/Cellar/scrcpy/3.1/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 138.2 MB/s (90640 bytes in 0.001s)
[server] INFO: Device: [Xiaomi] Xiaomi 2211133C (Android 15)
INFO: Recording started to mp4 file: file.mp4
WARN: [FFmpeg] track 1: codec frame size is not set
段错误

段错误 is Segmentation fault

@rom1v
Copy link
Collaborator

rom1v commented Mar 6, 2025

I cannot reproduce.

It seems you installed the binary from linuxbrew. Can you reproduce the problem with:

?

@SadSock
Copy link
Author

SadSock commented Mar 6, 2025

I cannot reproduce.

It seems you installed the binary from linuxbrew. Can you reproduce the problem with:

?

the official static binary is also crash.

(base) xwu@5600g:~/Downloads/scrcpy-linux-x86_64-v3.1$ ./scrcpy --v4l2-sink=/dev/video0 --no-window --audio-source=playback --audio-dup
scrcpy 3.1 <https://github.com/Genymobile/scrcpy>
INFO: ADB device found:
INFO:     -->   (usb)  8f5dca0c                        device  2211133C
/home/xwu/Downloads/scrcpy-linux-x86_64-v3.1/scrcpy-server: 1 file pushed, 0 skipped. 113.6 MB/s (90640 bytes in 0.001s)
[server] INFO: Device: [Xiaomi] Xiaomi 2211133C (Android 15)
INFO: v4l2 sink started to device: /dev/video0
段错误

@rom1v
Copy link
Collaborator

rom1v commented Mar 6, 2025

ulimit -c unlimited
./scrcpy --record=file.mp4 --no-window  # make it crash
# it will generate a core dump in the current directory, a file core.NUMBER
gdb ./scrcpy ./core.NUMBER  # adapt NUMBER

What's the output?

@SadSock
Copy link
Author

SadSock commented Mar 6, 2025

ulimit -c unlimited
./scrcpy --record=file.mp4 --no-window # make it crash
it will generate a core dump in the current directory, a file core.NUMBER
gdb ./scrcpy ./core.NUMBER # adapt NUMBER

What's the output?

I can not find core dump file on Ubuntu 24.10

@rom1v
Copy link
Collaborator

rom1v commented Mar 6, 2025

Let's do differently, by compiling the client with ASAN enabled:

sudo apt install ffmpeg libsdl2-2.0-0 adb \
                 gcc git pkg-config meson ninja-build libsdl2-dev \
                 libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev \
                 libswresample-dev libusb-1.0-0 libusb-1.0-0-dev
git clone https://github.com/Genymobile/scrcpy
cd scrcpy
meson setup x --buildtype=debug -Db_sanitize=address \
    -Dprebuilt_server=/home/xwu/Downloads/scrcpy-linux-x86_64-v3.1/scrcpy-server
meson compile -Cx

Then run:

meson devenv -Cx
scrcpy --record=file.mp4 --no-window

Once it crashes, you should get a stack trace.

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

2 participants