Record a windowed game in Linux using FFmpeg in three simple steps!

A more recent method can be found here.

This is based on this wonderful tutorial.


Click on the game window and fill in the uppercase info in the next line:

ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 30 -s WIDTHxHEIGHT -i :0.0+XPOSITION,YPOSITION -acodec pcm_s16le -vcodec libx264 -vpre lossless_ultrafast -threads 0 output.mkv

Now you have this video recorded! Time to compress it, for example like this:

ffmpeg -i output.mkv -acodec libmp3lame -ab 128k -ac 2 -vcodec libx264 -vpre slow -crf 22 -threads 0 our-final-product.mp4

Now upload to YouTube.

If the game you want to record is OpenGL, use GLC instead.

A more recent method can be found here.

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.

6 Responses to Record a windowed game in Linux using FFmpeg in three simple steps!

  1. wilbefast says:

    I can’t seem to capture sound using FFMPEG – any advice?

    • qubodup says:

      Do you use pulseAudio? I had to open pavucontrol and disable recording for all recording devices (microphones) and then it would record the desktop audio.

    • lolsack says:

      different sound mixer?
      either way, its better to record video first, then audio.

  2. It seems that recording of openGL does work with ffmpeg. Haven’t tried GLC yet.

    • qubodup says:

      Yeah, I often use it for opengl, when alsa isn’t available or when the card has no capture device in alsa.

      GLC might be faster though/create less slowdown.

      Unrelated: On your blog you show a youmouse. How much does it cost? On their current website there seems to be no cost info (unless adblock hid all the price shields away..)

      • There seems to be no price displayed.
        I bought that Youmouse trackball for about 7 Euros (70 RMB) from the Taobao website (similar to Ebay in China) at that time. It was back then when I was living in Shanghai.

        Recently I re-bought myself a Logitech Trackball as it’s still much more convenient and comfortable to use than the Youmouse.

        BTW: you made a video from my game Tuxomania back then, if you remember :-)
        I was looking for info on how to record games because I’m planning to make videos of it as I add features. Funnily enough when Googling this topic I landed on your blog :-)

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