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
    May 1 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
    May 2 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
    May 3 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
    May 4 at 20:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.