Skip to main content

Options for implementing image and video transcoding

When it comes to resizing and re-encodingtranscoding media, you have two main options you can choose from in terms of how to implement it: using a premade solution, or doing it yourself. There are merits to either approach.approach, but don't try the DIY approach unless you know what you're doing.

Option 1: Using a premade solution

Some cloud providers offer a built-in image resizingtranscoding solution (for example, as part of their CDN offering). While this is convenient, it also has a lot of pitfalls and downsides that need to be considered.

Pros
  • No coding effort required to implement
  • Won't require any active maintenance from your developers or yourself
  • Doesn't present any issues if you decide to move to another provider later on
Cons
  • Likely to cost more and be less efficient at compression
  • Some resizing tools don't allow you to specify important parameters, like chroma subsampling, and do not let you choose an encoder to use (which can matter a lot for e.g. JPGs)
  • Usually involves lazy 'on-demand' resizing, which isn't always desirable

Option 2: Doing it yourself

Implementing image and video resizingtranscoding yourself isn't easy, but can be well worth the pain.pain provided it's done correctly.

Pros
  • Allows much better control and customisation of how the media is resized and re-encodedtranscoded
  • Lets you resize proactively
  • Will generally result in better filesizes and qualityquality, reducing your CDN costs
  • Will cost less to resize a given number of images compared to a premade solution
Cons
  • A lot more effort than using a pre-built solution, both implementing it and maintaining it
  • More effort involved if you migrate to another provider, since you'll have to move your code over as well, which may need some tailoring for the new provider's infrastructure/APIs
  • Isn't going to perform well unless you use the correct libraries
  • Requires knowledge of imagemedia formats and encoders for bestgood results