Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

How can I redirect the microphone of one computer to listen to it on another computer via ssh? Which is the right device or which is the right command line?

Some years ago it was easy and fun to redirect sound from a remote microphone to a local computer or vice versa – it was an easy telephone. There are some instructions for it, but none of them seem to work on newer computers/linux distros. I don’t even have a /dev/audio on my computer (Fedora 17).

I think that it may have something to do with pulse audio. Or don’t I need pulse audio for this simple telephone? Which is the right device?

I can see all my sound devices when I start alsamixer and press the F6 key. But I don’t know which are the devices in my /dev tree.

share|improve this question

1 Answer 1

up vote 37 down vote accepted

OK, I've just found it, and it still works! Really funny. You don’t need any fancy applications, instant messengers or the like. With this command you send your audio to the remote host.

arecord -f cd -t raw | oggenc - -r | ssh <user>@<remotehost> mplayer -

Or if you like ffmpeg better

ffmpeg -f alsa -ac 1 -i hw:3 -f ogg - | ssh <user>@<remotehost> mplayer - -idle -demuxer ogg

Source: http://shmerl.blogspot.de/2011/06/some-fun-with-audio-forwarding.html


If you want a real telephone:

The command above was only for one direction. For the other direction you have to start another ssh session. So, to receive what the other user says to you, use

ssh <user>@<remotehost> 'arecord -f cd -t raw | oggenc - -r' | mplayer -

Or if you like ffmpeg better

ssh <user>@<remotehost> ffmpeg -f alsa -ac 1 -i hw:3 -f ogg - | mplayer - -idle -demuxer ogg

where hw:3 is the alsadevice you want to record (find it with arecord -l).

share|improve this answer
1  
Is there some reason you are doing cat - | mplayer - instead of just mplayer -? –  Chris Down Feb 28 at 7:29
    
The reason is: I just copied the command from the cited source. Might be redundant. I have deleted it, seems to still work. Maybe there is an edge case where it was needed and the author knew about it without telling it in his post? –  erik Feb 28 at 19:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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