Financial cost of video transcoding
Whether you're transcoding a given video using a serverless code function, or a dedicated transcoding service, you need to consider that it is almost invariably an expensive thing to do (in the context of a website).
CostsCost of using a serverless code functioncomparisons
If you're using a serverless code function to transcode videos, the chances are it will be for 480p or 720p versions of fairly short videos (anything else will be beyond what your serverless code function is capable of handling).
This option is undoubtedly cheaper by a considerable margin, but it is still very expensive when compared to e.g. image transcoding, due to the larger amount of processing time involved. Below are somea few reference figures I averaged from some testing,tested, as an example of the order of magnitude of difference involved.
File details | Resize to | Codec | Time to transcode | Cost | Cost increase vs previous entry | |
640x480 | JPEG | 2000ms | ~$0.00034 | N/A | ||
640x480 | x265/HEVC | 82000ms | ~$0.014 | + ~4000% | ||
640x480 | x265/HEVC | 24000ms | ~$0.028 | + 100% | ||
1280x720 | x265/HEVC | 29000ms | ~$0.056 | + 200% |
Transcoding one 1080p video to 480p costs roughly the same as transcoding 40 images to 480p, whilst transcoding that video to 720p costs roughly the same as transcoding 240 images to 480p. You can see how this grows to be a very large cost if you're transcoding a lot of videos, especially long ones.