I did already subscribe to a youtube channel that screencasted some programming but watchpeoplecode is more entertaining and interactive, plus you can see interesting projects while being coded!
What I don’t really like is the ubiquity of Flash to stream those screencast, Youtube, Twich and the WatchPeopleCode mediaserver are Flash-only compatible. Basically if you want to stream something live on the web you use Flash.
Live streaming with HTML5
But the most important link is this: the Icecast project.
Icecast is a streaming media server which currently supports Ogg (Vorbis and Theora), Opus, WebM and MP3 audio streams.
Wait!? Theora? Webm? Icecast can do video?
Turns out that Icecast can do Webm streaming from 2012 and this is very important because as you can see from theese tables with a single codec we can target the whopping 64.87% of device (both mobile and desktop). It’s a shame that another codec like Theora can do only 48.54% and is not available on Chrome for Android.
So with just one stream we can target a good share of our target, that’s good but we still know nothing about Webm streaming.
Digging in the Icecast docs reveal that is a piece of cake,
The drawback is: a
mount is a user streaming to Icecast, what if you want to add another
mount? You must edit the config file, like every time you want to have multiple sources transmitting at the same time.
Maybe you can schedule streamers and just have one source or spin another icecast server when a streamer want to stream. Seems like Icecast is a no go.
Icecast is a stable project and it’s moving slow and steady but there is an experimental branch called kh that offer interesting features like wildcard mounts. This would be the end of our problem and we could just configure the serve to use authentication on wildcard mount.
This would change the config to something more like
Ok good, we are ready. Let’s install the kh branch on our machine.
No packages, just source release, mmmmmm this is not what I expected.
Debian packaging system
After installing from source and configuring and trying the configuration and the streaming part and seeing everything work as expected I had a bad feeling about doing the same work every time I wanted to spin a new Icecast server (like a relay node to serve more user).
Maybe today I can learn something new, like how to make a Debian package.
The best resource I found is this set of slides, it contains most of the information that you need to get started and keep going.
deb-src entry to your
/etc/apt/sources.list file and run
Luckily for us the kh branch has the same requirements as the master branch.
Get the sources
The kh branch is published as a source package on Github, download it
and extract it
rename the directory to
icecast-kh-2.4.0 and the source release to
Scaffold the debian direcetory
Create a directory called
debian, there will be placed the files describing the release info and packaging instructions. This is difficult and a time consuming process.
There are a lot of [tools][debian_tools] available to do this work, just use them
Edit the package metadata
In the previous step the command
dh_make generated a bunch of files for us and placed them in the debian directory inside the icecast-kh-2.4.0, those files are the metadata attached to the package.
- control: the real metadata about the package; deps, name, mantainer, project page
- rules: how to build the package
- copyright: info about the license and copyright
- changelog: what changed from one release to another
you should edit them and place some useful info in there.
Just build it
But what we really care is the package itself, a tool like
ansible can take care of installing the packages needed by our icecast-kh package. (the post is getting long so I decided to skip the previous part)
If everything has gone as it should now there is a .deb file sitting in the parent directory and you can use that instead of building from sources relaying on a custom shell script.
This was the rigth time to learn something like packaging for Debian and the icecast project was what I needed to get started.
The docs on the Debian wiki are not that exhaustive and the most tedious part was getting the right info and trying what could work.