6

I'm having some problems recording the audio from my speakers using avconv.

This is the command I type into the terminal:

avconv -f alsa \
       -i pulse -f x11grab -r 30 -s 1920*1080 \
       -i :0.0 \
       -vcodec libx264 -preset ultrafast \
       -ab 320k -threads 8 \
       screen.mkv

THE PROBLEM: avconv is recording the speaker audio and my microphone audio, however the speaker audio is extremely low. I've tried playing around with all of my audio/volume levels and I can't seem to get avconv to pickup the speaker audio better.

Is there an option for the avconv command that is for speaker audio?

Please do not reply with "use gtk-recordMyDesktop" or "kazam", i find avconv much more convenient.

Any help is appreciated, thanks!

5 Answers 5

8

The info is in the man pages for avconv. In my version (probably the same as yours) I found it in the chapter on "Input Devices", in the section "pulse", on line 1854.

Type in:

$ pactl list sources | less

You'll see info on "Source #0", "Source #1" etc. depending how how many sound cards and whatnot you have.

Get the string under "Name:", it will be something like:

alsa_output.pci-[some number].analog-stereo.monitor

where "some number" is dependent on your hardware.

Instead of demuxing using alsa directly (avconv ... -f alsa ...) as you've tried to do above, use pulse instead:

avconv ... -f pulse -i alsa_output.pci-....analog-stereo.monitor ...

This will record the audio being monitored and passed to the speakers or headphones or whereever. If you wish to use pulse to demux and record the microphone, use the other "Name:" (or one of the other names) which doesn't include the word "monitor".

I hope it helps.

1
  • Works in Ubuntu 16.04 and works for ffmpeg too. Oct 3, 2016 at 4:05
2

Install pavucontrol package. Open the PulseAudio Volume Control application from the dash.

On the Input Devices tab, go down and choose All Input Devices. Then, press the button with a check mark on it next to the device named "Monitor of... (your device name)". The pulse Input Device is now whatever goes through the speakers.

enter image description here

The settings you're currently using on avconv should be OK for this to work properly.

2
  • Nice simple solution. Thank you. However, my desktop capture command works with -i default
    – jbrock
    Mar 3, 2016 at 14:56
  • Awesome. That's the only thing that worked for me!
    – akhmed
    May 10, 2016 at 22:57
1

The speaker volume is soft because it's recording it through your mic. Did you ever find a way to record both together? I'm having the same issue. I wear headphones to play and the sound would be a lot better that way as well... not familiar enough with pulse to know what to change :-/

0
  1. In terminal type:

     pactl list sources | grep analog-stereo.monitor
    

    Shows output:

    Name: alsa_output.pci-0000_00_1b.0.analog-stereo.monitor
    
  2. ffmpeg -f pulse -i alsa_output.pci-0000_00_1b.0.analog-stereo.monitor alsa-output_analog-stereo_monitor.wav

1
  • it says: Unknown input format: 'pulse'
    – installero
    Sep 23, 2014 at 8:01
0

I've done the pactl command to find the Name. However, when I run avconv I get: john@JudithLaptop:~$ avconv -f pulse -i alsa_output.pci-0000_00_1b.0.analog-stereo.monitor -f x11grab -s $(xwininfo -root | grep 'geometry' | awk '{print $2;}') -r 25 -i :0.0 -vcodec mpeg2video -ar 44100 -s wxga -aspect 16:9 -y /home/john/Temporary/p.mpg avconv version 0.8.9-4:0.8.9-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers built on Nov 9 2013 19:12:07 with gcc 4.6.3 Unknown input format: 'pulse'

PS I don't know if it's a red herring, but I saw somewhere that ffmpeg needed libpulse-simple package in order to use pulse parameter. I don't see libpulse-simple package in my Ubuntu Precise 32 bit repos.

3
  • This is not an answer
    – John Rose
    Nov 16, 2013 at 14:18
  • I've just installed libpulse-dev which includes the libpulse-simple library: so my PS was a red herring! I've also tried ffmpeg with the same result.
    – John Rose
    Nov 16, 2013 at 14:56
  • Not being able to use "-f pulse" is a bug in avconv: launchpad bug 1086500
    – John Rose
    Nov 16, 2013 at 15:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .