Saving streaming audio on Linux

MONITOR=$(pactl list | egrep -A2 ‘^(\*\*\* )?Source #’ | grep ‘Name: .*\.monitor$’ | awk ‘{print $NF}’ | tail -n1)

goes to alsa_output.pci-0000_00_1b.0.analog-stereo.monitor on my system

LAMEOPTIONS=’ -s 44.1 –preset cbr 192′
FILENAME=foo.mp3

Record currently playing audio:
parec -d $MONITOR | lame $LAMEOPTIONS -r $FILENAME

Split into separate 1 hr files with a 3 sec overlap:
ffmpeg -ss 00:00:00 -t 01:00:03 -i foo.mp3 $1.01.mp3 -acodec copy
ffmpeg -ss 01:00:00 -t 01:00:03 -i foo.mp3 $1.02.mp3 -acodec copy

Commands from here

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>