August 21, 2023 (6 months ago)

Faster video processing and cost controls with Mux's Upload SDKs for iOS and Android

Dylan Jhaveri
By Dylan Jhaveri5 min readProduct

Mux already has SDKs to help you upload videos on the web:

And now, we have iOS and Android SDKs to tell you about. iOS and Android environments give us a lot more tools to work with, which means we’re able to bake some functionality into these platforms that we can’t get so easily in browsers.

LinkTLDR:

Mux now has upload SDKs in public beta for iOS and Android. See more here:

These SDKs are meant to be used with the Direct Uploads server-side API. Create an upload URL server-side, pass the URL to the client, and upload from the client directly to Mux. After the upload is complete, Mux creates a new asset and sends you webhooks to notify you when the asset is ready.Unlike browsers, iOS and Android environments allow us to process the video before uploading in order to minimize processing time by standardizing the input file. They also give you an option to control the resolution of the uploaded file to take advantage of resolution-based pricing.

LinkFirst, the basics

Uploading small video files is fairly easy. You can PUT the full file to a Direct Upload URL as described here.

For larger files, things get a bit more complicated — especially on mobile devices with variable, flakey network connections. We talked to a number of customers who had to implement something like UpChunk on their mobile platform of choice. Anytime our customers are having to re-implement the same solution in their applications, we see an opportunity to do some of that hard work for them.Mux Uploader for iOS and Android handles the complexity of file chunking and retrying failed chunks for you, maximizing your chance of every upload succeeding.

LinkBeyond the basics: not just a file uploader

As we interviewed customers and heard more about their uploading pain points, we heard about another issue. For the vast majority of videos, Mux is blazingly fast at processing them. And by blazingly fast, I’m talking about 100x faster than competitors. This is due to our proprietary just-in-time transcoding technology. When you upload a video, you might think it’s fully processed when we tell you it’s ready. If you start playing the HLS video, you will get the playlists and the segments when you request them. But here’s the thing: with just-in-time Transcoding, Mux DOESN’T actually have all those segments created when we tell you your asset is ready.

There is one catch with our 100x-faster processing time. It’s only super fast if the video file meets our standard input guidelines. Note that these guidelines are constantly expanding and evolving to encompass a wider surface area of inputs.

So that brings us back to you, a mobile application developer using Mux to build an app that allows users to upload videos. The pesky thing about these users is that they tend to upload any kind of videos they want, which is incredibly inconvenient when you’re trying to conform to Mux’s standard input guidelines. Before today, you had 3 options:

  1. Live with slower processing times when necessary. Whenever a user uploads a nonstandard video, you can accept the fact that it’s going to be a while before it’s ready (and "a while" is relative, but we’re talking minutes instead of seconds). You might be okay with this, but it’s not ideal in our book.
  2. Tell the user to give you a standard input. Imagine this alert: "sorry your video sucks, can you edit it and make sure it conforms to: Max 20 second keyframe interval, closed GOP, 8Mbps bitrate or less…" You see where I’m going with that, and it’s a non-starter.
  3. Try to standardize the input in your application. You, the application developer, can go ahead and grok Mux’s standard input specs and make all the adjustments to the video source on the client to conform the video to these specifications. That sounds like a lot of work, right?

Indeed, number 3 is a lot of work. But we’ve done that work for you. With Mux’s Upload SDKs on iOS and Android, videos will be standardized by default. That means we do the processing on the client, which results in a maximally quick processing time on the server so your videos are ready to play faster. You can skip this step if you like, but we think it’s a smart default.

LinkControlling costs with resolution-based pricing

The other benefit we baked into the iOS and Android Upload SDKs is the ability to control costs with resolution-based pricing. Recently, Mux lowered prices across the board for resolutions of 720p or less. This applies to storage, encoding, and streaming. If a user uploads an HD video, you can lower your streaming costs by configuring your player to stream no higher than the 720p resolution with the max_resolution=720p parameter, but you’d still be paying to encode and store the higher-resolution video. Now, with the Upload SDKs, you can control the resolution on the client so that the video gets processed down to the max-720p size, which will lower your ingest & storage bill.

LinkCurrently in public beta

These SDKs are currently in public beta. We’d love for you to try them out and let us know what you think. We anticipate a relatively short beta period and hope to move them to GA within the next couple months.

View the guides:

If you run into any issues, please report them on Github so we can address them!

Written By

Dylan Jhaveri

Dylan Jhaveri – Director of Self Service

Software Engineer and cold water surfer. Previously startup co-founder. Trying to find the best cheeseburger in San Francisco.

Leave your wallet where it is

No credit card required to get started.