am using ffmpeg with fluent-ffmpeg to get a thumbnail from a video like this
ffmpeg({
source: `../../uploadedVideo/${filepath}`,
}).takeScreenshots({
filename: "example.jpg",
timemarks: [2, 4, 6, 8],
folder: "../../thumbnail/",
});
but what i wanna do is instead of saving the thumbnail to a folder i wanna send it as an api response , here is the whole code.
const ffmpegPath = require("@ffmpeg-installer/ffmpeg").path;
const ffmpeg = require("fluent-ffmpeg");
ffmpeg.setFfmpegPath(ffmpegPath);
router.post("/upload", (req, res) => {
const file = req.files.video;
const filepath = `${uuid()}${path.extname(file.name)}`;
// imagine the file is saved to the server at this point
ffmpeg({
source: `../../uploadedVideo/${filepath}`,
}).takeScreenshots({
filename: "example.jpg",
timemarks: [2, 4, 6, 8],
folder: "../../thumbnail/",
});
res.send({ msg: "success", thumbnail });
});
Any help or suggestion will be appreciated.