[Documentation] [TitleIndex] [WordIndex

Here's a simple example of recording and encoding the OpenGL window(s) from an application. For more information see https://github.com/nullkey/glc/wiki. For recording videos of non-OpenGL windows, see VideoScreenshots.

Contents

Install glc

<!> First follow the Ubuntu steps under Other distributions at https://github.com/nullkey/glc/wiki/Install

Once you type

bash glc-build.sh

you'll be asked a series of questions; it's recommended to hit Enter at each prompt, taking the default answer.

<!> In case downloading the tarballs fails, you can try changing the script to download them from here

You should see some messages indicating installation, e.g.:

info  : Fetching sources...
info  : Unpacking sources...
info  : Building elfhacks...
info  : Building packetstream...
info  : Building glc...
info  : Installing elfhacks...
info  : Installing packetstream...
info  : Installing glc...
info  : Done :)
info  : You may need to add following lines to your .bashrc:
export PATH="${PATH}:/usr/bin"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/lib"
info  : If you want to remove glc, execute:
sudo rm \
/usr/lib/libglc-core.so* \
/usr/lib/libglc-capture.so* \
/usr/lib/libglc-play.so* \
/usr/lib/libglc-export.so* \
/usr/lib/libglc-hook.so* \
/usr/lib/libelfhacks.so* \
/usr/lib/libpacketstream.so* \
/usr/include/elfhacks.h \
/usr/include/packetstream.h \
/usr/bin/glc-capture \
/usr/bin/glc-play

Use glc to capture

Now, start the application with glc wrapping it:

glc-capture ./bin/nav_view

To start recording, press shift-F8. shift-F8 will also stop recording. GLC will by default record into a file named "application_name-pid-0.glc". Each time you start recording, it will append to that file. shift-F9 will record to a different file each time: "application_name-pid-[0-n].glc"

Use glc to playback

Now you can playback these files with the glc playback tool. If you want to try it:

glc-play <filename>.glc

Use glc to encode

To encode the .glc file to something else, like an mp4, you can use the encode.sh script that came with the glc source that was downloaded during the glc installation step. This script is not installed anywhere, so you'll have to find it in the glc source tree, which was laid down wherever you ran glc-build.sh. E.g., if you ran glc-build.sh from ~/Desktop:

~/Desktop/glc/scripts/encode.sh <filename>.glc -o <output_filename>.mp4

The resulting .mp4 file is playable by various software, including mplayer and vlc (on both Linux and OS X). It is not playable by Apple Quicktime Player.

If your .glc video file has multiple video streams (multiple video windows open up when you play it), you can specify the video stream number that you want to encode with the "-v NUM" option.

Note that you must install lame and mencoder for encoding. On Ubuntu, you can:

sudo apt-get install lame mencoder

Encoding to other formats

To encode video that can be played by Apple Quicktime and edited with iMovie, use glc-play together with mencoder and specify the Motion JPEG codec:

glc-play <filename>.glc -y 1 -o - | mencoder -demuxer y4m - -ovc lavc -lavcopts vcodec=mjpeg -o <output_filename>.avi

Or using ffmpeg:

glc-play test.glc -o - -y 1 | ffmpeg -i - -sameq -y video.mp4

You can read about more glc options here.

There are presumably other ways to invoke glc-play and/or mencoder to produce other video formats. If you figure out useful combinations, please document them here.

Alternate methods

Output to separate PNG files:

glc-play myMovie.glc -p 1 -o myMovie-%010d.png

Subsequent conversion of PNG files to MP4:

ffmpeg -sameq -i myMovie-%10d.png myMovie.mp4

2022-05-28 12:23