Loopback and ffmpeg

I'm trying to use the Loopback device to stream audio from a browser into my asound file.
As a starting point I've installed the snd-aloop module and can see Loopback as an audio device, and installed ffmpeg.
Running aplay -l gives me:
card 0: Device [USB Advanced Audio Device]
card 1: Loopback [Loopback]
To get grips with it all, I've run:
ffmpeg -f alsa -i hw:1,0 -f alsa hw:0,0
selected Loopback in the volume control, and set the browser streaming audio.
Looking at /proc/asound the two cards are shown as running, but no sound comes from the headphones plugged into the USB widget.

In Volume ontrol , Device Profiles there is a long list of options, and clicking on the ones that look promising makes no difference. A screenshot of ffmpeg running is attached (couldn't copy the text)

Selecting the USB device plays sound through the headphones.

This is all on a Raspberry Pi 5.

Anyone care to offer a way of making this work? My aging brain is filling up rapidly!

TIA. Andy
 

Attachments

  • 20250219_17h29m50s_grim.png
    20250219_17h29m50s_grim.png
    108.3 KB · Views: 52
I'm trying to use the Loopback device to stream audio from a browser into my asound file.
As a starting point I've installed the snd-aloop module and can see Loopback as an audio device, and installed ffmpeg.
How does the audio stream get from the browser to the loopback playback side?

As Charlie writes, FF supports only PA/PW output. There you can select your USB device to be output for FF specifically, no ffmpeg or loopback required.
 
phofman, this exercise is just a test. When it is is deployed for real (on the Pi4 which is dedicated to my sound system) then the output will be "sysdefault" which is the name of the pcm in my asound.conf.

Charlie, the pipewire-pulse volume control on the taskbar selects the default hardware device.

On my Pi5 the devices are "Loopback" and "USB Advanced Audio Device". Loopback appears when I run
Code:
sudo modprobe snd-aloop pcm_substreams=1
and the USB device appears when I plug it in.
That's where I select one or the other.

Thanks guys.
 
phofman , as the browser will only output its audio stream to a "hardware" device via pipewire-pulse, then the stream cannot be directed to a pcm - in my case "sysdefault" when I eventually deploy to the sound Rpi4. The snd-aloop kernel module creates a dummy hardware device called Loopback.
 
Because eventually the browser output will be directed to the pcm contained in my asound.conf file. That file then does crossovers and equalisation to the two amplifiers that drive my pair of two way active speakers. Charlie may remember my struggles to get his LADSPA plugins to work!
Just to get this far with the task required a day of reading, and as it is Linux and as it is ALSA, guesswork and experiment 😆
 
Because eventually the browser output will be directed to the pcm contained in my asound.conf file.
OK, so you want some alsa DSP as a sink for PA/PW, IIUC.

Please why do you modify the sysdefault = default PCM device, instead of creating a new one? It's unlikely your DSP chain would involve mixing, and alsa apps will fight for your alsa DSP. If the default/sysdefault devices were left, they would properly go through PW which would do all the standard work and output through your alsa DSP.

As of the loopback device - another option would be running CDSP within PW pipeline, letting PW do all the I/O including rate adjust which PW already does (including non-resampling rate adjust for loopback and USB gadget devices). IMO this is the future of CDSP within PW as it allows to use all features PW offers (current and future). For now CDSP has only pulseaudio backends, but these should do OK in PW too.
 
CDSP? please expand.
At present I have fully working crossovers and equalisation set of LADSPA plugins, there is no way to direct the browser output stream to it, if you have a solution to that problem then I should be grateful if you would share it with the community.
One solution that does work is to run the browser on a separate RPi, this has worked, I am just trying to put the whole thing on one machine. I have not the patience to write out all the steps that it took to arrive at this point, they were many and frustrating.
 
Last edited: