From b9005cbe88575cbdef0b6da439ec9dd741bf05c4 Mon Sep 17 00:00:00 2001 From: fofolee Date: Tue, 25 Feb 2025 20:08:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BC=96=E6=8E=92=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E8=A7=86=E9=A2=91=E5=8A=9F=E8=83=BD=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E6=8F=90=E7=A4=BA=E5=8D=87=E7=BA=A7uTools?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/lib/quickcomposer/video/ffmpeg.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/plugin/lib/quickcomposer/video/ffmpeg.js b/plugin/lib/quickcomposer/video/ffmpeg.js index efb3ef7..bee3c07 100644 --- a/plugin/lib/quickcomposer/video/ffmpeg.js +++ b/plugin/lib/quickcomposer/video/ffmpeg.js @@ -1,3 +1,11 @@ +const checkFFmpeg = () => { + if (!utools.runFFmpeg) { + quickcommand.showSystemMessageBox("请先升级uTools到6.1.0及以上版本"); + return false; + } + return true; +}; + /** * 运行FFmpeg命令并显示进度条 * @param {string[]} args FFmpeg命令参数 @@ -11,12 +19,8 @@ * @returns {Promise} 返回Promise */ async function runFFmpeg(args, options = {}) { - if (!utools.runFFmpeg) { - quickcommand.showSystemMessageBox( - "请先升级uTools到6.1.0及以上版本" - ); - return; - } + if (!checkFFmpeg()) return; + const { text = "处理中...", position = "bottom-right", @@ -234,6 +238,8 @@ async function extractAudio(input, output, options = {}) { * utools接口目前好像有问题,无法结束录制 */ async function recordScreen(output, options = {}) { + if (!checkFFmpeg()) return; + const { fps = 30, overwrite = false } = options; const args = []; @@ -456,6 +462,7 @@ async function addWatermark(input, watermark, output, options = {}) { * @param {boolean} options.overwrite 是否覆盖已存在的文件 */ async function mergeVideos(inputs, output, options = {}) { + if (!checkFFmpeg()) return; const { overwrite = false } = options; // 先获取第一个视频的分辨率