3

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  screencast.mov

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
Chirag
  • 2,099

2 Answers2

1

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

#!/bin/sh
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!!!

Chirag
  • 2,099
  • 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 02 '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: http://forums.heroesofnewerth.com/showthread.php?229469-HOWTO-Streaming-in-Linux/page2

    – Chirag Aug 06 '12 at 04: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 06 '12 at 06:42
  • What is the model of your PC? – Chirag Aug 06 '12 at 08:24
  • Ubuntu 12.04 32-bit running on Core 2 Duo with 3G RAM – M. Ahmad Zafar Aug 06 '12 at 08:29
  • I mean the model number, so that I can trace your configuration. – Chirag Aug 07 '12 at 15:33
0

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

josinalvo
  • 6,947
  • 5
  • 37
  • 51
  • I tried to execute avconv -f x11grab -f alsa -i plughw:0,0 -s hd1080 -r 30 screencast.mov

    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 08: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: http://askubuntu.com/questions/151935/create-a-screencast-in-a-low-end-pc-but-fast-maybe-by-sacrificing-compression

    – 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