I have a USB Mic; I want to make an RTSP stream with it

I have a USB MIcrophone (verified as working with arecord; it came up PnP with no problems, and I’ve recorded a .wav that I was able to retrieve and listen to) and I’d like to create an RTSP stream to act as an input for BirdNetPi (running on a ProxMox server.) And the stream needs to start again on reboot.

Pretty much all the RTSP tutorials out there are for video use… I found one for VLC, but then saw a note that vlc RTSP had been deprecated for Debian-based linux builds as a policy decision.

Can anyone point me in the right direction to figure this out?

If it makes any difference, the mic is a KTMicro BY-LM40 (direct USB-attach; no separate sound card), and I’ve attached it to a Pi Zero W.

EDIT: Here’s my solution. I tried flatpak vlc and got a bunch of errors that I didn’t know how to fix (because I know nothing about flatpak.) Also tried the snap version; same thing. Tried gstreamer, and again, I have no idea what I’m doing, and got errors I didn’t know how to fix.

In the end, I settled on FFMPEG to generate the data for the RTSP stream, feeding the perl script here: GitHub - revmischa/rtsp-server: Lightweight RTSP/RTP streaming media server (this was linked to in the FFMPEG docs.)

The script to get the mic going is blessedly-simple: (and is now called as part of custom-startup)

#! /bin/sh
/root/rtsp-server/rtsp-server.pl
#wait 30 sec to let rtsp finish startup
sleep 30
ffmpeg -f alsa -acodec pcm_s24le -ac 1 -ar 48000 -i hw:1,0 -listen 1 -content_type ‘audio/mpeg’ -f rtsp rtsp://localhost:5545/birdmic -rtsp_transport tcp

Getting the ffmpeg commandline going was a little annoying; had to use arecored --dump-hw-params to get the bitrate (the value after -ar) and the codec.

I was actually a little doubtful I was going to get the server to work, as there were all sorts of “trying x, but with lesser chances of success” during the CPAN install, but in the end, it came right up.

My pi is currently a complete mess, given all the software I installed and uninstalled as part of getting all this working, but it’s holding together for now. I have no idea what’s going to happen the next time I try and do an upgrade.

Yes, the vlc package on debian does not come with live555 library anymore (because it includes a non-free codec, see: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=981439 (I gathered some info here https://forum.videolan.org/viewtopic.php?t=157795)

In this thread they also mention to use the flatpak version. If this is suitable for you, you can try this.
In the VLC docs is also an example for how to stream with VLC from CLI:
https://wiki.videolan.org/Documentation:Streaming_HowTo/Command_Line_Examples/#RTSP_live_streaming

With flatpak it’s then something like (adjust to your needs):

flatpak run org.videolan.VLC -vvv alsa://plughw:1,0 --sout '#rtp{dst=192.168.0.10,port=1234,sdp=rtsp://192.168.0.10:8080/stream.sdp}' 

And the client can connect to stream via rtsp://192.168.0.10:8080/stream.sdp