index.js
const ffmpegPath = require('@ffmpeg-installer/ffmpeg').path;
const ffmpeg = require('fluent-ffmpeg');
const process = require('process');
const args = process.argv.slice(2);
if (args.length !== 4) {
console.error('Incorrect number of arguments');
process.exit(1);
}
const startTime = args[0];
const timeDuration = args[1];
const inputFile = args[2];
const outputFile=args[3];
ffmpeg.setFfmpegPath(ffmpegPath);
ffmpeg(inputFile)
.setStartTime(startTime)
.setDuration(timeDuration)
.output(outputFile)
.on('end', function(err) {
if(!err) {
console.log('conversion Done')
}
})
.on('error', function(err){
console.log('error: ', err)
}).run();
I am running this command on the terminal to generate a clip from the m3u8 file
node index.js 00:00:10 46 ./path/sample.m3u8 ./path/output.m3u8
The main problem is that it is not creating a clip for more than 13 seconds. For example, the above command should generate a 46s clip but it is going near 13 seconds. So I don't get what is the issue. Any clip less than 13 works perfectly fine. Is there any way to fix that?
Here is a link to the m3u8 file https://mp4.to/downloads/0cb552cd749c4cf4b
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…