问题描述
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)
.addOption('-level',3.0)
.addOption('-start_number',0)
.addOption('-hls_list_size',0)
.addOption('-f hls')
.on('end',function(err) {
if(!err) { console.log('conversion Done') }
})
.on('error',function(err){
console.log('error: ',err)
}).run();
这是我的 index.js 文件。我在终端上运行此命令以从另一个 m3u8 文件生成 m3u8 剪辑
node index.js 6 30 ./input.m3u8 ./output.m3u8
这里 6 是以秒为单位的开始时间,30 是持续时间。问题是m3u8剪辑创建的时候,第一个ts文件是这样的
它采用 kb 格式,而其他采用 mb 格式。因此,在播放 m3u8 剪辑时,前 3 秒什么也没有发生。我尝试使用不同的 m3u8 文件进行此操作,并且此问题仅在第一个 ts 文件中发生,并且只有 3 秒
这是 m3u8 演示文件的链接 https://mp4.to/downloads/0cb552cd749c4cf4b
关于如何解决这个问题的任何技巧?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)