Use cases and limitations
Serverless code functions definitely can have a place in video transcoding, but because of the much heavier processing it demands, the use cases are very different.
Use cases
Transcoding short videos to small resolutions (<1min @ 480p, or shorter)
If you need to transcode fairly short videos to small sizes, serverless code functions can do the job. You need to consider how important the video quality and filesize are to your use case, as transcoding videos using the x265 codec takes a much longer time than using the x264 codec.
For reference, I tested transcoding a 58 second video to 480p, and it took AWS Lambda 144 seconds to transcode it with x265 using the medium preset, and 9.7 seconds with x264 using the ultrafast preset. It's a huge difference in both time and cost, if the filesize is not important to you.
Limitations
Computation power limits
Transcoding videos is an extremely computation-heavy task:task. comparedCompared to images, where your serverless code might take at most a few seconds to finish even for large resizes, transcoding videos - even small ones - can take minutes!minutes for a serverless code function with some codecs!
This presents a problem: if you want to transcode a long video, for example a 10-minute video, you maywill almost certainly reach the maximum execution duration allowed by your cloud function provider. AWS Lambda has a maximum execution time of 15 minutes per function invocation: anything that takes longer than this will be forcibly terminated.
If you're using x265/HEVC as your video codec, longanything other than very short videos being resized to more than 480p will cause your cloud function to time out,out noin mattermost what you docases - it is too heavy a task for your cloud function to perform. TheOn onlytop realisticof optionthat, leftwaiting isseveral tominutes isn't something most users will like, which limits the use acase dedicated transcoding service.
Dedicated transcoding services
Most cloud providers have some form of transcoding service. AWS has Elemental MediaConvert, which lets you run "jobs" to transcode videos to different sizes, and provides an absolute ton of options.
Pros
The dedicated service will be able to handle any task you throw at it, no matter how bigAs it has access to more powerful hardware, it will finish transcoding a lot faster
Cons
It's a lot more expensive than using serverless code (forx265/HEVC,thisit'll cost around400-500%more!)It's harder to set up an automated system around it
Admittedly, the pros and cons are a bit of a moot point, as there aren't any other serious ways to transcode videos that your serverless code function can't handle, short of trying to administer your own cluster of servers, which is best left to huge companies making their own in-house processing solutions.somewhat.