Latest GStreamer Streaming Server features: Video on Demand, Smooth Streaming, and DRM – David Schleef (Rdio Inc.)

Gstreamer Streaming Server (GSS) is currently a side project, but will probably merged into the project at some point (as with David’s previous side projects). It actually only uses GStreamer itself for live streams, and the code also uses GST_DEBUG. It’s written in C on libsoup, json-glib, GObject, bootstrap (for the website).

rdio is an on-demand streaming music subscription service. They’re launching vdio, which is a rental-based VOD service. They needed a product similar to Adobe AMS but with other formats and DRM systems. There are other non-free products out there, but nothing that really has everything. So David started this open source project.

Modern VOD streaming is using HTTP, and can be a dumb web server (apache). This can be efficiently handled by Content Distribution Networks, which cache the files close to the end user. You also need a video player – this used to be in Flash (ActionScript), to customize the playback experience. Things like bitrate switching are also in the video player code. So this is in-between the user interface of the website and the media coded itself. With video tags in HTML5, this approach is still taken.

For adaptive streaming, the media is encoded at multiple bitrates and split into 5-second fragments with an I-frame at the start of each (e.g. x264enc –key-int-max={5 sec}; use voaacenc because the others suck; gss-transcoder does this for you). That way you can switch bitrate every 5 seconds. It can be written to separate files (then apache can serve them), or muxed into a single file with a custom server. There are a few variant “standards” for the manifest file and metadata that describes the stream, the levels and the fragments. The URLs are specified as a pattern. GStreamer has ismlmux for Microsoft Smooth Streaming, mp4mux for DASH, hlssink for HLS. You still have to create the manifest file – you’re on your own there. GSS does the fragmentation on-line and just uses a standard mp4 file.

Side note: MPEG DASH is a collection of all the variants that exist already and all possible combinations of them => at least 7 different variants. Therefore it’s a huge stack and nobody implements it completely, or even correctly. In DASH, you don’t access the fragment based on a timestamp but based on the byte range, so you need a mapping of timestamp to range. It also means that the CDNs have to be able to cache large files and process range requests on them.

GSS manages collections of H.264+AAC (the only thing that players support) streams for adaptive streaming. It creates manifests and fragments on the fly (i.e. when the HTTP request comes in), for the various formats (currently Smooth Streaming (ism), DASH). Content encryption and DRM headers are also added on the fly. GSS also handles content migration, i.e. it is possible to update a content file on the server while it is still being served. This is tricky because the caches in the CDN should also be invalidated; so update a version number in the manifest file, which automatically changes the URLs for the content (same technique can be applied to e.g. keys). The old content can only be removed once the CDN caches are completely cleaned, because there will still be HTTP requests coming from clients that use the old manifest file. The content is specified with a GSS-specific JSON-formatted manifest file in the content directory. Every directory corresponds to one “content”, but there can be multiple variants e.g. trailers.

Compared to serving using Apache, GSS has the advantage that you don’t need to generate the manifests and only need to store the content once for the various manifest formats. GSS is complementary to Adobe AMS because they handle different types of streams, from the same content source.

[David discussed the internals but I think that’s less interesting – use the source and/or look at the slides.]

To test, there is some demo content and then a large number of URLs are tested and verified if the correct manifest is returned. Since this content is cached, it must be bit-for-bit correct.

GSS does not contain a database of which streams are available – this is more appropriate for an application server. It is single threaded, i.e. handles only one request; this is not a limitation for David, except the first time some content is accessed because that takes a while.

The code is as of now available on

Video of this talk is at


2 responses to “Latest GStreamer Streaming Server features: Video on Demand, Smooth Streaming, and DRM – David Schleef (Rdio Inc.)

  1. Where can I watch the talk?

  2. Hi, I “landed” to your post by accident, but it looks quite interesting.

    At this moment I’m using (GPAC) Dashcast to stream live-content through DASH. It was the only tool I was aware of that could stream live DASH streams. From what I see in your presentation this gstream server can also create DASH live-streams. Doesn’t it?.
    I downloaded and compiled from Git but there is no documentation so I’m completely stuck trying to do a first test.

    Personally I would much more prefer to use something based on Glib/Gstreamer since I’m much more familiar with those libraries and GPAC stuff looks to me very “bloated”.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s