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

Audio forwarding but keep on-phone audio on #3875

Closed
1 task done
LaplaceTor opened this issue Mar 29, 2023 · 10 comments
Closed
1 task done

Audio forwarding but keep on-phone audio on #3875

LaplaceTor opened this issue Mar 29, 2023 · 10 comments

Comments

@LaplaceTor
Copy link

LaplaceTor commented Mar 29, 2023

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

I try stream some mobile games via scrcpy, not only the audio forwarding but also the audio on-phone I need, that I can connect my headphone to the phone and have a no delay gameplay with an audio-on streaming

@rom1v
Copy link
Collaborator

rom1v commented Mar 29, 2023

As soon as the "remote submix" audio source is captured on Android, audio is automatically disabled on the device. I didn't find any way to configure this behavior.

If someone finds a way, I would be happy to add an option in scrcpy.

@LaplaceTor
Copy link
Author

As soon as the "remote submix" aufio source is captured, audio is disabled on the device. I didn't find any way to configure this behavior.

If someone finds a way, I would be happy to add an option.

How about an app install to phone with using the AudioPlaybackCapture API?
I use some other streaming apps in the past few years, they use this API but frame rate is worse than scrcpy so much.
In Android developer document, it told me that:
The MediaProjection API allows apps to acquire a MediaProjection token that gives them one time access to capture screen contents or audio

It's or not and so is it possible to capture audio only with an app and send it via adb?

@rom1v
Copy link
Collaborator

rom1v commented Mar 29, 2023

How about an app install to phone

Installing an additional app would add a lot of complexity (this implies 2 parts on the server side to coordinate with the client). As long as I can avoid that, I don't want to add an app (refs #3517).

with using the AudioPlaybackCapture API?

The AudioPlaybackCapture API is the API used by sndcpy. But it lets apps decide whether that can be captured or not, so in practice many apps are not captured. (refs blogpost)

@Gamusok
Copy link

Gamusok commented Jul 31, 2023

Isn't it possible then to have audio in both the computer and the android device?

@bombshit
Copy link

@rom1v Combining this with sndcpy can achieve this situation, but there is a non-negligible delay in the sound. I hope developers can find a better method. Secondly, I am thinking about how to solve the problem of scrcpy's audio forwarding function failing when the microphone is turned on on the mobile phone. I hope I can get help.

@rom1v
Copy link
Collaborator

rom1v commented Oct 31, 2023

To investigate: #4380

@TFWol
Copy link

TFWol commented Jun 18, 2024

Wow, the same question sure has been asked a lot.

I recommend pinning the Issue as a known Issue. It might cut down on some of the repeat questions.

Maybe reword it along the lines of "Playing from Device/Headphones and PC at the same time"

@jurassicjordan
Copy link

glad to know this is something still being worked on, any chance of seeing this feature in the near future?

rom1v added a commit that referenced this issue Jul 16, 2024
Add an option to duplicate audio on the device, compatible with the new
audio playback capture (--audio-source=playback).

Fixes #3875 <#3875>
Fixes #4380 <#4380>

Suggested-by: Simon Chan <1330321+yume-chan@users.noreply.github.com>
@rom1v
Copy link
Collaborator

rom1v commented Jul 16, 2024

any chance of seeing this feature in the near future?

Yes, now: #5102.

rom1v added a commit that referenced this issue Jul 17, 2024
Add an option to duplicate audio on the device, compatible with the new
audio playback capture (--audio-source=playback).

Fixes #3875 <#3875>
Fixes #4380 <#4380>

Co-authored-by: Simon Chan <1330321+yume-chan@users.noreply.github.com>
@rom1v rom1v closed this as completed in 31116a6 Aug 1, 2024
@rom1v
Copy link
Collaborator

rom1v commented Aug 1, 2024

Released in scrcpy 2.6 🚀

https://github.com/Genymobile/scrcpy/blob/master/doc/audio.md#duplication

FreedomBen pushed a commit to FreedomBen/scrcpy that referenced this issue Aug 2, 2024
Add an option to duplicate audio on the device, compatible with the new
audio playback capture (--audio-source=playback).

Fixes Genymobile#3875 <Genymobile#3875>
Fixes Genymobile#4380 <Genymobile#4380>
PR Genymobile#5102 <Genymobile#5102>

Co-authored-by: Simon Chan <1330321+yume-chan@users.noreply.github.com>
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

6 participants