[pulseaudio-discuss] How to get mencoder to use pulseaudio in capturing audio?

Tanu Kaskinen tanuk at iki.fi
Fri Nov 9 00:40:35 PST 2012

On Fri, 2012-11-09 at 03:02 +0100, Miroslav Rovis wrote:
> Would there be any help from you guys in the issue that I haven't
> solve and have trouble with for a week or so...

To make sure that I have understood the problem correctly, I'll try to
summarize it here: You have been happily capturing video and audio from
a video capture card for some time now. The audio capture has been done
by connecting the video capture card's audio output to a sound card's
line-in using a physical loopback cable. The audio capturing has been
done so far with direct alsa access without pulseaudio in the middle.
This has been working fine, until recently it just stopped working.

What are the symptoms of the breakage? Do you get silence instead of
real audio, or does mencoder refuse to do anything at all? Do you get
any error messages from mencoder?

> Pls, so I don't have to explain all over, could someone take a gander at:
> http://lists.mplayerhq.hu/pipermail/mencoder-users/2012-November/013229.html
> Just to get you in the right mode (hopefully), I will copy a line or two:
> ...
> My question is:
> how do I either:
> 1) configure mencoder to capture pulseaudio just like ffmpeg does

While it would probably be better to figure out why capturing from alsa
has suddenly stopped working, capturing from pulseaudio should be
possible too.

I'm looking at the mencoder man page at

Currently you seem to configure audio capturing using the "tv" option:


The audio specific parts are:
alsa=1 (use alsa)
adevice=hw.0,2 (use direct hardware access with device 2 of card 0)
audiorate=48000 (audio sample rate)
amode=1 (stereo)

The documentation for the "tv" option doesn't say anything about
pulseaudio, so direct support for pulseaudio in mencoder doesn't seem to
exist. Pulseaudio can be accessed through the alsa interface, however.

Most distributions configure the "default" alsa device to use
pulseaudio. To check whether this is configured on your machine, you can
do this:

arecord -Ddefault > /dev/null

That will make arecord capture from the alsa device named "default" and
direct the output to /dev/null. While the command is running, open
pavucontrol and see if the capture stream is visible in the "Recording"
tab. The stream should be listed as "ALSA plug-in [aplay]: ALSA
Capture". For reference, that string is generated by the alsa plugin
that acts as the bridge between the alsa application and pulseaudio. It
says "aplay" instead of "arecord", because arecord is actually a symlink
to aplay.

If you don't see the arecord stream in pavucontrol, that needs to be
fixed. I'll assume in this mail that it works, however.

If arecord can capture from the "default" device, mencoder should be
able to do it too. So, change the "adevice" option from "hw.0,2" to
"default". With luck, this is all you have to do.

There may be multiple capture sources in pulseaudio. If the device that
the mencoder capture stream is routed to is wrong, you can change it
with pavucontrol in the "Recording" tab. Also the right port (line-in)
needs to be selected in the "Input Devices" tab (I see you're already
familiar with this, you're changing the port in the youtube video).

> 2) get mencoder to capture audio from my Line-in in come other way

I guess this is off-topic for this mailing list.


More information about the pulseaudio-discuss mailing list