Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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!

share|improve this question

5 Answers 5

up vote 3 down vote accepted

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.

share|improve this answer

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 :-/

share|improve this answer

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.

share|improve this answer
  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

share|improve this answer

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.

share|improve this answer
    
This is not an answer –  John Rose Nov 16 '13 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 '13 at 14:56
    
Not being able to use "-f pulse" is a bug in avconv: launchpad bug 1086500 –  John Rose Nov 16 '13 at 15:05

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.