Have you ever looked at the price of Amazon's Elastic Transcoder? If you haven't I'll spare you the lookup - it's 3 cents (USD) per minute of vide...
For further actions, you may consider blocking this person and/or reporting abuse
Hi Harold, Thanks for the life saving post.Im a newbie to coding, I got stuck at the tweaking part that you're saying after extracting the ffmpeg directory. I couldnt change any ffmpeg parameters and also couldnt find where the compressed files are going. Can you help me with that?
That's handled by the script that actually calls ffmpeg. So, in this case, all I'm really after is to change codecs/container formats, so I just have the script/program that calls it do the output options. It never changes, so I can hard code most of the options, but you can also set it dynamically depending on your needs.
You'll need to download the file to /tmp, and also transcode it to their. This introduces the big issue with this setup - large files will fail, plainly.
Coding our function:
Can you give the code too? We are struggling on this
I can't yet, but I can give you the basics of it (the details are dependent on language, but the general gist):
1) Receive the lambda message and use the details to download the input file
2) Run ffmpeg with the options you need
3) Upload the file to S3
Hi Harold:
Thank you for your great instrutions.
As I know, it is only 512MB for the /tmp directory, so you save the video in the memory?Does it take much time for downloading video from S3, and how you speed it up?
Thanks again!
If I missed anything, please do mention it so I can update it.
Hey Harold, Thank you for your great instructions, does it mean that the Lambda limitation will unable to encode full length film? e.g. feature film of 1hour and 45mins or longer for example?
Thanks again!
Yeah, that's the big downside. It can't really do that. In fact, I found out that anything with loads of motion will break, because it only has so much room. But it's pretty good for the things we really need it for.
New to Layers -- how do I import / reference the ffmpeg layer from within Lambda?
Ah! My apologies - from within the function page, under "Designer", immediately under the function you should see a layers button. Everything you need is in there.
I'd like to know how you overcome errors like 'moov atom not found', which I find very often in my process; I'm doing a similar job, but I'm using node.js in my case
Unrelated question but have you found transcoding video to be especially slow with Node on Lambda? Harold mentioned a 10 minute video taking 105 seconds. I have a 30 second video that's taking over a minute to transcode. On my local system it takes seconds...
If you're doing it using ffmpeg, it should be about the same across any runtime.
Are you accounting for the time to download, etc? Also, it will always run faster on a local machine with real resources behind it, and the videos I'm transcoding are going to be relatively low-motion by nature.
That sounds like something specific to node. Not terribly familiar, unfortunately.
Hi Harold,
Thanks for the article!
Curious if you have a repo where we could check out the function code?
Cheers
I don't anymore (I've since left this job). Another comment has the basic structure, though!
This is just what I was looking for. Thank you for publishing this.