Comments (14)
To replace VLC with mpv or ffplay, I tried using the following line replacements (for the line bellow "
echo Playing audio...
"). They seem to work well. In fact, I get very little delay with ffplay and both processes terminate on Windows after closing the script.For mpv:
mpv --demuxer=rawaudio --demuxer-rawaudio-rate=48000 --no-cache --untimed --no-demuxer-thread --demuxer-cache-wait=no --no-terminal tcp://localhost:%SNDCPY_PORT%
For ffplay:
ffplay -hide_banner -loglevel fatal -nodisp -f s16le -probesize 32 -ac 2 -ar 48000 -acodec pcm_s16le tcp://localhost:%SNDCPY_PORT%
mpv uses the wrong sample rate. It should be 48 KHz as shown in VLC, but mpv always uses 44.1 KHz.
I added the flag
--demuxer-rawaudio-rate=48000
, so that's fixed.
I was trying to do that as well, as I was sure that mpv wouldn't have delay (evidenced by other times I used mpv vs VLC).
Your parameters worked great, thank you!
One thing for me (on Windows 10, mpv-x86_64-20220703-git-369168b), is that --no-terminal didn't stop an OSC screen appearing for MPV, so I deleted that and used --player-operation-mode=cplayer instead:
mpv --demuxer=rawaudio --demuxer-rawaudio-rate=48000 --no-cache --untimed --no-demuxer-thread --demuxer-cache-wait=no --player-operation-mode=cplayer tcp://localhost:%SNDCPY_PORT%
from sndcpy.
Probably, or even aplay
from ffmpeg.
But it's just a PoC, so I probably won't add options to select another player. You could just edit the last line of sndcpy to call mpv
with the right parameters.
from sndcpy.
hm got it. I put together this script after looking up the manual
@echo off
adb shell am start com.rom1v.sndcpy/.MainActivity
pause
mpv tcp://localhost:28200 --demuxer=rawaudio --no-cache --demuxer-cache-wait=no
but still there is some latency in the audio. is this unavoidable?
from sndcpy.
Over USB or Wifi?
Do you get the same latency with VLC?
from sndcpy.
Over USB.
Latency is there in VLC but not as much as experienced on MPV
from sndcpy.
With VLC, do you see such lines in the console: https://github.com/rom1v/sndcpy/blob/master/README.md#audio-delay ?
If not, over USB, you could try to change --network-cache=50
(milliseconds) to a smaller value.
from sndcpy.
If not, over USB, you could try to change
--network-cache=50
(milliseconds) to a smaller value.
setting it to 0 has helped with reducing the latency. though I'm not sure how to set a similar setting in mpv. will have to look around.
on a related note, how do I close vlc when it is playing in the background?
from sndcpy.
Okay, one more thing. When I play youtube, the audio forwards. But not when playing from an audio only source like spotify. is this intentional? 🤔
from sndcpy.
setting it to 0 has helped with reducing the latency. though I'm not sure how to set a similar setting in mpv. will have to look around.
OK, I think I will change it to 0 by default then.
on a related note, how do I close vlc when it is playing in the background?
Because it's Windows and it's "console" vs "non-console" mode is stupid.
Once you clicked on START NOW, press Enter in the console to start playing on the computer. Press
Ctrl
+c
in the terminal to stop (except on Windows, just disconnect the device or stop capture from the device notifications).
https://github.com/rom1v/sndcpy/blob/master/README.md
But not when playing from an audio only source like spotify. is this intentional?
https://github.com/rom1v/sndcpy/blob/master/README.md#apps-restrictions
from sndcpy.
Damn sorry should have read the docs fully 😅
from sndcpy.
Im trying to edit the file to use mpv instead of vlc but it's not working. Could i get step-by-step instructions to help out?
from sndcpy.
Im trying to edit the file to use mpv instead of vlc but it's not working. Could i get step-by-step instructions to help out?
download and extract mpv and put inside mpv folder
Copy paste this code to .bat file and run:
@echo off
if not defined ADB set ADB=adb
if not defined mpv set mpv="mpv\mpv"
if not defined SNDCPY_APK set SNDCPY_APK=sndcpy.apk
if not defined SNDCPY_PORT set SNDCPY_PORT=28200
if not "%1"=="" (
set serial=-s %1
echo Waiting for device %1...
) else (
echo Waiting for device...
)
%ADB% %serial% wait-for-device || goto :error
%ADB% %serial% install -t -r -g %SNDCPY_APK% || (
echo Uninstalling existing version first...
%ADB% %serial% uninstall com.rom1v.sndcpy || goto :error
%ADB% %serial% install -t -g %SNDCPY_APK% || goto :error
)
%ADB% %serial% forward tcp:%SNDCPY_PORT% localabstract:sndcpy || goto :error
%ADB% %serial% shell am start com.rom1v.sndcpy/.MainActivity || goto :error
echo Press Enter once audio capture is authorized on the device to start playing...
pause >nul
echo Playing audio...
%mpv% tcp://localhost:%SNDCPY_PORT% --demuxer=rawaudio --no-cache --demuxer-cache-wait=no
goto :EOF
:error
echo Failed with error #%errorlevel%.
pause
exit /b %errorlevel%
from sndcpy.
mpv uses the wrong sample rate. It should be 48 KHz as shown in VLC, but mpv always uses 44.1 KHz.
from sndcpy.
To replace VLC with mpv or ffplay, I tried using the following line replacements (for the line bellow "echo Playing audio...
").
They seem to work well. In fact, I get very little delay with ffplay and both processes terminate on Windows after closing the script.
For mpv:
mpv --demuxer=rawaudio --demuxer-rawaudio-rate=48000 --no-cache --untimed --no-demuxer-thread --demuxer-cache-wait=no --no-terminal tcp://localhost:%SNDCPY_PORT%
For ffplay:
ffplay -hide_banner -loglevel fatal -nodisp -f s16le -probesize 32 -ac 2 -ar 48000 -acodec pcm_s16le tcp://localhost:%SNDCPY_PORT%
mpv uses the wrong sample rate. It should be 48 KHz as shown in VLC, but mpv always uses 44.1 KHz.
I added the flag --demuxer-rawaudio-rate=48000
, so that's fixed.
from sndcpy.
Related Issues (20)
- apk and vlc has running ,but no sound HOT 1
- Change application id if not allowed to be installed on some devices for security issue. HOT 1
- Problem Parsing the Package
- Looks like sndcpy doesn't work with apps that have In-call volume function inside it. HOT 7
- is it possible to to passed microphone from the Host / Mac to Android ?
- 'C:\Program' is not recognized as an internal or external command
- Newbie Problems
- Phone tell
- audio forwarding is not working HOT 1
- miccpy? HOT 1
- How do i make a silent start for sndcpy?, (Not showing the console) HOT 1
- 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 HOT 2
- Waiting for device... HOT 2
- SNDCPY, adb: failed to stat sndcpy.apk: No such file or directory HOT 2
- can i ask something HOT 1
- Audio not working for android 10 HOT 4
- sndcpy does not transfer audio played by poweramp
- Got this issue with sndcpy. Also the app doesn't show up after being installed.
- Issue with Sndcpy, HOT 3
- Audio delay using sndcpy HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sndcpy.