Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to create some screencast, I am using avconv (recent ffmpeg counterpart) for doing so.

This is the reference for command I used. I also referred the avconv manual pages. Due to some reason I am unable to record audio from microphone into the screencast.

What is the -f switch for audio from microphone? I tried -f jack but it gives an error message.

I am not sure whether the microphone audio drivers are installed on my PC. Command I used is as follows:

avconv -f x11grab -f jack -s hd1080 -r 30 -i 0:0

Error message I get is:

Cannot connect to server socket err = No such file or directory
Cannot connect to server socket
exec of JACK server (command = "/usr/bin/jackd") failed: No such file or directory
jack server is not running or cannot be started
[jack @ 0x9b6dc80] Unable to register as a JACK client
0:0: Input/output error
share|improve this question
up vote 1 down vote accepted

Make sure microphone is properly plugged in. You may also test your recording settings using "sound recorder" on your Ubuntu.

Now, execute the following command on terminal by replacing 1366x786 by your screen resolution.

avconv -f alsa -i pulse -f x11grab -r 30 -s 1366x768 -i :0.0 -vcodec libx264 -preset ultrafast -threads 4 -y myscreencast.mp4

If you use avconv regularly of making screencast you would like to avoid typing above command each time (in that case, do the following) :

Save the script given below in ~/Videos/ with filename screencast

echo "Enter the output file name: "; read name

fullscreen=$(xwininfo -root | grep 'geometry' | awk '{print $2;}')

avconv -f alsa -i pulse -f x11grab -r 30 -s $fullscreen -i :0.0 -vcodec libx264 -preset ultrafast -threads 4 -y $name

Do, chmod +x screencast

Now, double-click on screencast file and "Run in Terminal" Enter the name of video you want to make(filename and extension eg:myvideo.mkv or myvideo.mp4).

Finally, on completing your screencast, do ^C (contol+c) in terminal.

Your video will be saved in ~/Videos/ Bingo!!!

share|improve this answer
When I ran the command you mentioned I got this error: Unrecognized option 'preset' Failed to set value 'ultrafast' for option 'preset – M. Ahmad Zafar Aug 2 '12 at 11:04
Just check what presets your avconv ships with. what is the output of: ls /usr/share/avconv/libx264-* That will list what presets you can use. Reference:… – Chirag Aug 6 '12 at 4:42
I did check the available presets and then used them in the command avconv -f alsa -i pulse -f x11grab -r 30 -s 1280x800 -i :0.0 -vcodec libx264 -preset libx264-lossless_ultrafast -threads 4 -y myscreencast.mp4 now getting this error Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height – M. Ahmad Zafar Aug 6 '12 at 6:42
What is the model of your PC? – Chirag Aug 6 '12 at 8:24
Ubuntu 12.04 32-bit running on Core 2 Duo with 3G RAM – M. Ahmad Zafar Aug 6 '12 at 8:29

remove the -f jack and try -f alsa -i plughw:1,0.

You might need to substitute the 1 and the 0 for some number smaller than 3 (*) (maybe -f alsa -i plughw:0,0, or -f alsa -i plughw:0,2 ...)

this works on ffmpeg. Hopefully it will work on avconv as well

(note: jack is the name of a sound system, a part of the operating system that deals with audio. alsa is another sound system. My answer uses alsa just because it was the way I copied from somewhere online, a long time ago =P)

(*) these numbers have to do with the number of your soundcard and the number of the device in the soundcard

share|improve this answer
I tried to execute avconv -f x11grab -f alsa -i plughw:0,0 -s hd1080 -r 30 now it says: [alsa @ 0x89e8b40] capture with some ALSA plugins, especially dsnoop, may hang. [alsa @ 0x89e8b40] Estimating duration from bitrate, this may be inaccurate Input #0, alsa, from 'plughw:0,0': Duration: N/A, start: 70775.999990, bitrate: N/A Stream #0.0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s encoder 'aac' is experimental and might produce bad results. Add '-strict experimental' if you want to use it. – Chirag Jul 25 '12 at 8:41
sorry I forgot you =( I have not used avconv, but rather ffmpeg. If you dont care either way (neither did I !), instructions for ffmpeg instalation can be found in:… – josinalvo Jul 26 '12 at 20:38
(instructions are found on my answer to the question. Today, it was the first answer. The question touches other things) – josinalvo Jul 26 '12 at 20:41

Your Answer


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.