接上篇
const cp = require("child_process");
async insertAssByVideo(that,assd,output){
cp.exec(that.ffmpegPath+"ffmpeg.exe -i "+that.filePath+" -vf ass='"+assd
+"' -f mp4 "+output,function(err,stdout,stderr){
if(err){
console.info(err);
}
console.info(stdout,stderr);
});
},
这里使用ffmpeg写入ass文件,filePath是视频文件路径,assd是字幕文件,output是输出文件路径,这里如果不使用vosk也可以直接用ass路径(绝对路径下,使用\解析盘符,例:'D\://video0.ass'),