Audio streaming problems

Joel Lord jpl at ilk.org
Mon Dec 19 02:38:38 UTC 2022


I'm trying to take an audio feed from a microphone connected via a USB 
interface and (ideally) stream it directly out via HTTP.  I want 
multiple end users to be able to get to the stream and listen to it, 
real time, from their phones.  I haven't had any luck finding components 
that add up to that, but I did find how to produce a mpeg4ts stream, so 
I added a static image and have that streaming successfully, I added in 
a clock to have something changing to prove that it was working.  But 
the audio never comes through.

If I take the mpegtsmux and hlssink off the end of my pipeline and 
replace it with a filesink I can prove that my audio is working fine, 
but when I feed it to mpegtsmux and hlssink it seems to get ignored.  If 
I have no image it never creates a second segment or the playlist for 
the stream, so I can't see anything at all.  If I include the image the 
stream works but it seems to have no audio.  I've tried 3 or 4 different 
audio formats, it doesn't complain that I have a format mismatch and it 
seems to be working, but nothing comes through.

Using gstreamer1.0 version 1.18.4 on a Raspberry Pi 4.

gst-launch-1.0 -v \
   mpegtsmux name=mux ! hlssink 
playlist-root=http://stream.ek:80/stream_files 
location=/var/www/stream/stream_files/segment%05d.ts target-duration=3 
playlist-location=/var/www/stream/playlist.m3u8 \
   filesrc location=/home/pi/EKPB.png ! decodebin ! \
   videoconvert ! video/x-raw,format=I420 ! imagefreeze ! \
   clockoverlay halignment=right ! x264enc ! mux. \
   alsasrc ! audioconvert ! audio/x-raw,channels=1 ! \
   level ! avenc_mp2fixed ! queue max-size-buffers=0 max-size-bytes=0 
max-size-time=1000000000 !  mux.

If I take the queue out of the audio path it tosses a few warnings about 
dropping samples (a lot of samples) and gives me no faith that it will 
work.  Changing the buffer settings on the queue made no difference.

So for anyone who has made it this far, I'm quite open to better 
solutions than I've found OR fixing the one that I have that isn't 
working.  I don't actually want anything but the audio feed, and I want 
it as close to 0 latency as I can get.

Thanks for your help!

-- 
Joel Lord


More information about the gstreamer-devel mailing list