Johannes Eiglsperger

8 mm Kodak film reel

Handling DASH manifests and VAST files with Go

2 min read

I published two new Go packages on GitHub to help multimedia streaming engineers to efficiently work with MPD and VAST files.

Go is an excellent choice for building multimedia streaming services at scale. I was looking for packages that supported the current MPEG-DASH specification (ISO/IEC 23009-1 5th edition) and the current VAST specification (VAST 4.2). At the time, there were only a few options, and they didn’t fully comply with the specifications, so I decided to build my own implementations.

I’m now releasing both packages to the open-source community:

Working with encoding/xml was particularly challenging, as it doesn’t support XMLNS prefixes. The MPD specification requires XMLNS prefixes to enable XLink and certain content protection attributes.

Fortunately, the community on GitHub is already working on a promising implementation. This implementation has passed the acceptance tests and should be fully compatible with the existing implementation in the Go standard library once it was merged.

The VAST specification is not as dependent on XMLNS prefixes as MPD. The official IAB VAST samples, on the other hand, trigger a second finesse with encoding/xml.

Consider the following example:

          <JavaScriptResource>
            <![CDATA[https://verificationcompany1.com/verification_script1.js]]>
          </JavaScriptResource>

After parsing JavaScriptResource, the value is:

\n            https://verificationcompany1.com/verification_script1.js\n          

The encoding/xml package merges CDATA sections with surrounding text. I couldn’t completely rule out all edge cases where this behavior might be expected, so I decided against implementing a custom encoding.TextUnmarshaler and instead added a note to README.md. I may reconsider this later.

Find go-mpd and go-vast on GitHub!

Header image source: Coyau via Wikimedia Commons, CC BY-SA 3.0