I am recording a Let's Play using ffmpeg on Arch Linux. I would like to have it record both the game's audio, and my mic. I am using PulseAudio for sound. I can get it to record the mic, or the game's audio, but not both. I need the output to be in a format suitable for YouTube (Video: h264, Audio: AAC).

How can I record both sources at once? I'm looking for a solution that either combines them into one audio track in the output file, or else gives me two audio output files and another program to combine them.

My current hack is to use gst-launch to send all mic input to speaker output, and because that is really distracting, turn the volume down to nothing on my headphones.


First option

Since you can already record the game audio and mic, I would try to just output them to two files:

parec --format=s16le --rate=44100 -d ... | ffmpeg -ac 2 -f s16le -ar 44100  -i - mic.mp3
parec --format=s16le --rate=44100 -d ... | ffmpeg -ac 2 -f s16le -ar 44100  -i - game.mp3

and then use Audacity to sync them and compine them into a single audio file.

Second Option

From here I would try:

Firstly load a null sink:

pactl load-module module-null-sink sink_name='foo'

Then load two module loops backs:

pactl load-module module-loopback

pactl load-module module-loopback

Using pavucontrol, connect the output of the two loopbacks to the null sink. Connect the input of the two loopbacks to: alsa_output.pci-0000_00_14.2.analog-stereo.monitor and alsa_input.pci-0000_00_14.2.analog-stereo

This means that you will effectively be recording both your mic and the output of your sound card and playing back both streams on the null sink. As it is a null sink you wont be able to hear it, but you should be able to see the VU meter in the playback tab of pavucontrol.

Then in order to record the combined result, you will simply select foo.monitor.

pacat -r -d foo.monitor

| improve this answer | |
  • I'm sorry - I shouldn't have let the bounty run out - I forgot I'd set it. – Macha Feb 28 '11 at 19:40

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.