I have a quick question, I'm trying to do a cloud video editor, and i want to be able to cut out video usng nodejs.
I'm using fluent-ffmpeg. Here is my code :
const cutVideo = async (sourcePath, outputPath, startTime, duration) => {
console.log('start cut video');
await new Promise((resolve, reject) => {
ffmpeg(sourcePath)
.setFfmpegPath(pathToFfmpeg)
.setFfprobePath(ffprobe.path)
.output(outputPath)
.setStartTime(startTime)
.setDuration(duration)
.on('end', function (err) {
if (!err) {
console.log('conversion Done');
resolve();
}
})
.on('error', function (err) {
console.log('error: ', err);
reject(err);
})
.run();
});
};
It's working but not optimal, and as soon as i try to edit to a long video (getting 10 min from a video instead of 1 min out) it's super long.
What i understand is that ffmpeg re encode everything, so that's why the longer the edit is the longer the process will. Is there way to cut out using node-fluent-ffmpeg without re encoding everything ?
Thanks to the community !