Wednesday, 5 March 2025

Copy the music being played on the laptop with Ubuntu linux.

Step 1: Get the sink playing the audio.

Pulse audio command to list the applications which are currently using the laptop speakers. Returns the number which is used to record audio from.


$pactl list sink-inputs | grep -E 'Input #|application\.name'



Step 2: Use the sink number in following command. This will record audio in the out.rec file.

$pw-record --latency=20ms --volume=1.0 --format=f32 \
          --channel-map stereo --latency=20ms \
          --rate 44100 \
          --target="80" "out.rec"
 
Step 3: Convert audio to mp3 increase volume!


$ffmpeg -y -i out.rec -acodec mp3 -af volume=1.5 -b:a 320k  "OUTPUT_FILE.mp3"

No comments: