JoJoBond / 3LAS

Low Latency Live Audio Streaming
GNU General Public License v2.0
90 stars 23 forks source link

Lower bitrate? Smartphone audio input? #28

Open amcco1 opened 1 year ago

amcco1 commented 1 year ago

Hi again,

I am still trying to get this to work for my needs, I have two questions.

Firstly, how do I reduce the bitrate of the stream to accommodate for more users? I have tested it with about 30 clients and my poor little i5 6500 in this machine can't handle it. It chokes and maxes out at 100% usage, will kick clients off the stream when choking.

Next question is, I would like to be able to use a smartphone as the audio input, but so far I haven't found how to do that. I can install audio relay and I can get audio from a smartphone into the server, but it comes in as virtual audio device. I do not see any way to change what audio device 3las uses. I tried this on a virtual machine with no hardware audio devices, the only audio device it had was the virtual input from audio relay, but I could not get 3las to output the audio.

As always, thank you so much for Jojo.

JoJoBond commented 1 year ago

Hi there. Please find the responses to your questions below.

Firstly, how do I reduce the bitrate of the stream to accommodate for more users? I have tested it with about 30 clients and my poor little i5 6500 in this machine can't handle it. It chokes and maxes out at 100% usage, will kick clients off the stream when choking.

You can signal to the server to get lower quality streams with some changes in the code, please reference to this commit by ericek111 to get a basic idea: https://github.com/JoJoBond/3LAS/commit/72fc25f34cc7833d8af5a7013c3b11f875fe71ac

Next question is, I would like to be able to use a smartphone as the audio input, but so far I haven't found how to do that. I can install audio relay and I can get audio from a smartphone into the server, but it comes in as virtual audio device. I do not see any way to change what audio device 3las uses. I tried this on a virtual machine with no hardware audio devices, the only audio device it had was the virtual input from audio relay, but I could not get 3las to output the audio.

If you get the audio as a input in your system it should be no problem to adapt the start script of the server to your situation. Maybe you could try pulse audio instead of alsa:

#!/bin/sh
ffmpeg -fflags +nobuffer+flush_packets -flags low_delay -rtbufsize 64 -probesize 64 -y -f pulse -i default \
-af aresample=resampler=soxr -acodec pcm_s16le -ar 48000 -ac 1 \
-f s16le -fflags +nobuffer+flush_packets -packetsize 384 -flush_packets 1 -bufsize 960 pipe:1 \
| node 3las.server.js -port 8080 -samplerate 48000 -channels 1
JoJoBond commented 1 year ago

Either way, if CPU load is still a problem, you might want to try disabling WebRTC and just using the WebSocket/WebAudio fallback.