I know there it is possible to record sound from the speaker of the computer using command such as:

ffmpeg -f avfoundation -i ":0" -t 10 audiocapture.aiff

But as the recorded sound is far from perfect (due to the imperfection of the microphone), is there a way to record the audio directly from the soundcard (e.g. using ffmpeg)?


1 Answer 1


open pavucontrol , go to input devices and mute the mic

open termial ,

enable loopback

pactl load-module module-loopback

start a test recording

arecord -f cd > out.wav

go back to pavucontrol recording tab and switch ALSA capture to monitor mode

stop recording Ctrl+c

now you can record from the sound card as you liked

arecord -f cd > out.wav

and check out arecord manuall for more options

  • Many thanks for your comment @Yunus. I am running a MacOS. Do you know by any means the corresponding command for a mac?
    – ecjb
    Commented May 1, 2022 at 20:42
  • i thought for linux , i don't use mac but i googled a bit they say you enable loopback from system preferences >> sound which cause sound to disappeare from speakers(normal), and then use ffmpeg to list devices you may see the loopback as address ":x" to use for record
    – Yunus
    Commented May 2, 2022 at 17:32
  • Many thanks for your update @yunus, I did what you say (switch sound of HDMI and tried ":1" and ":x2" but still could not make it work. I upvoted your answer though
    – ecjb
    Commented May 3, 2022 at 19:31
  • just tested a working workaround: install "loopback audio" app , and then switch sound output to "loopback" , so your ffmpeg cmd wil work perfectly. rogueamoeba.com/loopback
    – Yunus
    Commented May 4, 2022 at 20:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .