Skip to main content

The execution flow for image and video transcoding

In basic form, the way both image and video transcoding is implemented involves using 'serverless' cloud functions. This doesn't mean an eldritch horror creature performs them, but simply that you don't have a dedicated server waiting to run them; you request to run your function on demand, and then the service provider allocates a server to run it.

Reasons you don't want to be transcoding media on your webservers

CPU Load

Webservers are poorly suited to handle heavy processing tasks. They are there to serve web traffic, not perform image transformations - handling image transcoding there will slow a website down very quickly. They won't be able to handle video transcoding at all.

Available code libraries and performance

Webservers often do not have efficient libraries for transcoding media efficiently or quickly. A common example of an image manipulation library on webservers is Imagick, which is not regarded as particularly efficient.

Concurrency and scaling

Using cloud functions allows for transcoding a given file to many different sizes concurrently, reducing the time needed to finish creating each one. You can't really do this with webservers, and certainly not in a way that won't impact performance.

The basic execution flow for media resizing

The basic execution flow looks like this.

image.png

It's the same for videos, but with a longer processing time, and with some additional considerations that need to be factored in due to the larger amount of computing power required to transcode them.