From cf9f168bce2083c55b3c8d6b5aaea4afff0ecf79 Mon Sep 17 00:00:00 2001 From: fanxb Date: Sun, 4 Dec 2022 15:58:17 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=AE=8C=E5=96=84=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 709040d..a2f7ad5 100644 --- a/index.js +++ b/index.js @@ -21,7 +21,7 @@ function saveFile () { if (fs.existsSync(cachePath)) { cache = JSON.parse(fs.readFileSync(cachePath, 'utf-8')); } - await deal("Z:\\userData\\视频\\电影", 2500, true, "cuda"); + await deal("Z:\\userData\\视频", 2500, true, "cuda"); if (timer) { clearInterval(timer); } @@ -81,8 +81,12 @@ async function deal (basePath, maxBitRate = 2500, changeName = false, hardType) continue; } let is10Bit = res.streams.filter(item => item.bits_per_raw_sample === '10').length > 0; - bitRate = Math.round(parseInt(bitRate) / 1000); - bitRate = bitRate > maxBitRate * 2 ? maxBitRate : bitRate / 2; + let originBitRate = Math.round(parseInt(bitRate) / 1000); + bitRate = originBitRate > maxBitRate * 2 ? maxBitRate : originBitRate / 2; + if (bitRate < 1000) { + bitRate = originBitRate * 0.75; + } + let newName = null; replaceTextArr.forEach(item => { if (newName == null && name.indexOf(item) > -1) {