UP | HOME

Video streaming

Video streaming is weird: it seems to be relatively common, I know at least a few people who worked on software for that (always wondered how come that there's no existing tools), and it's still tricky to set. Although the situation is similar with many other things: somehow there's not much of usable software, despite all the programming that is getting done; even XKCD #949 is still relevant.

I needed to read RTSP streams from IP cameras, making them available to web browsers via HTML5 Video, what gives 3 alternative container formats:

I'd ignore the first one completely if it wasn't the most widely supported by web browsers (particularly Safari and IE/Edge don't support anything else). As of software, there are:

I've ended up setting an icecast-based system. To make icecast only create streams on demand, using RTSP streams as source, one has to use hacks: either turn that RTSP stream into HTTP one somehow, and use it as an on-demand relay, or set pseudo-authentication (listener_add and listener_remove, to track when a source stream is needed), running and killing ffmpeg instances when needed. I did the latter, with another program updating and reloading icecast.xml, and it works – though duplicate users should be allowed for that, or it wouldn't be reliable. To support IE/Edge/Safari, there is ogv.js.

I guess that things would have been a bit nicer if we weren't using protocols designed for hypertext transfer to transfer video streams, along with the programs that are supposed to render hypertext documents, but are used to watch video; they may be not the best fit. Although it works, mostly, somehow.