Category: Open Source

Capturing game footage with FFmpeg in Ubuntu

It’s surprisingly easier than I expected. I’d previously thought FFmpeg was so complicated that I looked everywhere else for a decent video capture tool in Linux.

I found the following explanation at qubodup’s blog. And he, in turn, found the tutorial from a much larger blog post.

  1. Start the game/open the window you want to record (I expect it should be windowed for the following instructions to make sense).
  2. In a terminal, enter ‘xwininfo’ and then click on the window you will be recording.
  3. You’ll see a bunch of information pop up in the window.
    1. If you want to capture window decorations, also make note of the values in -geometry at the bottom. (width, height, upper-left X, upper-left Y)
    2. If you want to capture only the window contents, make note of Width, Height, Absolute upper-left X, Absolute upper-left Y.
  4. In a terminal, type/paste the following

    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

  5. Replace the capitals with the values you noted previously.
  6. Press enter to begin recording. When done, press Ctrl-C in the terminal.
  7. In a terminal, type the following to encode the video

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

I’ve yet to get the audio to record properly, but at least the video records flawlessly.

Updated Avatar

I figured since I’m too awake to sleep, it’s about time I clean up my nasty-ass avatar. Vectorize it, even.

Before After
Before After

Inkscape came to my rescue. And it’s free. And now I’ve got a good looking avatar.

Free Business

I just read a forum post by Nine Inch Nails’ Trent Reznor. He covers how to make money without selling your soul to a label.

Trent covers music but it’s transferrable to, say, books and even games

It’s nothing new. It works. Why isn’t everyone giving their stuff away?

Displaying an SVG hosted by GoDaddy

I’ve recently been contributing to the TorrentBoy Project and trying to keep some level of activity going for it at all times. The project still needs active contributors, especially if you’re any good with stringing coherent words together or connecting lines together to form pretty pictures. See 1889.ca for more information. Writers? Artists? Anyone!

How is this relevant? I told MCM, the brain behind the project, that I’d get off my butt and finally post the .svg I had created. Being that TorrentBoy is a collaborative project, it helps others if they have a “launching” point to contribute from. From my perspective, I’m hoping that someone can take my image of Crash with Waser Bwaster () and make him awesome.

Back to the point, GoDaddy doesn’t display .svg files by default. When linking to an SVG, the page will just spit out the source code to the image. Not very helpful. A temporary solution would be to change the .svg extension to .xml, which will then correctly display the image. But that’s not how we do it!

The solution is this. Stick the following lines into your websites root .htaccess file (the ~/html directory).

AddType image/svg+xml svg
AddType image/svg+xml svgz
AddEncoding x-gzip .svgz

Give it a try. Much thanks to this article for the solution.

Install XBMC in Ubuntu 9.04 Jaunty Jackalope

I’m going to make this as simple as possible. I’ll even stay away from the “command line” until it makes sense to use it.

First, add the repository to your software sources file. The repository can be found at Launchpad, I found it by searching for PPA XBMC jaunty from the site’s search function. The two XBMC repositories for Jaunty are

deb http://ppa.launchpad.net/team-xbmc/jaunty-ppa/ubuntu jaunty main
deb-src http://ppa.launchpad.net/team-xbmc/jaunty-ppa/ubuntu jaunty main

But we’re mostly interested in that first one (repository). Highlight and copy the first line so we can add it to our repositories. Open up the Sources manager

System > Administration > Software Sources

Then click the Third-Party Software tab. Click Add at the bottom left of the window and paste in the repository that you copied previously.

Next we need to Authenticate the repository so that it shows up in the system’s list of software that we can install. To do this, click the Authentication tab in that software sources window.

In order to authenticate, we need to import the XBMC key file for Jaunty. The public key, like the link to the repository itself, can be found on Launchpad. You might notice on the XBMC-Jaunty launchpad page the following line:

This repository is signed with 1024R/9317790E OpenPGP key.

The public key is found by first clicking that link. You’ll be presented with another link on a line like the following:

sig  sig3  9317790E 2009-04-04 ...

Click the first link to be taken to the repository’s public key. You need to copy everything below the heading. Everything includes

-----BEGIN PGP PUBLIC KEY BLOCK-----

and the block of characters in the middle, all the way to the end of

-----END PGP PUBLIC KEY BLOCK-----

After that has been copied, create a file and paste the block into it. The name of the file doesn’t matter as you only need the file for another minute.

After the key has been pasted into the file, go back to Authentication tab of the Software Sources window. At the bottom left of the window is the Import Key File… button. Click it. Navigate to and select the key file you just created. Click OK.

You should now see the XBMC key information in the Trusted software providers window. That’s it for setting up the repository. Just click Close and you’ll be prompted to update the system’s available software listing.

To install, just go through the steps you would regularly to install software. Personally, I prefer to run the command from a shell.

sudo aptitude update
sudo aptitude install xbmc

If you haven’t already done so, you can now delete the XBMC launchpad key.

Note: If you are using an ATI video card, you may need to install the ATI video card drivers from the ATI site. This is evident when you go to run XBMC and a window flashes and disappears.
It appears now that, in the updates leading up to but not necessarily including today, ATI video cards will now work properly with XBMC and no longer cause it to crash.

Staypressed theme by Themocracy