12

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?

  • 1
    have you seen this question? unix.stackexchange.com/questions/3490/… – 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 5 '11 at 15:50
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/

  • 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 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). – Let_Me_Be Jun 15 '11 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.