Download your own mux.com asset again

Table of contents

Sometimes you may want to download assets again that you previously uploaded to the video platform Mux.com. Since I couldn’t find any other similar guide online that explains the process of downloading them, here’s a quick summary: "How do I actually download a MUX asset again as an .mp4 file?" Because Mux.com itself does not offer a direct download option (like YouTube, for example).

First, you need to generate a new API key at MUX; you can do this under "Settings" -> "Account Token".

The key, together with the known asset ID (which can be found directly in the asset view in Mux), is then sent to the Mux.com API using

curl -u YOUR_API_KEY:YOUR_API_SECRET  https://api.mux.com/video/v1/assets/YOUR_ASSET_ID

In return, you’ll get the video metadata in JSON format, which contains the playback ID. This (e.g. rd6jk82GS3D4eA6dNbTUNQpH4IoH46mqgasaN2tQ4Sg) is now the missing piece of information that, together with FFMPEG, leads to the original video file:

ffmpeg -i https://stream.mux.com/PLAYBACK-ID.m3u8 -c copy output2.mp4

This saves the video from Mux in its original quality as output.mp4.

Ta-da!

And the video gets downloaded :)

Info: If you integrate MUX into a Strapi instance, for example, you can often already see the playback ID directly in the asset details and can skip the API request.