2 Nov 2017

[Blog] DTSC: MistServer's internal media format

Hey everyone, this is Jaron again, and it's time for another blog post! This time I'm going to dedicate some time to our internal media format, DTSC.

DTSC stands for "DDVTech Stream Container", and is the format MistServer internally converts all inputs into. The outputs then read this format and convert it to whatever they are supposed to output to the end-user. Doing things this way, allows us to generically write outputs and inputs without needing to know which of each will be available in advance. It's one of the biggest reasons why MistServer is so modular, and why we have been able to add inputs and outputs so regularly.

DTSC itself is a container/transport format taking inspiration from the FLV, JSON, MKV and MP4 formats. It tries to take the good parts of those formats without making anything overly complicated. It's packet-based, with a (repeatable) header that contains initialization and seeking information. All packets are size-prepended, and the data format is based on a simplified form of binary JSON. These properties allow DTSC to be both used as a storage format on disk and as a transport format over networks.

We're planning to release the DTSC specification as well as a sample implementation as public domain in the near future, because we see possibilities in replacing RTMP with DTSC for live ingest purposes in the long term. (On that note: if you are interested in contributing to or discussing the possibilities of the DTSC specification, please contact us!)

Besides the internal use (which only usually exists in RAM and is never written to disk at any point), DTSC is used by MistServer in two more places: our header files (the .dtsh files you may have noticed appearing alongside your VoD assets) and by the DTSC Pull input.

When MistServer's various inputs read a VoD file from storage, they generate a DTSC header and store it beside the original file as a .dtsh file. On future accesses to the file, this header is used to speed up loading from the file. It can safely be deleted (and will regenerate the next time the file is accessed) and will auto-delete if the format changes because of MistServer updates (for example, the upcoming 2.13 update will add a new optional field, and thus force a regenerate of all headers so the new field will show up). This file helps us provide a consistent speed across all media storage formats, and provides an index for files that normally do not have an index, such as TS files.

The DTSC Pull input allows you to pull live streams from other MistServer instances, using DTSC as the transport. This means it is a live replication and distribution format that is compatible with an unlimited number of tracks/qualities and works for all codecs. Unfortunately, MistServer is the only software (at time of writing) that has implemented DTSC as a streaming input/output format, so you can only take advantage of DTSC distribution between MistServer instances (for example, for load balancing live streams). There are plans to also make DTSC usable for VoD distribution in the near future.

Hopefully this article helped shed some light on MistServer's internal processes regarding file formats and replication. Next time, my colleague Erik will write about our upcoming scheduled play-out system!