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).
Costs of using a serverless code function
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 some reference figures I averaged from some testing, as an example of the order of magnitude of difference involved.
File details | Resize to | Transcoding method | Codec | Time to transcode | Cost |
Image (4000x2500 PNG, 10MB) | 640x480 | Lambda, 10240MB memory | JPEG | 2000ms | ~$0.00034 |
Video (1920x1080 MPEG-4, x264 encoded, 50 seconds long) | 640x480 | Lambda, 10240MB memory | x265/HEVC | 82000ms | ~$0.014 |
Video (1920x1080 MPEG-4, x264 encoded, 50 seconds long) | 640x480 | Dedicated transcoding service | x265/HEVC | 24000ms | ~$0.028 |
Video (1920x1080 MPEG-4, x264 encoded, 50 seconds long) | 1280x720 | Dedicated transcoding service | x265/HEVC | 29000ms | ~$0.056 |