scrcpy icon indicating copy to clipboard operation
scrcpy copied to clipboard

Sound related issues

Open mdziczkowski opened this issue 1 year ago • 12 comments

Please read the prerequisites to run scrcpy.

Also read the FAQ and check if your issue already exists.

Environment

  • OS: Debian (codename: bookworm)
  • Scrcpy version: 2.6.1
  • Installation method: included to scrcpy script (after cloning the repo)
  • Device model: Oppo Reno 5 5G
  • Android version: 13

Describe the bug

After launching of scrcpy, the music that was runing on the device got disabled, even if I had included to don't forward audio, don't forward audio playback and don't forward any playback

Console output

Additionally, I have recieved multiple times same following console output related to the audio:

ALSA lib pcm.c:8570:(snd_pcm_recover) underrun occurred

mdziczkowski avatar Aug 14 '24 20:08 mdziczkowski

What exact command did you execute?

rom1v avatar Aug 14 '24 20:08 rom1v

I tryed all combinations of the variations of thr parameters:

--no-audio
--no-audio-palyback
--no-playback

mdziczkowski avatar Aug 15 '24 08:08 mdziczkowski

Audio may not be captured/forwarded if you pass --no-audio, that's not possible. 🤔

What is the full output in the console when you execute scrcpy --no-audio?

rom1v avatar Aug 15 '24 10:08 rom1v

Audio may not be captured/forwarded if you pass --no-audio, that's not possible. 🤔

What is the full output in the console when you execute scrcpy --no-audio?

As mentioned, I tryed of any combinations of parameters (with are listed in scrcpy's man? help and usage) that should disable forwarding audio and media in between the pc and mobile device, but it's like you wrote, scrcpy seem to ignore them.

mdziczkowski avatar Aug 30 '24 07:08 mdziczkowski

scrcpy seem to ignore them.

How do you provide the parameters? Please post a screenshot of your terminal.

rom1v avatar Aug 30 '24 07:08 rom1v

I had created a bash script that executes the scrcpy with given parameters.

I think that including a screenshoot with would display the same as given above (besides of the linux "shebang") has no sense

mdziczkowski avatar Sep 26 '24 17:09 mdziczkowski

I had created a bash script that executes the scrcpy with given parameters.

Please post that exact bash script then, and the exact output you get.

rom1v avatar Sep 26 '24 18:09 rom1v

#!/bin/bash

cmd=$(scrcpy --no-audio --no-audio-playback --no-playback)

nice -n19 ${cmd} &

mdziczkowski avatar Sep 27 '24 11:09 mdziczkowski

cmd=$(scrcpy --no-audio --no-audio-playback --no-playback)

Firstly, --no-playback here implies --no-audio and --no-video, so your intent is to only get control?

But the most important issue here is that in bash, cmd=$(something) will assign to cmd the output of something (i.e. what it prints to the console), not something itself, so I'm not sure what you're trying to do here.

Before trying to run with nice, just run scrcpy --no-audio. In your first post, you said:

After launching of scrcpy, the music that was running on the device got disabled, even if I had included to don't forward audio

If you run scrcpy --no-audio (just that), that's not possible.

rom1v avatar Sep 27 '24 12:09 rom1v

First, I wanted ro mention that I had trunchated the complete script and made it as simple as possible to make it easier to read and skipping most of it's orginal functionality.

The orginal script had a menu with would like to select in with mode it would be scrcpy run and depending from that, propper switches would become set.

In reference to Your answers:

Firstly, --no-playback here implies --no-audio and --no-video, so your intent is to only get control?

In one option, yes. This should allow me to remotly control the device while listening music on it.

Currently, running scrcpy (even with given switches) stop's by me the music

But the most important issue here is that in bash, cmd=$(something) will assign to cmd the output of something (i.e. what it prints to the console), not something itself, so I'm not sure what you're trying to do here.

As mentioned above, the assigning to "cmd" is a simplicization of the command for better readibility.

Besides of that, in Linux you can assign a command (with switches) to a variable if you need to use it multiple times to don't need to repeatly write it every time

Before trying to run with nice, just run scrcpy --no-audio

The nice command is there only to control the process priority

mdziczkowski avatar Sep 28 '24 15:09 mdziczkowski

Besides of that, in Linux you can assign a command (with switches) to a variable if you need to use it multiple times to don't need to repeatly write it every time

Yes, but the syntax is not cmd=$(yourcommand), but cmd="yourcommand" ($() is for executing a subprocess and returning the output).

The nice command is there only to control the process priority

Sure, but in the script you posted, you passed wrong arguments (but ok this is maybe only a bug in your simplified script).

In any case, without using a script, and just executing scrcpy --no-audio, that cannot impact audio on the device. If it does, then the argument is not correctly passed.

rom1v avatar Sep 28 '24 16:09 rom1v

Yes, but the syntax is not cmd=$(yourcommand), but cmd="yourcommand" ($() is for executing a subprocess and returning the output).

Sure, but in the script you posted, you passed wrong arguments (but ok this is maybe only a bug in your simplified script).

ah yes, right..sorry... I had typed the "$( )" by error. Thanks for pointing it out 😉👍

In any case, without using a script, and just executing scrcpy --no-audio, that cannot impact audio on the device. If it does, then the argument is not correctly passed.

Actually, I did a so called "mind shortcut" and had put the command together to skip the "mode selection" step with would pass the parameters to scrcpy 😉

mdziczkowski avatar Sep 28 '24 21:09 mdziczkowski