Open MC-dusk opened 3 years ago
You can't. Android decided that its audio capture API would let the apps decide if they allow to be captured 😕
I'm confused. Some apps can record and stream screen to live broadcast platform like douyu
or huya
on android phone, and there are both video and audio in it. How can these apps do it?
Some apps do not really capture audio output, they use the microphone (so if you talk or make noise next to the device, you can ear it).
Some apps do not really capture audio output, they use the microphone
I think it does make sense. For example, I tried du-recorder and it worked just as you said. However, I'm using Huawei P30 with Android 10 (or called EMUI10), and there is a default screen record app in it which can record both video and audio. It can let you choose recording microphone or not which means the sound inside can be captured separately. I tried it and it worked, just sound inside from my app, no voice from outside. Is it because the app is a system app which has special authority, or the Android system is modified by Huawei?
If you can dump the app, I'm interested.
adb shell pm list packages -f
Then adb pull
the apk.
Here is it. HwScreenRecorder.zip
OK thank you, it seems that they added an internal AudioSource NEW_INTERFACE_REMOTE_SUBMIX
having value 10007.
To test on your device, could you apply these changes, please?
diff --git a/app/src/main/java/com/rom1v/sndcpy/RecordService.java b/app/src/main/java/com/rom1v/sndcpy/RecordService.java
index 8486332..5bd740b 100644
--- a/app/src/main/java/com/rom1v/sndcpy/RecordService.java
+++ b/app/src/main/java/com/rom1v/sndcpy/RecordService.java
@@ -151,7 +151,7 @@ public class RecordService extends Service {
AudioRecord.Builder builder = new AudioRecord.Builder();
builder.setAudioFormat(createAudioFormat());
builder.setBufferSizeInBytes(1024 * 1024);
- builder.setAudioPlaybackCaptureConfig(createAudioPlaybackCaptureConfig(mediaProjection));
+ builder.setAudioSource(10007);
return builder.build();
}
Well, it seems that the app sndcpy doesn't work if change the code
- builder.setAudioPlaybackCaptureConfig(createAudioPlaybackCaptureConfig(mediaProjection));
+ builder.setAudioSource(10007);
VLC on PC doesn't receive any stream, the time keeps on 00:00.
I believe the hidden NEW_INTERFACE_REMOTE_SUBMIX requires android.permission.CAPTURE_AUDIO_OUTPUT, which is only granted to non-third party applications and why the huawei app is capable of using it. Unless the system is rooted, using it in sndcpy will not be possible.
I also encountered this problem. At present, not all application audio support is captured, but these applications are unlikely to make changes to be captured, and it may require developers to spend some precious time on technical or For functional additions, you can check how this software implements audio forwarding for all applications, https://www.apowersoft.cn/phone-mirror, I am very envious of the developer’s wisdom and technology, and I hope this program can become better!
To capture all audio, some programs typically use the microphone. But this is not a real solution, it also captures the environment.
You are right, it is true in some programs, although this is not a real solution, but before we can figure out and find a more suitable solution, it is also very good to capture all the audio by capturing the environment. Yes, although it is not a very good real solution, it is better than nothing~ The specific content and decision still need to be carefully evaluated by the developer. I only considered the completeness of the function. Developers need to consider many aspects, you can check my suggestions, thank you!
A better solution is just to use audio bluetooth separately.
Also see my comment here: https://www.reddit.com/r/Android/comments/o4pdxt/scrcpy_now_supports_android_12/h2ipu7y/?context=3
I wonder if its possible to fake bluetooth over USB.
A better solution is just to use audio bluetooth separately.
Also see my comment here: https://www.reddit.com/r/Android/comments/o4pdxt/scrcpy_now_supports_android_12/h2ipu7y/?context=3
Well, that works, but bluetooth can have bad quality, some PCs don't have bluetooth chips and having it work over ip is much more universally usable (longer distances, etc.).
Is there a way to allow to have a PC be a real android audio sink (like a bluetooth device) by something like dlna/upnp or something like that?
A better solution is just to use audio bluetooth separately.
Also see my comment here: https://www.reddit.com/r/Android/comments/o4pdxt/scrcpy_now_supports_android_12/h2ipu7y/?context=3
Apologies for reviving this old thread but how can I use audio bluetooth thing you mentioned? I am unable to recieve call audio on my PC through sndcpy. Is there any way to make my phone think that my PC is an audio device (like bluetooth earphones) so I can use bluetooth to recieve call audio on my PC?
A better solution is just to use audio bluetooth separately. Also see my comment here: https://www.reddit.com/r/Android/comments/o4pdxt/scrcpy_now_supports_android_12/h2ipu7y/?context=3
Apologies for reviving this old thread but how can I use audio bluetooth thing you mentioned? I am unable to recieve call audio on my PC through sndcpy. Is there any way to make my phone think that my PC is an audio device (like bluetooth earphones) so I can use bluetooth to recieve call audio on my PC?
As that said above, try UWP Bluetooth Audio Receiver
A better solution is just to use audio bluetooth separately. Also see my comment here: https://www.reddit.com/r/Android/comments/o4pdxt/scrcpy_now_supports_android_12/h2ipu7y/?context=3
Apologies for reviving this old thread but how can I use audio bluetooth thing you mentioned? I am unable to recieve call audio on my PC through sndcpy. Is there any way to make my phone think that my PC is an audio device (like bluetooth earphones) so I can use bluetooth to recieve call audio on my PC?
As that said above, try UWP Bluetooth Audio Receiver
Unfortunately, it's unable to receive call audio.
Thank U for the nice job. I can get audio from
twitter
,youtube
,VLC
andQQmusic
successfully. But when I useNetEase CloudMusic
,Clash of Clans
, I can't hear anything on PC. I know that it's because of Apps restrictions. But I really want to get audio from those apps, what can I do? Is this project can't solve the problem and I should look for another method or program?