From 48fbefc9bd6da1c20e3f99d7d468505809efdbe4 Mon Sep 17 00:00:00 2001 From: Prime Date: Tue, 6 Jun 2023 18:22:30 +0330 Subject: [PATCH] fix getFFmpegVersion --- src/node_core_utils.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/node_core_utils.js b/src/node_core_utils.js index e4e217f9..3e4d0757 100644 --- a/src/node_core_utils.js +++ b/src/node_core_utils.js @@ -49,17 +49,18 @@ function verifyAuth(signStr, streamId, secretKey) { function getFFmpegVersion(ffpath) { return new Promise((resolve, reject) => { let ffmpeg_exec = spawn(ffpath, ['-version']); - let version = ''; + let result = ''; ffmpeg_exec.on('error', (e) => { reject(e); }); ffmpeg_exec.stdout.on('data', (data) => { try { - version = data.toString().split(/(?:\r\n|\r|\n)/g)[0].split('\ ')[2]; + result += data; } catch (e) { } }); ffmpeg_exec.on('close', (code) => { + const version = result.toString().split(/(?:\r\n|\r|\n)/g)[0].split('\ ')[2]; resolve(version); }); });