An API to Video: Why Abstraction Matters

This is the third in a series of blog posts about Mux Video. The first, Video is Too Hard, outlined the problem. The second, Announcing Mux Video, announced the new product.


Abstractions are important.

Software is all about abstractions. Object-oriented programming and functional programming abstract away elements of lower-level computing. The OSI model describes networking as seven abstraction layers. Video.js is an abstraction on top of HTML5 video.

Think of it this way: abstractions hide complexity. An abstraction that hides more levels of complexity is "higher-level" than one which hides fewer levels of complexity. Higher level abstractions can be more powerful and drive more productivity, but run the risk of being too inflexible. Lower-level abstractions are more flexible but don’t introduce as much power or efficiency.

Abstraction Level

AWS won because of its abstraction level. Google App Engine was (and is) an amazing piece of technology, but the abstraction level was too high for most people. Rackspace offered on-demand computing for years before AWS appeared, but the abstraction level was too low to be as productive as EC2 and S3.

What does this have to do with video?

Today, if you want to build software around video, you have to use an abstraction level that is too low. Instead of building software about the concept of video, you have to build software that manages files, asynchronous jobs, and more.

Mux Video changes the abstraction level. Developers can build software directly around the concept of video, rather than building complex, specialized workflows around concepts like files and jobs. POST a video to Mux Video; GET back a playing video stream, or a thumbnail, or some metadata. That's it.

Without Mux Video, developers have to think about a dozen different nouns before they can think about video:

  • Asynchronous jobs (transcoding, thumbnailing, packaging, inspection)
  • Adaptive playlists (HLS and DASH) that describe the various ways in which a video is available
  • Video files, which are usually fragments of videos at different sizes (TS and fragmented MP4)
  • Distributed edge caches for content delivery
  • Ingest points for live video
  • And a dozen other things: text tracks (captions and subtitles), encryption keys, thumbnail files, storyboards, and more.

This is impractical and inefficient. Unless your company name literally starts with Yout---, Netfl--, or Facebo--, you shouldn't have to do this. (We're going to give you a pass, Netflorista.)

Here is an analogy. If you want to accept payments, is your first step to shop around for a bank, educate yourself on PCI compliance, negotiate relationships with Visa and AmEx, and hire a finance team to focus on currency exchange? Or do you look for an API that abstracts away this hard work and lets you build your software that accepts payments?

Video is similar...only harder. Take a look at this helpful AWS diagram that describes how to build a simple On Demand video streaming system that scales. (If you care about optimizing performance or live video, it's even more complex.)

AWS streaming architecture

The abstraction model behind this is broken. If you want to build a website or mobile app that publishes video, you shouldn't have to spend weeks building complex software before you see your first video play.

The goal of Mux Video is to abstract away this complexity so developers can worry less about which H.264 profile to use, or why users in Boston just saw elevated rebuffering, and instead worry about building their own software and creating happy users.

The primitive unit in Mux Video is a video asset - a playable bit of media. (We'd call it a "video," but we care about audio too.) POST a video (or audio track) to https://api.mux.com/video/v1/assets, and we'll take care of the rest. GET that asset from https://stream.mux.com/{id} and watch it play on almost any device.

It seems simple, but there is a lot going on under the hood - far more than the basic AWS diagram above. Mux Video improves video quality, time to publish, and streaming performance through optimizations like per-title encoding, just-in-time processing, and delivery optimization across multiple CDNs.

The abstraction level is one of the most important elements of any software system. After ten years of building video infrastructure, we're excited to introduce an API that finally lets developers focus on video when they work with video.