Skip to content

Commit

Permalink
Merge pull request #591 from primemb/master
Browse files Browse the repository at this point in the history
fix getFFmpegVersion
  • Loading branch information
illuspas authored Dec 14, 2023
2 parents bfcff34 + 48fbefc commit fa8c2e2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/node_core_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
Expand Down

0 comments on commit fa8c2e2

Please sign in to comment.