I have a problem with ffmpeg giving no audio when recording using alsa.

Does anyone know how to get a Raspberry Pi Zero W to record and stream audio with ffmpeg using alsa?

I have a project where I am using I2S digital microphones hooked up to an Raspberry Pi Zero W. The microphones are from Adafruit, and I set them up using this guide. I have two microphones set up in stereo mode. Now, when I use

arecord -D plughw:1 -c2 -r 48000 -f S32_LE -t wav -V stereo -v file_stereo.wav

everything works great. I can copy the file over to my main machine and it plays fine. Now, when I try something like this:

ffmpeg -f alsa -re -i hw:1,0 -acodec mp2 -ac 2 -f rtp rtp://[host]:[port]

and try playback via either VLC or ffplay, I only get silence and/or clicking sounds. ffplay indicates that a connection is being made, so it isn't a network issue. I have also verified that the input device is in fact the correct one. I have attempted just replicating arecord through ffmpeg with

ffmpeg -f alsa -i plughw:1,0 -t 10 out.wav

However, this does the same as piping it through RTP. I have tried different codecs: mp2, mp3, aac. I even tried different input and output sampling rates, channels, etc. Nothing works. I have used the ffmpeg available in the Stretch repositories and compiled it myself where I knew it had the alsa library enabled.

Any help would be appreciated!

  • have you tried -ac 2 -ar 48000 input options instead of -re - in the documentation for -re it says Should not be used with actual grab devices or live input streams – Jaromanda X Apr 29 '18 at 23:08

Your Answer

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

Browse other questions tagged or ask your own question.