From the glc website: “glc is an ALSA & OpenGL capture tool for Linux. It consists of a generic video capture, playback and processing library and a set of tools built around that library. glc should be able to capture any application that uses ALSA for sound and OpenGL for drawing. It is still a relatively new project but already has a long list of features.”
The question now is: How do we install glc on our Arch Linux systems? It isn’t available on any of the main repositories, but like many useful tools it is on AUR. This, my friends, is the perfect time to introduce you to the yaourt package.
yaourt is a wrapper for pacman that allows you to easily install packages from AUR. But be cautious, packages from AUR are user contributed, you have to make sure the package is from a user you trust and that you have examined the package yourself and trust the code it contains. Otherwise you may end up installing a package that seriously compromises your system.
For the installation of yaourt we need to add the [archlinuxfr] repository to the end of our pacman.conf file:
# nano -w /etc/pacman.conf
Server = http://repo.archlinux.fr/i686
Now, after syncing our repositories (pacman -Sy) we should be able to install the yaourt package:
# pacman -Sy yaourt
We can now proceed with the installation of glc.
$ yaourt -S glc
or, if you like using the latest and greatest:
$ yaourt -S glc-git
Yaourt will automatically download the PKGBUILD from AUR, run makepkg, create the package, and install it for you. This is an interactive process; you will be prompted to review the PKGBUILD (to ensure it doesn’t contain a shady download link or nefarious command like rm -rf / which will wipe out your entire hard drive), and your sudo password, among other confirmation dialogs.
Thanks kumyco for providing us with these high quality glc PKGBUILDs.
Here are some useful commands that will hopefully get us started with a basic knowledge of what glc does and how. We shall proceed by capturing a 3D application, in this case the Battle for Wesnoth game.
$ glc-capture -o /home/myusername/glc-videos -r 0.5 -s wesnoth
Let us parse the above command to see what all those options stand for. First, we have -o, which stands for output, it specifies the directory in which we want to save the .glc video we are about to capture. Then we have the -r 0.5 option, which resizes the video to half, for example glxgears being a 300×300 size window will be resized to 150×150 on the .glc video. This is very useful if the window size of the application is large. Otherwise we would end up with a very big .glc video file. I once had a video of less than three minutes that was almost a gigabyte in size!
And finally, the -s option tells the application to start recording as soon as Wesnoth is launched. If you don’t want this, shift + F8 is the key combination to start and stop glc-capture recording capabilities. However, this won’t work if the game has that exact key combination assigned to something else.
Now, we should have a video, let us play it.
$ glc-play filename.glc
Esc key stops playback, f toggles full screen and Right key seeks forward.
$ glc-play myvideo.glc -o – -a NUM | lame -hV2 – audio.mp3
This will separate the audio and make it into a .mp3 file. Then we can go about encoding the video and mix it with the audio file we just made ourselves.
$ glc-play myvideo.glc -o – -y NUM | mencoder -demuxer y4m – -nosound -ovc x264 -x264encopts qp=18:pass=1 -of avi -o video.avi
$ glc-play myvideo.glc -o – -y NUM | mencoder -demuxer y4m – -audiofile audio.mp3 -oac copy -ovc x264 -x264encopts qp=18:pass=2 -of avi -o video.avi
If all went well, we should have the video.avi, with sound. I hope you have enjoyed your game capturing so far, and will continue to do so in the future.