Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.1k views
in Technique[技术] by (71.8m points)

express - full m3u8 clip isn't getting generated from m3u8 file by node.js

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...