How to cut video at specific start and end times in ffmpeg on Node JS?
I want to cut a video at a specific start and end time and save it. I can copy the full video, but I cannot figure out how to cut a specific time of this video using Node JS.
Video copy code:
ffmpeg('public/'+req.body.video)
.on('end', function(err) {
if(!err)
{
console.log('Done');
}
})
.on('error', function(err){
console.log('error: '+err);
callback(err);
}).run();
+3
source to share
1 answer
I found a solution. Here he is:
var ffmpeg = require('fluent-ffmpeg');
ffmpeg('public/'+req.body.video)
.setStartTime('00:00:03')
.setDuration('10')
.output('public/videos/test/test.mp4')
.on('end', function(err) {
if(!err)
{
console.log('conversion Done');
}
})
.on('error', function(err){
console.log('error: ', +err);
}).run();
+6
source to share