feat:增加文件校验

This commit is contained in:
fanxb 2022-11-06 19:50:51 +08:00
parent 10d1755437
commit 612677195e

View File

@ -38,10 +38,15 @@ async function deal (basePath) {
let index = name.lastIndexOf('.');
newName = name.substr(0, index) + ".h265" + name.substr(index);
}
let cmdStr = `ffmpeg.exe -hwaccel cuda -c:v h264_cuvid -i "${filePath}" -c:v hevc_nvenc -maxrate ${bitRate}K -c:a copy "${path.join(basePath, newName)}"`;
let newFilePath = path.join(basePath, newName);
let cmdStr = `ffmpeg.exe -hwaccel cuda -c:v h264_cuvid -i "${filePath}" -c:v hevc_nvenc -maxrate ${bitRate}K -c:a copy "${newFilePath}"`;
console.log(cmdStr);
let changeRes = cmd.execSync(cmdStr, { encoding: 'utf-8' });
console.log(changeRes);
if (!fs.existsSync(newFilePath)) {
console.log("未知错误,文件转换失败");
return;
}
//字幕nfo文件重命名
let namePart1 = name.substr(0, name.lastIndexOf('.'));
let newNamePart1 = newName.substr(0, newName.lastIndexOf('.'));