Skip to main content
  1. Posts/

Screen Recording on the Server

··717 words·4 mins
Author
Hairizuan Noorazman
Software engineering experiments, implementation notes, and lessons learned.

Over the weekend, I’ve been experimenting whether if its possible to set up screen recording on a linux server. This is partly just out of curiosity but also, a little a bit of frustration. Imagine if you were in a position where you aim to assist people in recording their training sessions over on Google Hangouts but in order to do so, you would need to be around and your computer needs to be “sacrificed” in order to do the recording.

Luckily, it seems that with a little experimentation work, it’s possible to actually set up such a service on the side.

Let’s start with what we would need to think about before we can get things started.

  • Video/Audio recording software. A lot of people can easily suggest to look into OBS but for a automated system and on a linux, we might be better off with a command line utility. After researching a little on this, ffmpeg toolkit is mentioned pretty often in many of the linux/ubuntu forums.
  • How to simulate going into Google Hangouts? We would need a browser simulation tool. Should we go with the headless tool such as PhantomJS or even Chrome browser headless mode?
  • How the user would interact with the tool? Using a scheduling service via Google Calendar? Or allow the user the call upon the service via Slack?
  • Possibility of hosting it on Docker? For this docker side of things, it is more of a personal desire to have it hosted on docker rather than on a normal instance; partly to increase portability of the tool but also to because of my familiarity with the tool

Installing ffmpeg/avconv
#

So to start things of, we would think about the command toolkit. While looking around the linux forums, it turns out ffmpeg is not really available for debian-flavor of the linux systems. Instead, we would use avconv which is a separate fork of the ffmpeg command line utility.

There is so far little difference between ffmpeg and avconv command line tools. Any command copied over on forums that use ffmpeg is still usable on the avconv so that seems to be no issue from that angle.

Installing a browser and simulating it
#

Previously I used PhantomJS to simulate the browser but with the big news that the maintainer for this stepping down, we would instead try Google Chrome headless mode instead.

News on Phantom JS maintainer stepping down https://groups.google.com/forum/#!topic/phantomjs/9aI5d-LDuNE

The Google Chrome installation is slightly mode tedious as its installation is not part of the default apt-get list. We would need to grab that list and add it to our own on the server to even make it possible to install it.

The bash script that I would provide later would contain that.

Possibility of Dockerizing it
#

Well, we can definitely dockerize the video portion of this screen recording mini project but it is difficult to record the audio portion of the screen recording in a docker container. Reason for this is that the tools that is the needed to run this (pulseaudio) seem to require some dbus mechanism which is not really exposed to the docker container but for all you know, I’m missing some configuration within the command line to switch it to an alternative mode.

In order to research further on this, I’m looking through some of the Dockerfiles that Jessie Frazelle has put up and that link is available here:

https://github.com/jessfraz/dockerfiles

However, even though we can only dockerize only the video portions of software, it can probably be used in other software ideas: e.g. Using it when running unit tests which provides video on how the software is interacting from the frontend.

Putting it together
#

So, to put it all together, this is what we have:

The instructions above are still very complicated as details are not ironed out yet but more details would come out soon. You can look into the project plan (https://github.com/hairizuanbinnoorazman/video-recording-service#whats-involved) and see if there are any other interesting things to add on to this.

Related

Using AWS Lambda for Data Science Projects and Automations 1

··869 words·5 mins
A thought experiment # Let’s say there was this one day during your usual work hours where you are tasked to handle some data transformations between your data sources. The data source is csv file generated from backend systems and is provided on the hourly basis. These data sources are to be analyzed as soon as possible and the insights are to be relayed to the marketing and business intelligence teams. How should we handle this? (Of course we should aim for as cheap a solution as possible)

Using Decorator Pattern to Remove Code Bloat

··971 words·5 mins
I’ve been learning plenty of Golang nowadays and one of the most common design patterns that I keep hearing about is the decorator pattern. It is often used when handling with web requests; where you would create a function that accepts a struct that implements the handler interface which would then return an struct that also implements the handler interface.

Using Docker Multi Stage builds to run unit tests

··1212 words·6 mins
This is a suggestion piece and not a recommended way of using docker or anything. Motivation # The question we would want to know here is how do we exactly run the full on/all the unit tests for our applications built via Docker. One way to do this is to rely on a build server like Jenkins to create the required environment which we would need for a build and then run the unit test needed. However, this would mean that there is need to bootstrap a environment to do so.

Persistance in Google Cloud Run with FUSE storage to Google Cloud Storage

Google Cloud Run is a serverless compute platform that automatically scales applications in response to traffic. It is designed to run stateless containers, meaning that the instances of your application are ephemeral and can be spun up or down as needed. This design choice has implications for data storage, particularly when it comes to persistence.