I am trying to stream audio from my Pi Zero and my I2s MEMS mic. I would like to stream using FFMPEG and ALSA (which I have already compiled) but I'm running into stuttering issues.
FFMPEG + ALSA
~/special/ffmpeg/ffmpeg -report -f alsa -ar 48000 -ac 2 -acodec pcm_s32le -i mic_sv -f lavfi -i testsrc -c:v h264_omx -c:a aac -ab 32k -bufsize 32k -f flv rtmp://209.85.230.23/live2/KEY
This results in constant stuttering and choppiness.
Arecord piped directly to FFMPEG
arecord -Dmic_sv -c2 -r48000 -fS32_LE | ~/special/ffmpeg/ffmpeg -report -acodec pcm_s32le -i - -f lavfi -i testsrc -c:v h264_omx -acodec aac -ab 32k -bufsize 32k -f flv rtmp://209.85.230.23/live2/KEY
This results in a coherent audio stream, but with skipping every 5 seconds or so.
Arecord recorded to a wav file, piped into FFMPEG
arecord -Dmic_sv -c2 -r48000 -fS32_LE -twav temp.v & ~/special/ffmpeg/ffmpeg -report -re -i temp.v -f lavfi -i testsrc -c:v h264_omx -ac 2 -acodec aac -ab 32k -bufsize 32k -async 2 -f flv rtmp://209.85.230.23/live2/KEY
This results in a perfect audio stream.
I don't know why #3 works but #2 and #1 cause problems. Any suggestions?
/run
, but you can create your own). This will be a little more robust.-async 2
. What happens if you add that option to #1 and #2? Do #1 and #2 still stutter?