Sunday, April 28, 2024
 Popular · Latest · Hot · Upcoming
73
rated 0 times [  73] [ 0]  / answers: 1 / hits: 55523  / 3 Years ago, mon, september 20, 2021, 10:59:41

I would like to record an output of a program with PulseAudio using command line/bash script. It is important not to record all output, but only the output from one specific program.



I thought I would have to create a new null-sink and than move the program's output to this new sink. Than tell parec to use this specific monitor to record.



The first step would be something like this:



pactl load-module module-null-sink sink_name=steam


But how to move the program's output now to this sink?

And how to record the specific sink with a bash script?


More From » scripts

 Answers
3

Try something like this:



In a terminal enter



pacmd


(this is the CLI of the PulseAudio-Server)
then use



list-sink-inputs


(where you get the indices of the running inputs)
Now find the index of your input. Now referred to as $INDEX



the scriptable part is:



pactl load-module module-null-sink sink_name=steam
pactl move-sink-input $INDEX steam
parec -d steam.monitor | oggenc -b 192 -o steam.ogg --raw -


Explanations:




  • The first command will add a null-sink as you already knew.

  • The second command moves the sink-input from your standard-audio-sink to steam

  • The third command records the monitor of the device steam (-d) and puts the output (raw-wave-stream) into oggenc, which encodes this wave-stream to an oga-file. (for mp3 use lame)


[#43538] Tuesday, September 21, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
bjecterless

Total Points: 59
Total Questions: 96
Total Answers: 105

Location: Argentina
Member since Thu, Mar 18, 2021
3 Years ago
bjecterless questions
;