ExplodingPenguin.TV Linux Love, Microsoft Frustrations, and Other Geekery

13Aug/11Off

Record Audio Output or Input From The Terminal

An easy way to record any audio output or mic input is to gstreamer-tools.

The command to record all audio output to a file:

gst-launch -e pulsesrc device="alsa_output.pci-0000_00_1b.0.analog-stereo.monitor" ! audioconvert ! lamemp3enc target=1 bitrate=128 cbr=true ! filesink location=output.mp3

That will save the audio to the a file specified after "location=."

The "device=" may vary, to list the audio devices on your system  enter:

pactl list | grep -A2 'Source #' | grep 'Name: ' | cut -d" " -f2

Example output:

alsa_output.pci-0000_02_00.1.hdmi-stereo.monitor
alsa_input.usb-AKM_AK5370-00-default.analog-mono
alsa_output.pci-0000_00_1b.0.analog-stereo.monitor
alsa_input.pci-0000_00_1b.0.analog-stereo

 

Optional

To create an easier to remember command add an alias to the .bashrc file.

Open .bashrc (located in your home directory) with your text editor and add the record command in this format:

#Audio Out record
alias capaudio='gst-launch -e pulsesrc device="alsa_output.pci-0000_00_1b.0.analog-stereo.monitor" ! audioconvert ! lamemp3enc target=1 bitrate=128 cbr=true ! filesink location='

This creates an alias called capaudio. After this you only need to type capaudio followed by the filename to record the audio out.

Example:

capaudio output.mp3

 

Share

Posted by John

Comments (0) Trackbacks (0)

Sorry, the comment form is closed at this time.

Trackbacks are disabled.