How to record browser audio on Linux

There’s a million reasons why you would want to record audio coming from your browser, some — innocuous, some — nefarious. You can definitely record blank video with just the sound in OBS, but that’s not necessarily what you want.

So to record just the browser audio on Linux, you will need two applications and a fairly recent Linux distribution that has the new PipeWire audio system, preferably installed by default. I’m currently using Fedora 40, but it should be the same with the latest Ubuntu long-time support release.

The first application is Sound Recorder (soon to be renamed to Vocalis).

It’s literally one-click software to capture anything that goes into your mic that you selected in system settings. And the latter is the problem we need to rectify with the second application called Helvum.

Helvum exposes an important aspect of PipeWire — you can route audio and video streams between hardware and software however you like. PipeWire makes some connections automatically. For example you can see here that GNOME’s settings service is always listening to whatever audio capture device you selected.

You’ll notice that while Sound Recorder is running, it isn’t listed here in Helvum. That’s because the program only opens input ports when it starts to actually record. So let’s do just that. Click the Record button in the headerbar.

Now when you go back to Helvum, you’ll see Sound Recorder with two ports, one for the left channel and one for the right one.

The amount of ports depends on whether you are recording to mono or stereo. You need to make that choice in the hamburger menu before you start recording.

So let’s go to the browser and start playing something. Now you can see Google Chrome in Helvum with multiple ports. Because my USB audio interface of choice has 4 outputs, PipeWire automatically creates four matching output ports for Chrome and connects them. But we only need two of them. FL, which is front left, and FR, which is front right.

What we do now is click on the output_FL port and drag the wire to Sound Recorder’s input_FL port, then same same for the right channel’s port.

Now when you go back to Sound Recorder, you can see the waveform moving. This means you are recording whatever is playing in the browser.

By the way, if you have a mic attached to the external audio interface, depending on what you are recording, you might want pressing the phantom power button. This will temporarily cut off the signal from the mic.

Alternatively, you can lower the input gain either in settings or on the interface itself. Or, well, remove some of the wires in Helvum. But toggling phantom power is just so much easier.

If you aren’t a GNOME user or dislike GTK, Helvum has an alternative called qpwgraph.

Personally, I find it somewhat easier to use, because to disconnect something, you just click on the wire and then press Delete. You can even press and hold Ctrl to select multiple wires or do a rubberband selection and then press Delete. Helvum makes things like that unnecessarily difficult, but I can see how it could be preferable to some users.

You can also replace Sound Recorder with something like Audacity, especially if you plan to do some editing afterwards.

You now know how to record your browser audio on Linux. Please use it responsibly, and see you in the next one.


This is a companion discussion topic for the original entry at https://librearts.org/2024/09/record-browser-audio/
4 Likes

for qpwgraph: you can even click on a device and press delete to disconnect everything from this device.

1 Like

I am yet to take a look at PipeWire. I’m a JACK user, for a number of reasons mostly now no longer current but I’m used to it. Also a patch-panel model. Also can capture any audio being played.

pipewire gives you jack+pulseaudio in one. that means you can even use qjackctl and similar tools to manage the links in pipewire. which is pretty neato.

give it a try. you will probably never look back :slight_smile:

2 Likes

I’m using Cadence/Catia. At one time I had the whole kx studio stuff.

The only plug-in thing that I do now is EQ for my sadly deficient ears. I’m sure PipeWire is the Future. But what I have works.

On the other hand never say never! Else I wouldn’t even be talking about it. One day…

to save my ears during meetings i run carla with a stack of rnnoise+dpl+compressor to get a more consistent audio level. then i just hook up my browser to the carla instance via qpwgraph.

so what ever you do with cadence/catia will probably just work.

2 Likes

+1 for pipewire with its jack compatibility layer. I use carla daily to practice guitar or goof around with my synth and it handles every jack application without a problem, with a buffer size of 64. IMO it puts linux audio light years ahead of windows, especially in a professional manner.

If only hardware and software developers gave us a little more attention. At least most of the good DAW’s work fine.

1 Like

I tried Vocalis(flatpak) for a bit, and whilst it’s pretty good at what it does, for me its limited by the amount of settings available for the user.

There is no way to select your input device and it will use the system default. Sure you can then make some connections in your preferred graph tool and connect new outputs into it, but this is troublesome and will always lead to there being a delay in when you can really start recording your audio since the input sinks are only exposed when the user is recording.

Besides that it’s a great tool and I’m sure it will be plenty useful for the average user who only has one input device, their pc’s microphone. Offering opus is also a great choice, it’s a great codec and it needs to become more popular. On the other hand, offering vorbis is a bit strange, as it has been mostly replaced by opus and is inferior in most ways. Imo it should be removed so we steer users to opus.

I have a problem with some “JACK-compatible” applications and media players (iirc, Audacity is one of them) that drop their connection every time they are stopped. It would be nice if that didn’t happen.

I’ve never used Pulse Audio. Had to use JACK when I first started with Linux because it was the only way I could use a firewire interface. And getting it to work was hell until I came across Kx Studio.

1 Like

I observe the same behavior using jack only as well. Like jack, pipewire allows you to have your sinks always on, and doing otherwise (like this gnome sound recorder) is a conscious developer decision.

I agree on audacity though… I had troubles with it with pulse-audio and I also do nowadays with pipewire. For me I never understood its fame, when a DAW like Ardour, which is FOSS, is equally “light” (for whatever light task audacity was doing), works just as well, has a usable interface, and also has the power available should you require it.

I do miss a light and simple to use audio recorder, that is not as restrictive as your usual gnome app… maybe I’ll give it a go at making my own. I already have a skeleton programmed that I used to build an audio looper, only need to add save file functionality :slight_smile: .

1 Like

the blog post actually mentions another simple recorder tool. just saying :wink:

1 Like

Which one is it? I’ve read it twice and I don’t see it :smiley: I only see audacity, sound recorder and vocalis, which is just sound recorder renamed…

well soundrecorder i was referring to. I am using it here. but tbh i also have no problem with audacity.

edit:

i just noticed in audacity the “audio setup” button also lists monitor devices under “recording devices” which is pretty neato for recording apps.

1 Like

I don’t really do recording or editing of sound any longer; ears aren’t up to it. But I think that, last time I used Audacity, I told it to use alsa and bridged that to JACK. Maybe.