Wednesday, February 5, 2014

Linux Screencasting or Livestreaming

The goal of this post is to inform you about a GUI screencasting piece of software that I use for both recording my desktop gaming sessions as well the livestreaming them to sites like and I will show you how to compile and install the latest version from GIT as I feel it has some improvements within the code that are not available in the ppa version of the software. Compiling code shouldn't scare you away as it will not harm your system in anyway if you follow step by step. Many times it is necessary to compile software in Linux so that you can have the latest version of a package because the maintained versions within the official repositories are not up to date.

There are various GUI software packages out there for Linux users in order to capture their desktop so they can create a screencast of how to complete a particular task in Linux or to create a video showing how to get past a certain level in a game like gtkrecordmydesktop, istanbul, and kazam, but when I attempted to use any of those I would always have issues with synchronization of the video and audio. Either it would be out of sync from the start or it would start to become out of sync over time. Also none of those packages allowed me to livestream the action in realtime (as close to real time as you can get). I came across a package called SimpleScreenRecorder.

Simplescreenrecorder is a GUI screencasting software. It's very similar to the other pieces of software that I listed above in that it uses FFMPEG at it's core but the key difference is that it has built in synchronization coding as well as the ability to livestream to sites like Twitch or He has a PPA if you want to just try that version of the software but that version does not contain the ability to set the keyframe interval (which Twitch and Hitbox expect a value of 2 seconds for every keyframe) and it also doesn't contain the improvements he made to the syncronizer and scaling feature. Let's get right to it and compile SSR from GIT.

The file within the source files contain all the information you'll need to build and install it for your Linux Distribution except for Ubuntu 13.10, it's missing 1 library so we'll walk through those steps together right now. These steps are for a 64bit architecture so if you're running a 32bit version of Ubuntu 13.10 than your steps may vary slightly but I believe Maartin has accounted for both 32bit and 64bit in his build and compile script so don't give up now.

Let's get started, in Ubuntu 13.10 64bit you can open the terminal by holding the alt key and pressing F2 which will bring up the dash, then simple type in terminal and then click on gnome-terminal to open that application.
First we need to install the dependencies. *NOTE* Ensure you scroll inside the code box to copy and paste everything required.
sudo apt-get install build-essential pkg-config qt4-qmake libqt4-dev libavformat-dev libavcodec-dev libavutil-dev libswscale-dev libasound2-dev libpulse-dev libjack-jackd2-dev libgl1-mesa-dev libglu1-mesa-dev libx11-dev libxfixes-dev libxext-dev libxi-dev g++-multilib libx11-6:i386 libxfixes3:i386 libglu1-mesa:i386
Let's first make sure you're in your /home directory. The cd command should get you there, just type in cd and hit enter in the terminal and then you can check by typing in pwd and hitting enter. It should show /home/youusernamehere.
Now we need to get the code from his GIT project
git clone

NOTE: (switching branches is no longer required as he has merged the changes he made in the glinject-next branch into the main branch.)
Now let's switch to his glinject-next branch with has the improvements to the code and the ability to set the keyframe interval as required by Twitch and Hitbox. First we'll need to cd into the newly created ssr folder (run the next 2 commands separately, 1 line per command)
cd ssr
git checkout glinject-next
Now we can run the simple-build-and-install script from the ssr folder.
If you receive the following error than the 32bit libraries are not linked correctly for a 64bit system and we need to create some symlinks but it depends on what type of graphics drivers you're running on your system.
checking for XOpenDisplay in -lX11... no
configure: error: required library missing
If you're running open source drivers (intel, radeon, or nouveau) than you need to create the following symlinks. First cd into the appropriate directory and then create the 2 symlinks (run the next 3 commands separately, 1 line per command).
cd /usr/lib/i386-linux-gnu
sudo ln -s mesa/
sudo ln -s mesa/
If you're running proprietary graphics drivers (fglrx or nvidia) than you need to create some additional symlinks which you can find out about by reading the SSR source file. It's located within the ssr folder that you cloned from GIT.

For all drivers we need to create these additional 4 symlinks. You should still be within the /usr/lib/i386-linux-gnu/ directory when you create these 4 (run the next 5 commands separately, 1 line per command) *NOTE* Ensure you scroll inside the code box to see all required symlinks required.
sudo ln -s
sudo ln -s
sudo ln -s
sudo ln -s
sudo ldconfig

We can now cd back into the SSR directory so that we can run the simple-build-and-install script again now that we have properly linked to the 32bit libraries (run the next 2 commands separetly, 1 line per command)
cd ~/ssr

That should have successfully run and you should see the ending lines that appear like the following
See any operating system documentation about shared libraries for
more information, such as the ld(1) and manual pages.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/home/vm1/ssr/build32/glinject'
make[1]: Leaving directory `/home/vm1/ssr/build32/glinject'
Making install in scripts
make[1]: Entering directory `/home/vm1/ssr/build32/scripts'
make[2]: Entering directory `/home/vm1/ssr/build32/scripts'
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/home/vm1/ssr/build32/scripts'
make[1]: Leaving directory `/home/vm1/ssr/build32/scripts'
Making install in src
make[1]: Entering directory `/home/vm1/ssr/build32/src'
make[2]: Entering directory `/home/vm1/ssr/build32/src'
make[2]: Leaving directory `/home/vm1/ssr/build32/src'
make[1]: Leaving directory `/home/vm1/ssr/build32/src'
make[1]: Entering directory `/home/vm1/ssr/build32'
make[2]: Entering directory `/home/vm1/ssr/build32'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/home/vm1/ssr/build32'
make[1]: Leaving directory `/home/vm1/ssr/build32'
Running post-install script ...
You've just successfully compiled and installed SimpleScreenRecorder from GIT using the glinject-next branch. You won't be able to use SSR and encode (capture) using h264, aac, or mp3 yet though. For those to be applicable as a choice when you choose your encoding settings within SSR you'll need to install the ubuntu-restricted-extras package. You would just type in the following command into the terminal. It may prompt you to accept the installation of the packages by having to type in a "y", meaning Yes. It may also prompt you again for accepting the user license for true type fonts, mp3 and aac codec's, you would merely hit tab so that "ok" highlights and then hit enter.
sudo apt-get install ubuntu-restricted-extras
*NOTE*If you're running Kubuntu, Lubuntu or Xubuntu, be sure you install it's applicable restricted-extras pacakge ie: xubuntu-restricted-extras.
This was only to show you how to install SimpleScreenRecorder. I may do a follow up on how to use it properly but Maartin already has a lot of great information on his website.

-Ubu out