I'm building an app that streams audio to an icecast server.

This is my current command that actually sends the audio.

nohup ffmpeg -f alsa -ac $CHANNELS -i hw:0 -codec libmp3lame -ab $BITRATE -ar 44100 -nostats -content_type 'audio/mpeg' -f mp3 icecast://$USERNAME:$PASSWORD@$ICECASTSERVER:$ICECASTSERVERPORT/$MOUNTPOINT &> /tmp/stl-app/icecast-source.log &

When I use a source thats 2 channels (ie left and right stereo) the encoder can't keep up. The ffmpeg usage is 100% and the stream stutters badly. I can swap the sound card out for a usb card that is only one channel input, mic, and it works fine.

I realize that it's probably because the pi I'm testing with can't do a stereo live encode to mp3 then streamed. So my questions is, is there something I can do to make this work on a raspberry pi3b+? OR am I just going to be limited to one channel on that device and the for a stereo encode, I'll need to upgrade to something else.

I can record the audio with alsa and then pipe that to ffmpeg but it introduces 4-5 seconds of latency. I'd like to avoid that.

I've tried increasing the bitrate, lowering the sample rate, changing codecs and etc. Kind of at a loss.

Trying to keep the cost down as far as I can but you never know, I may be missing something.

I have a RPi4 I can test with but obv its more expensive. Is there a SBC out there that has the processor power I need?

1 Answer 1


Turns out that I was using an audio capture device that connected through the GPIO and apparently that's not fast enough to handle the audio for two streams. When I switched to a high end usb capture ADC, it worked great.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.