0

i'm new to AWS-Lambda and trying to create thumbnail with ffmpeg and nodejs.

if i test it in vscode nodejs at my local computer, i get thumbnail in 2 seconds.

but if i test it at AWS lambda executing ffmpeg from layer with spawnSync,

it takes around 7~9 seconds only for executing ffmpeg to create thumbnail.

how can i lower lambda duration time?

may i get some advice?

@@ lambda ffmpeg code

ffmpeg params = (videoPath, imagePath) => [ "-ss", 0, "-i", videoPath, "-frames:v", 1, "-vf", "thumbnail,scale=150:100", imagePath ] spawnSync(ffmpegPath, ffmpegParams(videoPath, imagePath))

lambda max memory used was aroud 740MB

1 Answer 1

1

You can try lowering the lambda execution time by adding more RAM to it.

See: AWS Lambda Memory Vs CPU configuration

Sign up to request clarification or add additional context in comments.

2 Comments

okay, i increased RAM 1024MB to 3010MB and it took 3 seconds. but Report says its Max Memory Used is 740MB. i guess i can't use this expensive lambda for my current project and might as well switch to EC2 for this logic...
@ryeong928 You pay for memory/seconds, which means 1s / 512 MiB would cost you the same as 2s / 256 MiB. Try benchmarking the lambda to figure out the least amount of resources you need for the application to perform smoothly (whatever that might be). You may find that the performance doesn't scale linearly, and that it's in fact cheaper to allocate more resources.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.