binoculars / aws-lambda-ffmpeg

An S3-triggered Amazon Web Services Lambda function that runs your choice of FFmpeg 🎬 commands on a file 🎥 and uploads the outputs to a bucket.
The Unlicense
872 stars 104 forks source link

Handle multiple output files #47

Closed merkinron closed 3 years ago

merkinron commented 7 years ago

Hey,

Is there a way of changing the FFMPEG_ARGS in a way that we will be able to create in the output bucket different videos of different types? I tried to change the code directly in aws lambda service and this is the code i'm trying to use (taken from #37 ):

-c:a copy -vf scale='min(320\,iw):-2' -movflags +faststart -metadata description=http://my.site/$KEY_PREFIX_320.mp4 out_320.mp4 -vf thumbnail -vf scale='min(320\,iw):-2' -vframes 1 out_320.png -c:a copy -vf scale='min(640\,iw):-2' -movflags +faststart -metadata description=http://my.site/$KEY_PREFIX_640.mp4 out_640.mp4** -vf thumbnail -vf scale='min(640\,iw):-2' -vframes 1 out_640.png

Eventually it is overwritten by the original FFMPEG_ARGS and outputs the $KEY_PREFIX.mp4 and $KEY_PREFIX.png.

Do i need to modify the code of the lambda fucntion? or is there a way to overcome this using the arguments? and a more general question is it valid to change the values of the environment directly on aws lambda service?

Thanks again for the help:)

binoculars commented 7 years ago

I've been trying to think of a good, generic way to do this, but for now it's just modify the code.

You can modify the Lambda function's environment variables, directly in the console or through the CLI, but it might not be there if you deploy it later if you modify the CFN template or its parameters.

merkinron commented 7 years ago

on the same issue. is there a way to output types other than mp4? like for example if i would like to output hls file with extension m3u8?

thanks, ron

binoculars commented 7 years ago

I'd try setting the FFMPEG_ARGS to something like this: https://stackoverflow.com/a/33152860/859747 e.g. -g 60 -hls_time 2 out.m3u8

pvsousalima commented 7 years ago

@merkinron @binoculars I am having the same issue, were you able to fix it or have any solution for encoding to this and handling multiple files? I'm trying to convert mp4 into his using ffmpeg args but it looks like the args are being overwritten... ty!

aniketgundecha2002 commented 5 years ago

@binoculars - thank you for the great library @merkinron - were you able to set multiple output files? i'am able to send the m3u8 file to s3 destination bucket but not the ts files.. ty!