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?

3
  • 1
    have you seen this question? unix.stackexchange.com/questions/3490/… Commented Jun 14, 2011 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
    Commented Jun 14, 2011 at 20:39
  • The link given by @Mike works for pulseaudio. I'd like to see a solution for us using alsa :)
    – invert
    Commented Aug 5, 2011 at 15:50

3 Answers 3

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/

2
  • 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
    Commented Jun 15, 2011 at 4: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). Commented Jun 15, 2011 at 6: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.

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.

You must log in to answer this question.

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