OpenGL Programming/Video Capture
It has a save/replay feature that captures everything you told the graphic card, and can reproduce it later on, and even save the result as a stream of pictures.
We'll use this to create a video suitable for upload at Wikicommons!
Compilation (instructions for GNU/Linux) 
Get the source code:
cd /usr/src/ git clone https://github.com/apitrace/apitrace.git cd apitrace/
apt-get install cmake
cmake -H. -Bbuild cd build make
Let's test with the simple wave post-processing effect:
cd wikibooks-opengl-modern-tutorials/obj/ LD_PRELOAD=/usr/src/apitrace/build/wrappers/glxtrace.so make test
Run the program for a few seconds, rotate the object, zoom, etc., and then quit the program.
This will create a
suzanne.trace binary file. If the file already exists, it will create
suzanne.2.trace, and so on.
You use the
glretrace command, passing it the trace file as parameter:
Of course, this is not interactive anymore, this is just a replay.
Convert to video 
Let's install ffmpeg:
apt-get install ffmpeg
Note: we tried to use ffmpeg's scaling filter to reduce the screen size (
-vf scale=200:150), but sadly it caused a segfault however we tried. So instead we just recompiled the application and specified a smaller screen size directly.
ffmpeg's options are organized the following way:
ffmpeg <input options> -i source <output options> destination
- We'll use a
.oggoutput since that's the only format accepted by Wikicommons (if you know who could get support for the free and better .webm format, please contact him/her!).
- The screen used during the tutorial has a refresh rate of 75Hz, but videos usually are 25 images/s, so we'll reduce the rate (double input and ouput
- We'll use a fixed, good quality (
- We overwrite the destination file (
/usr/src/apitrace/build/glretrace -s - suzanne.trace \ | ffmpeg -r 75 -f image2pipe -vcodec ppm -i pipe: -r 25 -qscale 31 -y output.ogg
We've got our video - and no additional code was needed.
Here's the result!
- This bug might be related to https://ffmpeg.org/trac/ffmpeg/ticket/397