Reduce playing audio latency
Hi, I'm currently trying to convert an incoming audio stream (mulaw) to raw opus bitstream. Using ffmpeg and inputType as raw, I'm able to achieve it, but that introduces 3s of latency. Unfortunately, the incoming stream is real-time data, so this latency has to be reduced.
I did manipulate around with ffmpeg, and got it to play a quiet popping noise under 1s (ofc that only happens when the stream audio is very loud).
Here's my current ffmpeg setup (which doesn't work). Is there anything else I need to transform in stream for it to work?
Node Version: 20.12.2
DJS Version: 14.15.2
4 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!I just found out that the stream is not configured with objectMode, which caused the issue.
Even with that, the latency is still introduced, unlike the
listener
stream, which has latency less than 1s.It's likely a ffmpeg-related issue or your PC's performance issue
There's nothing that I can help you with that problem
The best would be using FFmpeg here