I am working on thumbnail creation with ffmpeg. I have successfully created thumbnail for uploaded video on AWS.
For upload video/videos I have flow like:
I have one API used for multiple type file uploading. Also I have used upload.array to pass multiple file at the same time.
This API is called by Front-end developers to get the Uploaded files detail: Response of that API is like: `
{ "success": true, "message": "Files uploaded successfully", "data": [ { "fileName": "1628503061631.mp4", "mimeType": "video/mp4" } ] }
This file name I receive in request.body whenever Edit/Add Post media API will be used also it will be stored in DB table too.
I have configured ffmpeg as per this tutorial: https://www.youtube.com/watch?v=8vue0_vs2AI
The problem I am facing is, I am not able to upload thumbnail along with video upload
After video is uploaded in S3, that time only I am able to get its location and I create thumbnail from that.
Is there any way to give AWS S3 path direct to the second argument of the Thumbnail function?
const ffmpegPath = require('@ffmpeg-installer/ffmpeg').path;
const ffmpeg = require('fluent-ffmpeg');
ffmpeg.setFfmpegPath(ffmpegPath);
var ffprobe = require('ffprobe-static');
ffmpeg.setFfprobePath(ffprobe.path);
...
ffmpeg({ source: req.files[k].location })
.on('filenames', (filenames) => {
console.log("Created file name", filenames);
})
.on('end', () => {
return res.status(200).json({ success: true, message: "Files uploaded successfully", data: uploadedMedia })
})
.on('error', (err) => {
console.log("Error", err);
})
.thumbnail({
filename: 'thumbnail_' + req.files[k].key.split('.')[0],count: 1
}, './uploads/thumbnails/<<HERE I WANT TO ADD S3 path');