fix:保留全部数据流

This commit is contained in:
fanxb 2022-12-05 11:11:20 +08:00
parent cfd7162a27
commit 1baeb09d5c

View File

@ -21,7 +21,7 @@ function saveFile () {
if (fs.existsSync(cachePath)) { if (fs.existsSync(cachePath)) {
cache = JSON.parse(fs.readFileSync(cachePath, 'utf-8')); cache = JSON.parse(fs.readFileSync(cachePath, 'utf-8'));
} }
await deal("Z:\\userData\\视频", 2500, true, "cuda"); await deal("Z:\\userData\\视频", 3000, true, "cuda");
if (timer) { if (timer) {
clearInterval(timer); clearInterval(timer);
} }
@ -95,7 +95,7 @@ async function deal (basePath, maxBitRate = 2500, changeName = false, hardType)
newName = name.substr(0, index) + ".h265" + name.substr(index); newName = name.substr(0, index) + ".h265" + name.substr(index);
} }
let newFilePath = path.join(basePath, newName); let newFilePath = path.join(basePath, newName);
let cmdStr = `ffmpeg.exe ${hwType} ${is10Bit ? "" : decodeType} -i "${filePath}" ${encodeType} -maxrate ${bitRate}K -c:a copy -y "${newFilePath}"`; let cmdStr = `ffmpeg.exe ${hwType} ${is10Bit ? "" : decodeType} -i "${filePath}" -map 0 ${encodeType} -maxrate ${bitRate}K -c:a copy -c:s copy -y "${newFilePath}"`;
console.log(cmdStr); console.log(cmdStr);
let cmdRes = await cmd.exec(cmdStr); let cmdRes = await cmd.exec(cmdStr);
let index = cmdRes.stderr.indexOf("video:"); let index = cmdRes.stderr.indexOf("video:");