While doing research for the project COSYN(2), several tools for creating, testing and debugging adaptive bitrate streaming files were developed. Thanks to these tools audio and video streams provided on the Internet can elegantly and dynamically be adapted to the users’ needs. Since these tools - a segmenting tool and a few parser scripts - might be useful for other people, we decided to open source them.
Most HTTP adaptive streaming protocols have the same basic construction. The audiovisual material is encoded multiple times, each with a different bitrate or quality. The resulting streams are chopped into pieces of approximately equal duration (typically somewhere between 2 and 10 seconds each). Each piece of each quality has its own URL and hence is individually accessible. With this information, the client can navigate through the different available qualities, usually starting with the lowest bitrate to assure a fast start. If the network, cpu, ... allows, the client can switch to higher bitrates.
The segmenting tool splits the input stream into multiple output files, according to Apple’s version of the adaptive streaming protocol (IETF-draft). The segmenter code compiles into four binaries, each using a different splitting algorithm: ByteCount, MP3, ADTS (AAC) and MpegtsH264. Apart from ByteCount, they all try to split every N seconds, keeping the file structure in mind: i.e. ADTS will cut on frame boundaries; MpegtsH264 will cut on GOP boundaries. The segmenting tool also supports Live-stream-mode and encryption.
Furthermore a few parser scripts were developed which can be used to convert binary formats into “human” readable formats. It’s by no means an easy read, but these tools have saved us many hours of watching hexdumps.
The tools can be found on GitHub.