Skip to main content

Open Source Video Production

| @renice@hachyderm.io

I'm always looking for new ways to educate my audience and have recently started setting up my workstation for recording video to post on Youtube. While I could have gone down the easy road and used my Mac laptop for all of this, I wanted to see what it would take to make it all work on my Linux workstation.

There are lots of application choices for capturing and recording video on Linux. Unfortunately, most of the user interfaces I tried were buggy or totally inflexible. Being a long-time Unix user, I started looking around for more powerful tools on the command line. I was not disappointed.

There's VLC and cvlc for command-line work. In fact, VLC is probably the easiest choice for any kind of media and generally works out of the box. I made a couple of test recordings with VLC and it works fine. Since figuring out what to do with VLC took less than five minutes, I figured I'd look for something more challenging and, hopefully, a little more flexible.

Gstreamer is a framework and libraries for working with media on lots of platforms, but it really shines on Linux. It's meant to be used as a library, but it also comes with a useful pair of CLI tools in the form of gst-inspect and gst-launch. Working with these is really confusing at first since the intent behind the syntax of available examples is not parseable without in-depth knowledge of how gstreamer works. Initial experiments showed that I could do what I want and more. For example, here's how to record your webcam to a file:


I had this idea of recording an overhead camera simultaneously with a forward camera, so I decided to invest some time into learning gstreamer well enough to use it. I was having a hard time figuring out how to do complex flows in gst-launch because it requires an understanding of how the gstreamer API works. I decided to try the Python API to see if it was any easier. It's not Python's fault but that way lies madness. There are currently two major versions of the gstreamer API available, 0.10 and 1.0. This creates problems for gst-launch and python alike. The vast majority of examples are for 0.10. Packages are available for both. I couldn't find a usable combination so I gave up and Googled "golang gstreamer".

Even though the Go bindings for gstreamer are minimal, I did manage to get them working with gstreamer 1.2 and got an example program going.



My modified bindings for Go/gstreamer are available on Github at https://github.com/tobert/gst.

While I love programming in Go, this was another dead end. The bindings don't have all of the API endpoints I need and, more importantly, 'go build' with cgo involved was really slowing me down so I decided to try gst-launch again using what I've learned.



That works, but what I really want is to do a whole lot more. How about capturing both webcams, audio, and a terminal window all in one go? Yup, it can do that.


And finally, here's the result. I'll switch to a larger font in the terminal in the future, but you get the idea.