[mirotalksfu] - autodetect default ffmpegPath for Rtmp streaming

هذا الالتزام موجود في:
Miroslav Pejic
2025-01-16 10:52:19 +01:00
الأصل e2d05a8f56
التزام 5598bf99c4
10 ملفات معدلة مع 81 إضافات و12 حذوفات

عرض الملف

@@ -2,9 +2,30 @@
const { PassThrough } = require('stream');
const ffmpeg = require('fluent-ffmpeg');
const ffmpegPath = '/usr/local/bin/ffmpeg'; // /usr/bin/ffmpeg (Linux) | /usr/local/bin/ffmpeg (Mac)
const os = require('os');
const platform = os.platform();
let ffmpegPath;
switch (platform) {
case 'darwin':
ffmpegPath = '/usr/local/bin/ffmpeg'; // macOS
break;
case 'linux':
ffmpegPath = '/usr/bin/ffmpeg'; // Linux
break;
case 'win32':
ffmpegPath = 'C:\\ffmpeg\\bin\\ffmpeg.exe'; // Windows
break;
default:
ffmpegPath = '/usr/bin/ffmpeg'; // Centos or others...
}
ffmpeg.setFfmpegPath(ffmpegPath);
console.log('FFmpeg', { platform, ffmpegPath });
class RtmpStreamer {
constructor(rtmpUrl, rtmpKey) {
this.rtmpUrl = rtmpUrl;

عرض الملف

@@ -2,9 +2,30 @@
const { PassThrough } = require('stream');
const ffmpeg = require('fluent-ffmpeg');
const ffmpegPath = '/usr/local/bin/ffmpeg'; // /usr/bin/ffmpeg (Linux) | /usr/local/bin/ffmpeg (Mac)
const os = require('os');
const platform = os.platform();
let ffmpegPath;
switch (platform) {
case 'darwin':
ffmpegPath = '/usr/local/bin/ffmpeg'; // macOS
break;
case 'linux':
ffmpegPath = '/usr/bin/ffmpeg'; // Linux
break;
case 'win32':
ffmpegPath = 'C:\\ffmpeg\\bin\\ffmpeg.exe'; // Windows
break;
default:
ffmpegPath = '/usr/bin/ffmpeg'; // Centos or others...
}
ffmpeg.setFfmpegPath(ffmpegPath);
console.log('FFmpeg', { platform, ffmpegPath });
class RtmpStreamer {
constructor(rtmpUrl, rtmpKey, socket) {
(this.socket = socket), (this.rtmpUrl = rtmpUrl);