sndcpy
sndcpy copied to clipboard
Support scrcpy
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)
Should I open 2 cmd separately?
Yes, these are two separate programs.
And if I must have both projects in a separate folder or can I be in the same folder (the files)
In theory, they should be in separate folders, but it should also work if you merge the folders.
This does not work for me.
When I start sndcpy first I get this output:
Waiting for device...
adb server version (39) doesn't match this client (40); killing...
* daemon started successfully
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.9 Vetinari (revision 3.0.8-140-gc6f0441908)
[000055e470fa7ab0] dummy interface: using the dummy interface module...
[00007f6f540015d0] main stream error: connection error: Connection refused
It works fine until I start scrcpy, then the sound breaks and I get the following line from sndcpy:
[000055e470f65a40] main playlist: end of playlist, exiting
When I start scrcpy first I get the following output:
INFO: scrcpy 1.14 <https://github.com/Genymobile/scrcpy>
adb server version (40) doesn't match this client (39); killing...
* daemon started successfully
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed. 3.6 MB/s (33142 bytes in 0.009s)
[server] INFO: Device: OnePlus ONEPLUS A5010 (Android 10)
INFO: OpenGL shaders: ENABLED
INFO: Created renderer: opengl
INFO: Renderer: opengl
INFO: OpenGL version: 3.0 Mesa 19.2.8
INFO: Trilinear filtering enabled
INFO: Initial texture: 1080x2160
When I start sndcpy, then scrcpy will stop and output the following:
WARN: Device disconnected
Can you please let us know how this should be done? Or is it a bug that should be fixed?
You must use the same adb version for both programs.
You probably use adb.exe from elsewhere. Either make sure they use the same by default (check your PATH, the version of adb.exe in their directory...) or use the environment variable ADB to force a specific path.
https://github.com/Genymobile/scrcpy/issues/518#issuecomment-488975471
https://stackoverflow.com/questions/38214012/solving-adb-server-version-doesnt-match-this-client-error
Hi, i also wanted to make them run together in single script, but my knowledge is limited. I tried to combine them both, AFAIK if you run sndcpy first then scrcpy, you can run them both in single script. I haven't try this yet since i wanted scrcpy to run first, otherwise i have to press it on my phone and it will introduce ghost touch. Any solution?
Hi, i also wanted to make them run together in single script, but my knowledge is limited. I tried to combine them both, AFAIK if you run sndcpy first then scrcpy, you can run them both in single script. I haven't try this yet since i wanted scrcpy to run first, otherwise i have to press it on my phone and it will introduce ghost touch. Any solution?
I managed to run them with a single bat file like this
display_only.bat: d: cd D:\Projects\Android Display\scrcpy adb connect 192.168.1.65:5555 scrcpy -w -S -m 2280 --bit-rate 8M --fullscreen adb shell input keyevent 164
screen_only.bat: d: cd D:\Projects\Android Display\sndcpy adb connect 192.168.1.65:5555 sndcpy
start_combo.bat: wt "D:\Projects\Android Display\display_only.bat" ; sp "D:\Projects\Android Display\sound_only.bat"
I changed my default cmd to Windows Terminal so when I run start_combo.bat, scrcpy and sndcpy run in one window like this

Is there any fix to this issue? I am getting the same error too.
Hi I also able to join them finally and they will run on one terminal only. However to do this you need to copy all the scrcpy and sndcpy files into one folder, for adb just take the adb from scrcpy or you could also make adb globally.
%ADB% %serial% forward tcp:%SNDCPY_PORT% localabstract:sndcpy || goto :error ::%ADB% %serial% shell am start com.rom1v.sndcpy/.MainActivity || goto :error %ADB% %serial% shell pm grant ch.gridvision.ppam.androidautomagic android.permission.RECORD_AUDIO || goto :error echo Press Enter once audio capture is authorized on the device to start playing... pause >nul echo Playing audio... %VLC% -Idummy --demux rawaud --network-caching=0 --play-and-exit tcp://localhost:%SNDCPY_PORT% scrcpy --turn-screen-off --stay-awake --bit-rate 20M %* goto :EOF
:error echo Failed with error #%errorlevel%. pause exit /b %errorlevel%
just replace from line 27 in sndcpy.bat with that and you're good to go