14

If I want to record my desktop, I use:

ffmpeg -f x11grab -s `xdpyinfo | grep -i dimensions: | sed 's/[^0-9]*pixels.*(.*).*//' | sed 's/[^0-9x]*//'` -r 25 -i :0.0 -sameq valami.avi

But it doesn't save any audio -- how can I include sound with the video?

Extra: How can I set on-the-fly encoding like with x264 + mp3:128kbit?

Mark Hudson
  • 418
  • 1
  • 4
  • 11
LanceBaynes
  • 39,295
  • 97
  • 250
  • 349
  • 1
    have you seen this question? http://unix.stackexchange.com/questions/3490/how-can-i-record-the-sound-output-with-gtk-recordmydesktop – Mike Pennington Jun 14 '11 at 13:02
  • For the screen resolution, a more compact way than *grep + sed + sed* is to use *awk*: `xdpyinfo |awk '/dimensions:/{printf $2}'` – Peter.O Jun 14 '11 at 20:39
  • The link given by @Mike works for pulseaudio. I'd like to see a solution for us using alsa :) – invert Aug 05 '11 at 15:50

3 Answers3

5

Just add -ad device_you_want_to_record

You might also want to tweak your audio codec.

This site has good examples: https://verb3k.wordpress.com/2010/01/26/how-to-do-proper-screencasts-on-linux/

Šimon Tóth
  • 8,098
  • 12
  • 40
  • 67
  • I don't know what my `-ad` device needs to be, but it works without it when I use `pavucontrol` as per the link ... thanks ... How can I find out what my `-ad device` is? ... and perhaps more to the point, I don't see this `-ad` option in my `man ffmpeg` .. *FFmpeg version SVN-r0.5.1-4:0.5.1-1ubuntu1.1* – Peter.O Jun 15 '11 at 04:20
  • `-ad` should only apply to alsa, with pulse audio you shouldn't need to set that (not 100% sure, since I don't use pulse audio). – Šimon Tóth Jun 15 '11 at 06:58
2

I recently became interested in screencasting, and stumbled upon http://screencasts.ubuntu.com/ at which they recommended installing gtk-recordMyDesktop. So I did, and tried it out and it worked, audio and all. My humble results at http://www.youtube.com/watch?v=Rju2TEfG0Bo (includes audio). It may use your technique under the covers for all I know.

Mark Hudson
  • 418
  • 1
  • 4
  • 11
0

I'm using debian, where the almost identical tool is avconv due license issue.

I use pulseaudio as input of this tool to record the audio an video together with the follow command:

avconv -y -f pulse -i default -f x11grab -r 25 -s 1440x900 -i :0.0+0,0 -acodec libmp3lame -vcodec libx264 -preset ultrafast out.avi

ffmpeg command should be used with almost any modification to the specified parameters.

campisano
  • 173
  • 1
  • 6