UbuntuThis forum is for the discussion of Ubuntu Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Do you want to capture the sound which is actually playing on the speakers without a microphone?
If so, you can do it easily if your card supports capturing the PCM channel (you can see it with alsamixer) with an ffmpeg line like this:
Code:
ffmpeg -f alsa -i hw:0,0 -acodec XXX outfile.EXT
where XXX is your favorite audio encoder and EXT is your favorite audio container format You might also look at the other audio encoding options of ffmpeg, like ab (audio bitrate), ar (audio rate), ac (audio channels number) and so on.
Of course, you'll need to check your capture devices index (hw:0,0 just being an example) using arecord -l.
If your audio device supports PCM capturing, you could record a PCM (wav) file also with arecord itself.
If your card (like mine) doesn't support direct PCM capture, then you'll need to physically "short-circuit" a pair of connectors on your sound-card in order to be able to record.
If your system sports pulseaudio it might also be possible to exploit it regardless of the possibility to capture the PCM channel of your soundcard:
[alsa @ 0x8ef1a60]cannot set channel count to 1 (Invalid argument)
hw:0,0: I/O error occurred
Usually that means that input file is truncated and/or corrupted.
As I said before, you should have looked at the other audio encoding options of ffmpeg.
This error means that ffmpeg, by default, is trying to capture the audio from hw:0,0 as mono (1 channel) stream and it fails to do so because it's not a mono stream. Try specifying the -ac 2 option for stereo capture:
As I said before, you should have looked at the other audio encoding options of ffmpeg.
This error means that ffmpeg, by default, is trying to capture the audio from hw:0,0 as mono (1 channel) stream and it fails to do so because it's not a mono stream. Try specifying the -ac 2 option for stereo capture:
If you're using Ubuntu and you have pulseaudio installed I would suggest using the -i pulse option instead of an alsa hardware pointer such ah hw:0,0.
Well I actually thought I had it there! It started capturing and when I quit by pressing "q" It saved a file to the current folder. It's size was about 400kb. I tried to play it but there was no sound. I turned the volume all the way up. No noise or static, just nothing. I feel as if I getting there though.
Also, check in alsamixer that nothing is muted or disabled.
Note, on my laptop, I seem to only be able to record sound from the input device. (microphone or mic input)
I have to use a patch cord between the ear and mic sockets to record sound from the speakers. (which disables the speakers unfortunately. The solution to that might be an external mixer/amp that includes a line out.)
414N: Here is the command line where I just tried -i pulse Still no sound although I do get a file.
Last try: run alsamixer, press F5 and make sure that your PCM channel has an unmuted CAPTURE line. If you don't see anything above "PCM", then you're out of luck. If you see a bunch of dashes "----", then press "space" when selecting PCM and you should see a red CAPTURE flag appear. You should now be able to capture from PCM when using the alsa format in ffmpeg.
If your card doesn't support capturing from PCM, then you'll need to go the hardware way, with a simple jack-jack connection between your mic input and speaker output.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.