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 invariablyoften an expensive thing to do (in the context of a website).
Cost comparisons
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 than dedicated transcoding 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 a few reference figures I tested, as an example of the order of magnitude of difference involved.
Table Notes
- The Lambda function is assigned 10240MB of memory, i.e. it is running on the maximum CPU power available to it.
- The cost of transcoding is based on execution time for Lambda, and based on the video runtime for MediaConvert, per AWS' pricing structure for each service.
File details | Resize to | Method | Codec | Time to transcode | Cost | Cost increase vs previous entry |
4000x2500 PNG, 10MB | 640x480 | Lambda | JPEG | 2000ms | ~$0.00034 | N/A |
1920x1080 x264 video, 50s | 640x480 | Lambda | x265/HEVC | 82000ms | ~$0.014 | + ~4000% |
1920x1080 x264 video, 50s | 640x480 | MediaConvert | x265/HEVC | 24000ms | ~$0.028 | + 100% |
1920x1080 x264 video, 50s | 1280x720 | MediaConvert | 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.