Video-record (screen capture) WITH SOUND on Linux using FFmpeg and PulseAudio in 2012

  1. Install Pulseaudio because ALSA won’t record sound from your integrated on-board sound card :(
  2. In pavucontrol, show all recording devices and activate the one that reacts when games make sounds, so that Internal Audio is set as fallback (shield icon)
  3. Start game
  4. wmctrl -r GameWindowTitle -e 0,0,0,1280,720
  5. ffmpeg -f alsa -i pulse -f x11grab -acodec pcm_s16le -r 30 -s 1280x720 -i :0.0+1280x720 -vcodec libx264 -crf 0 -preset ultrafast -threads 0 out.mkv
  6. Edit/encode in kdenlive

Some alternatives, problems, solutions and discussions of this and similar methods can be found on:

  1. Arch Linux forums
  2. Ubuntu forums
  3. OpenSUSE forums

Got questions? Ask below. :) Suggestions welcome too!

Nikki and the Robots: Story Episodes
Buy the cute Überpixel™ style platformer now!

outrageously blatant self-promotion

This entry was posted in qubodup and tagged , , , , , , . Bookmark the permalink.

7 Responses to Video-record (screen capture) WITH SOUND on Linux using FFmpeg and PulseAudio in 2012

  1. william says:

    I’ve had problems encoding glc with libx264. Did you have to compile ffmpeg yourself to get it working?

    • qubodup says:

      No but I used arch linux’s version.

      What is your problem?

      • william says:

        I haven’t tried recently, but encoding my GLC captures stopped working a while back when I updated to a new version of Ubuntu – I started getting “unknown encoder” errors for libx264. Apparently hand-compiling can work for Ubuntu, but didn’t help me :-/

      • qubodup says:

        Sounds like libx264 (or the audio encoder) is missing or has the wrong name.

        You could try using another encoder, for example libvpx (webm) and use a suitable preset (should be at /usr/share/ffmpeg/ ).

        Feel free to email or continue this thread for a step by step help from me to you if you want to try recording something right now :)

  2. wilbefast says:

    I was getting some good results with gtk-recordmydesktop for a while, but then for no apparent reason it just stop working :-/

    I had another crack at your method – here’s what I came up with:

    wmctrl -r Black\ Dog -e 0,0,0,640,360

    ffmpeg -f alsa -i pulse -f x11grab -acodec pcm_s16le -r 30 -s 640×360 -i :0.0+0x0 -vcodec libx264 -crf 0 -vpre lossless_ultrafast -threads 0 out.mkv

    I’d managed to get x264 working in the meantime, so now problem there. Had to change the preset though. All told it works great, thanks ;)

  3. tomas says:

    Help, i can’t record any system sound :O

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s