Problem with scrcpy on Ubuntu 24.04
After search around, I found pkgx is the most convenient way to run latest scrcpy on ubuntu without manually build.
But I encounter some problems:
>>> pkgx scrcpy
scrcpy 2.6 <https://github.com/Genymobile/scrcpy>
ERROR: Could not initialize SDL audio: dsp: No such audio device
exec: No such file or directory
ERROR: Command not found: [adb], [start-server]
ERROR: (make 'adb' accessible from your PATH or define its fullpath in the ADB environment variable)
INFO: You may install 'adb' by "apt install adb"
ERROR: Could not start adb server
Seemes the dependency adb is missing.
After install 'adb' as suggested, I still get error
>>> sudo apt install adb
>>> pkgx scrcpy
scrcpy 2.6 <https://github.com/Genymobile/scrcpy>
ERROR: Could not initialize SDL audio: dsp: No such audio device
ERROR: Could not start adb server
Any suggestion to fix the problem?
it's a very good question. in general, running pkgx under sudo can cause permissions errors down the road, but it's worth a try to see if this is a permissions problem.
however, before doing that, i might try playing with this option:
--audio-source=source
Select the audio source (output, mic or playback).
The "output" source forwards the whole audio output, and disables playback on
the device.
The "playback" source captures the audio playback (Android apps can opt-out,
so the whole output is not necessarily captured).
The "mic" source captures the microphone.
Default is output.
as it sounds like maybe it's having an issue connecting to the dsp device.
I have tried changing the audio source with --audio-source=output, --audio-source=mic, or --audio-source=playback, and also tried running pkgx with sudo. None of these worked 😭 and the error message is the same.
interesting. are other alsa-based tools working correctly? or pkgx mpg123? my guess is linux sound system fragmentation is to blame here.
the fact that the adb server won't start might also be to blame. you might want to run adb start-server and see what it tells you.
mpg123failed to run:
>>> pkgx mpg123 -v example.mp3
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
version 1.32.7; written and copyright by Michael Hipp and others
free software (LGPL) without any warranty but with best wishes
Decoder: x86-64 (AVX)
Trying output module: oss, device: <nil>
[src/libout123/modules/oss.c:open_oss():174] error: Can't open default sound device!
[src/libout123/libout123.c:check_output_module():1163] error: Module 'oss' device open failed.
[src/libout123/libout123.c:out123_open():484] error: Found no driver out of [oss] working with device <default>.
main: [src/mpg123.c:check_fatal_output():338] error: out123 error 3: failure loading driver module
>>> pkgx mpg123 --list-modules
Available modules
-----------------
oss output Output audio using OSS
dummy output Dummy audio output - does not output audio.
raw output raw headerless stream (builtin)
cdr output compact disc digital audio stream (builtin)
wav output RIFF WAVE file (builtin)
au output Sun AU file (builtin)
test output output into the void (builtin)
sleep output output into the void that takes its time (builtin)
hex output interleaved hex printout (builtin)
txt output plain text printout, a column per channel (builtin)
I not sure is it relevant, but pipeWire has been set to default for audio since Ubuntu 22.10.
adb start-serverseemes work fine, nothing was returned.
hm, i wonder if they need a build flag or something to support that.
if you rebuild either scrcpy or mpg123 on your ubuntu22 instance, does it make a difference? i can give it a try in docker tomorrow.
Sorry, I don't have a Ubuntu 22.04 instance currently 😓