rom1v / sndcpy Goto Github PK
View Code? Open in Web Editor NEWAndroid audio forwarding (scrcpy, but for audio)
License: MIT License
Android audio forwarding (scrcpy, but for audio)
License: MIT License
I’m using huawei‘s EMUI 10.1 and Notification bar shows forwarding (Microphone permission has been given).But nothing happened after “playing audio” has occurred.
I have changed the vlc to the correct path on my win10 without changing other configs.
Mybe I need to install VLC to the default path ?
Apps like Saavn, Video Player in Huawei, MX Player etc. cannot transmit sound. Any help?
Hey.
I followed the guide.
Mi phone is connected via USB with debug mode enabled. I then start sndcpy.bat either by itself or by cmd.
It's always stuck on "Waiting for device..."
I tried every option when connecting the phone to the computer. Enabling all debugging options in the developer menu. Disabling MIUI optimizations. Changing cable and usb ports. Makes no difference.
VLC is correctly installed but I had to change the folder in the bat file as it pointed to the 64bit variant but I have the 32bit one.
I predict this repository will be very famous!
Thanks for author's nice work~👍
Hello, thanks for your amazing work, i use scrcpy for streaming in Twitch!
Sir, i have a question, is there any way to force apps mirroring audio with sndcpy? The game that i want to mirror it's audio doesn't allows it, i know that there are this policy but is there any way to force it? Thanks!!
Hello can you please help, I cloned the repo and ran the executable everything went fine but I wasn't able to hear anything when I played music on my phone.
❯ ./sndcpy
Waiting for device...
Performing Streamed Install
Success
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.rom1v.sndcpy/.MainActivity }
Press Enter once audio capture is authorized on the device to start playing...
VLC media player 3.0.11 Vetinari (revision 3.0.11-0-gdc0c5ced72)
[00007fe1c911e6c0] dummy interface: using the dummy interface module...
I also opened scrcpy but nothing happened
I am using Xiaomi Poco F1 running Android 10
Thanks!
LOG:
./sndcpy
Waiting for device...
Performing Streamed Install
Success
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.rom1v.sndcpy/.MainActivity }
Press Enter once audio capture is authorized on the device to start playing...
VLC media player 3.0.8 Vetinari (revision 3.0.8-0-gf350b6b5a7)
shared memfd open() failed: Function not implemented
[00007fffb96d76d0] vlcpulse audio output error: PulseAudio server connection failure: Connection refused
[00007fffb96eea90] dbus interface error: Failed to connect to the D-Bus session daemon: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
[00007fffb96eea90] main interface error: no suitable interface module
[00007fffb960e2a0] main libvlc error: interface "dbus,none" initialization failed
[00007fffb96fff10] main interface error: no suitable interface module
[00007fffb960e2a0] main libvlc error: interface "globalhotkeys,none" initialization failed
[00007fffb96fff10] dummy interface: using the dummy interface module...
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM default
[00007fffb96d76d0] alsa audio output error: cannot open ALSA device "default": No such file or directory
[00007fffb96d76d0] main audio output error: Audio output failed
[00007fffb96d76d0] main audio output error: The audio device "default" could not be used:
No such file or directory.
[00007fffb96d76d0] main audio output error: module not functional
[00007f9078008050] main decoder error: failed to create audio output
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM default
[00007fffb96d76d0] alsa audio output error: cannot open ALSA device "default": No such file or directory
[00007fffb96d76d0] main audio output error: Audio output failed
[00007fffb96d76d0] main audio output error: The audio device "default" could not be used:
No such file or directory.
[00007fffb96d76d0] main audio output error: module not functional
[00007f9078008050] main decoder error: failed to create audio output
[00007f9078008050] main decoder error: buffer deadlock prevented
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM default
[00007fffb96d76d0] alsa audio output error: cannot open ALSA device "default": No such file or directory
[00007fffb96d76d0] main audio output error: Audio output failed
[00007fffb96d76d0] main audio output error: The audio device "default" could not be used:
No such file or directory.
Running on WSL cause the windows verision didnt even show anything after saying playing Audio.
Android: 10
Adb Version:41
I tried running sndcpy on Windows 10 but what I get is this error:
❯ .\sndcpy
Waiting for device...
Performing Streamed Install
adb: failed to install sndcpy.apk: Failure [INSTALL_FAILED_OLDER_SDK: Failed parse during installPackageLI: /data/app/vmdl20906841.tmp/base.apk (at Binary XML file line #7): Requires newer sdk version #29 (current version is #25)]
Uninstalling existing version first...
Exception occurred while dumping:
java.lang.IllegalArgumentException: Unknown package: com.rom1v.sndcpy
at com.android.server.pm.Settings.isOrphaned(Settings.java:4280)
at com.android.server.pm.PackageManagerService.isOrphaned(PackageManagerService.java:18294)
at com.android.server.pm.PackageManagerService.deletePackage(PackageManagerService.java:15670)
at com.android.server.pm.PackageInstallerService.uninstall(PackageInstallerService.java:888)
at com.android.server.pm.PackageManagerShellCommand.runUninstall(PackageManagerShellCommand.java:799)
at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:118)
at android.os.ShellCommand.exec(ShellCommand.java:94)
at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:18554)
at android.os.Binder.shellCommand(Binder.java:468)
at android.os.Binder.onTransact(Binder.java:367)
at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:2408)
at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:3078)
at android.os.Binder.execTransact(Binder.java:565)
Performing Streamed Install
adb: failed to install sndcpy.apk: Failure [INSTALL_FAILED_OLDER_SDK: Failed parse during installPackageLI: /data/app/vmdl322574919.tmp/base.apk (at Binary XML file line #7): Requires newer sdk version #29 (current version is #25)]
Failed with error #1.
Press any key to continue . . .
I also tried copying the apk to the device and then tried installing from there but the message I got was: "There was a problem parsing the package."
how to forward voice chat or external audio to pc using sndcpy? can you help me ?
So first time i tried your program it was working fine, but after some time it uninstalled itself, i don't know why its happen, now after that i tried to install it it again by running the bat file by cmd it gives this error(see screenshot.1),
now after revoking usb debugging auth and deleting the ".android" folder i tried once and then i gave me this error( see screen shot.2).
please help me with this.
The app runs fine but it has only access to some apps. Like if i play a song through Google play no audio is forwarded. But if i play a video on Youtube app audio is forwarded. please fix this issue and it would be great.
i cannot hear the pubg mobile audio, but another apps such ass clash of clans doing so well
does this work with wireless ADB?
After allowing to record the sndcpy apk crashes and nothing happens, Any Solution? Im using custom rom
Exception occurred while executing:
java.lang.IllegalArgumentException: Unknown package: com.rom1v.sndcpy
at com.android.server.pm.Settings.isOrphaned(Settings.java:4307)
at com.android.server.pm.PackageManagerService.isOrphaned(PackageManagerService.java:21714)
at com.android.server.pm.PackageManagerService.deletePackageVersioned(PackageManagerService.java:18476)
at com.android.server.pm.PackageInstallerService.uninstall(PackageInstallerService.java:738)
at com.android.server.pm.PackageManagerShellCommand.runUninstall(PackageManagerShellCommand.java:1486)
at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:193)
at android.os.ShellCommand.exec(ShellCommand.java:103)
at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:21957)
at android.os.Binder.shellCommand(Binder.java:629)
at android.os.Binder.onTransact(Binder.java:527)
at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:2834)
at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:4020)
at android.os.Binder.execTransact(Binder.java:726)
I followed every step, but nothing played in PC, and it shows 'Waiting for connection' at the phone. But the Android system told that the app is recoding voice.
At Pc, system show the VLC is runing but not voice played.
Android version:10
OS:MIUI 12
windows 10
C:\cprojects\scrcpy-win64-v1.13>adb connect 192.168.1.5
connected to 192.168.1.5:5555
C:\cprojects\scrcpy-win64-v1.13>sndcpy
Waiting for device...
Performing Streamed Install
Success
5555
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.rom1v.sndcpy/.MainActivity }
Press Enter once audio capture is authorized on the device to start playing...
Playing audio...
EDIT:
While it seems works only for several APPs, I still haven't figured out the reson and which APPs worked for it ....
Instead of having VLC as a peer dependency you could distribute this package with a slimmed down version of ffplay and use the following command to play the audio:
$ ffplay -autoexit -nodisp -probesize 32 -f s16le -ar 48k -ac 2 -sync ext tcp://localhost:28200
Latency is still pretty bad, but better than VLC at least.
Waiting for device...
Performing Streamed Install
adb: failed to install sndcpy.apk: Failure [INSTALL_FAILED_USER_RESTRICTED: Invalid apk]
Uninstalling existing version first...
Exception occurred while executing:
java.lang.IllegalArgumentException: Unknown package: com.rom1v.sndcpy
at com.android.server.pm.Settings.isOrphaned(Settings.java:4307)
at com.android.server.pm.PackageManagerService.isOrphaned(PackageManagerService.java:21723)
at com.android.server.pm.PackageManagerService.deletePackageVersioned(PackageManagerService.java:18460)
at com.android.server.pm.PackageInstallerService.uninstall(PackageInstallerService.java:751)
at com.android.server.pm.PackageManagerShellCommand.runUninstall(PackageManagerShellCommand.java:1486)
at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:193)
at android.os.ShellCommand.exec(ShellCommand.java:103)
at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:21980)
at android.os.Binder.shellCommand(Binder.java:634)
at android.os.Binder.onTransact(Binder.java:532)
at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:2809)
at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:4023)
at android.os.Binder.execTransact(Binder.java:735)
Failed with error #255.
Press any key to continue . . .
My phone is on Android 9, my pc is on Windows 7
Scrcpy woks fine.
I have extracted sndcpy-with-adb-windows-v1.0.zip into a folder and run sndcpy.bat, typed in "sndcpy" and the output was following:
Waiting for device...
Performing Streamed Install
adb: failed to install sndcpy.apk: Failure [INSTALL_FAILED_USER_RESTRICTED: Inva
lid apk]
Uninstalling existing version first...
Exception occurred while executing:
java.lang.IllegalArgumentException: Unknown package: com.rom1v.sndcpy
at com.android.server.pm.Settings.isOrphaned(Settings.java:4306)
at com.android.server.pm.PackageManagerService.isOrphaned(PackageManager
Service.java:21620)
at com.android.server.pm.PackageManagerService.deletePackageVersioned(Pa
ckageManagerService.java:18379)
at com.android.server.pm.PackageInstallerService.uninstall(PackageInstal
lerService.java:738)
at com.android.server.pm.PackageManagerShellCommand.runUninstall(Package
ManagerShellCommand.java:1486)
at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageMan
agerShellCommand.java:193)
at android.os.ShellCommand.exec(ShellCommand.java:103)
at com.android.server.pm.PackageManagerService.onShellCommand(PackageMan
agerService.java:21877)
at android.os.Binder.shellCommand(Binder.java:634)
at android.os.Binder.onTransact(Binder.java:532)
at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.ja
va:2809)
at com.android.server.pm.PackageManagerService.onTransact(PackageManager
Service.java:4021)
at android.os.Binder.execTransact(Binder.java:731)
Failed with error #255.
I'm not very experienced in coding/programming but as far as i can understand it says that sndcpy.apk is invalid. I have tried connecting my phone via usb and wirelessly trough adb but outcome was the exact same in both cases. Also i tried moving sndcpy.apk on my Google Drive so that i could install it on my phone but it says "Error parsing package" or something similar.
As i've mentioned before i'm not very experienced in coding/programming so i am not able to build the apk using Gradle or in any other way.
it works perfectly on my Xiaomi device(Pocophone F1, chip 845 android 10), but on Vivo device(Vivo IQOO 855, android 10, chip 855 it doesn't) everything runs fine but in the end doesn't have any sound from my laptop.
Thank you for your hard work. I love these codes and love you too <3
I know that earlier android versions dont support capturing system audio so i would like to know if any of the following allows capturing it anyway:
After connecting to the pc from console, its playing audio properly from mobile system audio, youtube, video player(MX player) but when I open PUBG mobile or Spotify it does not play from pc.
Hi, I can listen the audio from youtube and other music app but can't listen Netflix audio.
Please let me know if this is blocked by Netflix or something else is wrong.
Hello, where should I enable this?
https://imgur.com/a/XWvVf9p
Hi Dude,
Could you please do for Android 9. You can help many, if you can support Android 9 with zoom sound forward. Thanks! Do you have any plan?
Can it support Android 8?
Wondering if its possible to have a version that supports playing with mpv player
Waiting for device...
Performing Streamed Install
Success
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.rom1v.sndcpy/.MainActivity }
Press Enter once audio capture is authorized on the device to start playing...
But after pressing Enter the CMD closes and nothing is playing. I'm not very fond of coding but I really like scrcpy and have been eagerly waiting for the audio version. Can you tell me what's wrong and what to do? Thank you.
Can sndcpy be used as a source for microphone output? It looks like it can(theoratically) forward call audio but can it be used for audio source. For reference Android 11 beta 2 allows both internal sound and microphone to be used as source of audio all together while recording. I haven't tried the app yet but just a curious question.
Can the SDK target be lowered to include earlier android versions?
As the title says.
I don't want to disconnect the usb cable.
And closing the cmd window is not an option, since it still listens.
Neither closing vlc. Since the same, it continues listening.
Hi, thanks for developing this, very useful!
I successfully played audio from sources like youtube, spotify and subway surfers.
But for some games, the audio doesn't play at all. Not working in: Dragonball Legends, Score Hero.
Any idea why? My phone is a Xiaomi Mi A2 with Android 10.
Hi. I couldn't work on My K20 pro and windows 10 pc. Please help
Waiting for device...
Performing Streamed Install
adb: failed to install sndcpy.apk: Security exception: You need the android.permission.INSTALL_GRANT_RUNTIME_PERMISSIONS permission to use the PackageManager.INSTALL_GRANT_RUNTIME_PERMISSIONS flag
java.lang.SecurityException: You need the android.permission.INSTALL_GRANT_RUNTIME_PERMISSIONS permission to use the PackageManager.INSTALL_GRANT_RUNTIME_PERMISSIONS flag
at com.android.server.pm.PackageInstallerService.createSessionInternal(PackageInstallerService.java:542)
at com.android.server.pm.PackageInstallerService.createSession(PackageUninstalling existing version first...
Failure [DELETE_FAILED_INTERNAL_ERROR]
Failed with error #1.
Press any key to continue . . .
This is the error i get. Can You please help me out with this?
Good!
As the title says. This project works together with scrcpy.
My idea is to send my screen to the pc and the audio using this project.
If you tell me that if you can, could you tell me how?
Should I open 2 cmd separately? or from just one.
And if I must have both projects in a separate folder or can I be in the same folder (the files)
Unfortunately, on my mobile phone, only the internal audio of YouTube can be transmitted to windows 10 using sndcpy, and the sound collected by the microphone of my mobile phone cannot be transmitted. If possible, I hope it can collect all the sounds inside the mobile phone.
Model: Mi 10Pro
Android version: 10
MIUI version: MIUI 12
(T_T)
Thanks to @rom1v :)
Testing on macos with Pixel 2XL and the feature works fine.
But the lag is quite obvious , around 3-5 seconds.
Just want to know any suggestion to decrease the lag, or any plan to improve it?
I love using Scrcpy for the video. I use it with the highest quality, bitrate and other settings. It would be even better if it had an option to transmit sound via USB. But, It fortunatly doesn't have one 😥. I have a Samsung Galaxy S8+ with android version 9 which is not supported by SoundCopy or sndcpy. I tried building the app, changing sdk version and other stuff but couldn't make it work with Android 9. I thought about upgrading to Android 10( which might kill my phone slowly). I request Github to make sndcpy available for Android 9 or older. Please, Do it for the sake of poor guys like me 😥
I received this issue when trying to run the bat file
adb: failed to install sndcpy.apk: Failure [INSTALL_FAILED_OLDER_SDK: Failed parse during installPackageLI: /data/app/vmdl1780591467.tmp/base.apk (at Binary XML file line #7): Requires newer sdk version #29 (current version is #28)]
What must I do to sort this issue out?
Waiting for device...
Performing Streamed Install
adb: failed to install sndcpy.apk: Failure [INSTALL_FAILED_OLDER_SDK: Failed parse during installPackageLI: /data/app/vmdl33316899.tmp/base.apk (at Binary XML file line #7): Requires newer sdk version #29 (current version is #24)]
Uninstalling existing version first...
Failure [DELETE_FAILED_INTERNAL_ERROR]
Performing Streamed Install
adb: failed to install sndcpy.apk: Failure [INSTALL_FAILED_OLDER_SDK: Failed parse during installPackageLI: /data/app/vmdl1606743385.tmp/base.apk (at Binary XML file line #7): Requires newer sdk version #29 (current version is #24)]
Failed with error #1.
Press any key to continue . . .
After upgrade to Android 11 beta2 , no data recorded.I have updated the source code and rebuilt to check LogData.
@rom1v Any idea please?
CMD seems to be nomal:
Waiting for device...
Performing Streamed Install
Success
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.rom1v.sndcpy/.MainActivity }
Press Enter once audio capture is authorized on the device to start playing...
Playing audio...
But when I play audio on the phone, my computer didn't receive it. I mean, the computer didn't play the sound on the phone.
And the app "sndcpy" on my phone displays "Waiting for connect".
I don't know if it is correct.
Removed -Idummy, VLC opened but when Ctrl + M, it always appear the message :
main error: connection error: Connection refused by peer
main error: connection error: Connection refused by peer
main error: connection error: Connection refused by peer
main error: connection error: Connection refused by peer
main error: connection error: Connection refused by peer
main error: connection error: Connection refused by peer
main error: connection error: Connection refused by peer
main error: connection error: Connection refused by peer
My device is MI A2 Lite - Android 10 Stock ROM.
Log:
Waiting for device...
Performing Streamed Install
Success
28200
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.rom1v.sndcpy/.MainActivity }
Press Enter once audio capture is authorized on the device to start playing...
Playing audio...
I am currently running this on S8 plus with custom ROM LineageOS 17.1 installed. May I know if this works with custom ROMs and if so, which ones? Scrcpy works perfectly. After pressing Start Now, the app crashes and is displayed in the screenshot. There is nothing else in the log after pressing Enter.
this app is working very good but with game (pubg)
it is not forwording audio
Whenever I run the .sndcpy program
these errors pop up
Waiting for device...
Performing Streamed Install
adb: failed to stat sndcpy.apk: No such file or directory
Uninstalling existing version first...
Failure [DELETE_FAILED_INTERNAL_ERROR]
[Process completed]
Thank you so much for helping me out
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.