Updated: July 24, 2010
For those wondering, FRAPS is a Windows program that can be used to record video streams of applications running on your desktop, most often games. For instance, I've used FRAPS to grab a handful of cool videos while playing Live for Speed. Being able to record your desktop activities has many aspects - educational, tutorial and sometimes sheer bravado. There are circumstances where nothing short of a video demonstration is going to work.
No problem, you have a handful of tools to do just that - Wink, recordMyDesktop, for instance, both of which I've reviewed here. Another program comes to mind, Istanbul, which I've shown you in my PCLinuxOS 2009 article. However, while these programs are quite adequate for pure desktop use, they do not work well with games. They use the X Windows, while most games utilize hardware acceleration of the graphic card to do their magic, so the actual rendering of graphics is done before the pixels hit the screen. We need something else to grab the video in games and other OpenGL programs.
Well, enter glc, a Linux FRAPS-like software capable of capturing, playing and encoding video and audio. It does what we need. So let me demonstrate you. We'll use a few sexy games for that. Nothing like some hardcore shooting action and fast-paced driving to instill the concept. Oh, I will also refer to Wine and Windows applications. So if you're wondering if glc is going to work with World of Warcraft or another Wine-ed game, then the answer is yes. Follow me. Plenty of screenshots waiting just a few scrolls below!
You can install glc from official distro repositories or download the build script from the official website and build on your own. I've encountered difficulties using the latter method, so I'd recommend using the version in the repositories. See the Problem section below for more details.
Once the program is installed, you will have two utilities - glc-capture and glc-play. Both are command utilities with a handful of flags. You will need to spend a few moments learning how to use glc, but it's not very difficult.
The most basic usage is:
Then, in game, you can start/stop recording using a hotkey. The default is Shift + F8. You can also configure many other parameters, like start recording immediately (-s), change the output filename and path (-o), cap the frames per second, change compression, maybe even disable the audio.
glc-capture -s --disable-audio <executable>
This will record only video, the moment the application launches. But enough talking, let's see some fine examples.
I tested with Enemy Territory Quake Wars, a beautiful, lovely first person shooter. Power the game and start recording. Lo and behold, the slowdown in the game was almost negligible. Everything ran quite smoothly. A roughly 30-second recording produced a 250MB stream that I was later able to encode to just 14MB worth of .avi file. But how do you know you've done a good job? Well, glc-play.
Use glc-play to see your in-program or in-game recording.
glc-play <recorded file - bears .glc suffix>
glc-play will stream the file in its own media-player-like frame. You can later use glc-play and additional software to create movies for everyone to see and appreciate. We'll do that shortly; beforehand, a cool screenshot:
Be not confused by the Lucid window theme. This demonstration was done on a 32-bit Karmic, running from an external 2.5" 5400rpm USB disk connected to my RD510 laptop, which normally boots two instances of Ubuntu 10.04 Lucid Lynx, one instance of Jaunty and one of openSUSE 11.2 Gnome. On my way to a 10-boot system, btw. Oh, the graphics card is 512MB RAM Nvidia 9600GS.
P.S. If you are wondering about the new themes and how you can use them on older version of Ubuntu, then please take a look at this blog. And if you care for some ramblings about the new themes, you may want to read my Color of stability article.
Now comes the really fun part, making cool videos from your work! Going into complete detail about encoding is beyond the scope of this article, nevertheless, I will show you a few quick tips that should help you get started with encoding.
glc works with mencoder and lame utilities, so you should download and install those first. Both are popular tools available in repositories of most distributions. After this step is done, you can encode. Basically, stream the file with glc-play and pipe it to mencoder for packaging. Sounds a bit cryptic, but it's not that terrible.
First, there's an encoding script (direct link, shell script) already available on the official site, which will create MP4 videos from your streams. The script has a few hard-coded options, so there's no guarantee it will work for you.
Second, there's a wiki page on the official site, which offers examples on various options. When I started using glc, this was the one reference I used, successfully.
There's no golden rule, but here's an example. It has two parts.
glc-play [stream file] -a 1 -o audio.wav
glc-play plays first available audio stream into a WAV file.
glc-play <stream file> -y 1 -o - | mencoder -demuxer y4m - -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=3000 -audiofile audio.wav -oac mp3lame -o video.avi
Next, glc-play plays the first available video stream and pipes it to mencoder; the latter then uses the y4m demuxer to interpret the stream and then package it as a MPEG-4 video in .avi format using libavcodec (lavc); the bitrate is relatively low, only 3Mb/sec; the earlier created audio file is also inserted into the output video, encoded with mp3lame.
Now, I'm no multimedia expert, but I believe this pretty much explains it in simple terms. If you do not have an audio track and do not wish to use it, you can simply remove the audio part from the command.
Here's an example of mencoder hard at work:
Once your video is ready, power up a media player and enjoy:
Nice, isn't it?
Works with Wine too!
Oh yes. You can also use it to record your Wine-powered games. In my case, the best example is the phenomenal driving simulator Live for Speed. To record the game action, just execute glc-capture against the wine command:
glc-capture <options> wine <path to LFS.exe>
You may want to use -s or additional flags, as you see necessary.
Some screenshots, glc-play in action:
VLC and Totem playback:
I'm always amazed anew by the staggering realism in this game. Notice the tire flexing during the wild side drifts in Peugeot 106. Absolutely fantastic.
The FPS rate and the smoothness of videos when recording Wine applications were less than with native programs/games, probably due to an extra translation layer. Still, it was quite manageable.
Problems & observations
There were a few issues with glc. So please bear these in mind when considering and using the application.
In a few cases, I was unable to play streams recorded with audio. glc-play function would complain about ALSA this or that. I have not debugged this at any great length, but you should remember this and if you encounter issues, run glc-capture with --disable-audio option.
64-bit compatibility & build script
glc would not work well on a 64-bit system. It worked great on 32-bit, doing all the functions expected of it. I followed the instructions on the official website, including creating manual symbolic links and using the build script, but this did not work.
In fact, the script exited when it realized it was working on a 64-bit operating system. Next, I installed the software through the repository and this went well, but it did not help either with the tool functionality. The recording feature was flaky. Hopefully, this will be sorted out.
The big issue is that you cannot fully utilize the power of 64-bit processors and extra RAM, with video and audio editing simply made for 64-bit machines. PAE kernel on 32-bit systems can help a little with RAM limitations, but you may not like this, especially since most modern machines use 64-bit architecture for quite some time now.
On a 32-bit system, glc installed using the build script could not find libraries unless installed in the root directory. Any attempt to place it under /home, /usr/local or /opt resulted in a failure.
I did mention this earlier, but you should have a powerful machine and a fast hard disk to utilize glc properly. Most laptops will not be able to handle high-FPS, high-resolution games well. You'll hit the disk I/O bottleneck.
Recording even simple games for just a few seconds translates into hundreds of MB of data on your disk, so keep this in mind. You can easily run out of space, plus the game playback may stutter. A second disk or an external disk sounds like a good idea here.
Not a problem per se, more of an advisory.
The tool is very much geeky, with long and somewhat confusing functions that require familiarity with video/audio editing, including mencoder and lame. This makes glc somewhat inaccessible to less knowledgeable users. A GUI wrapper would be a good idea, including all the grisly options for encoding and formatting and whatnot, nicely hidden under big shiny buttons.
Again, this is a more of a nice-to-have wish-list.
Closing word ...
Before I conclude the article, a few notes:
Remember how I kind of complained in my Nexuiz review that I have yet to figure out how to capture video while playing? Well, here we go. There's your answer.
Finally, like Winetricks, this tutorial is mighty important for Linux gamers, so I will have it linked in the Gaming section as well.
More readingYou might want to take a look at these articles, too:
There you go. A fantastic tool for creating in-game videos and demonstration, allowing you to brag about your pwning skills in first person shooters or show what a skilled driver you are. Or not. The important thing is, being a Linux user does not mean you are any less photogenic than your Windows peers.
glc is a very nice tool. It is a little difficult to use, more geared toward experienced users, and it does have some unresolved problems, like sound issues and 64-bit support. But it works well and renders lovely output. Just make sure you have fast disks and plenty of RAM to go by. Well, I hope you enjoyed this. See you around!