简体   繁体   中英

Concatenate Videos with node.js in AWS Lambda

Im wondering if it's possible to merge (concatenate) two video clips into one with an AWS Lambda function using Node.js?

The dependency that I was going to use is ffmpeg (or fluent-ffmpeg), but from what I can tell, all the APIs use the actual file path, not the file variables. I download the actual video files from an S3 bucket so I can't use the path's... can I?

I haven't found a single example that uses file variables. If there's a better way to do this that Im not thinking of, feel free to share! Thanks for the help as always.

I found a way around it! All I needed to do was save the object body from the item I get from S3 to a file on the local Lambda file system. Not sure why I didn't think of this in the first place. I ended up doing

fs.writeFile("out.mp4", item.Body, (err) => {
        if(err) console.log(err);
        console.log("Body saved!")
});

Hopefully this answer helps someone that comes across a similar mental block in the future.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM