[mirotalksfu] - autodetect default ffmpegPath for Rtmp streaming

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

عرض الملف

@@ -1,7 +1,8 @@
'use strict';
const config = require('./config');
const ffmpegPath = config.server.rtmp && config.server.rtmp.ffmpeg ? config.server.rtmp.ffmpeg : '/usr/bin/ffmpeg';
const ffmpegPath =
config.server.rtmp && config.server.rtmp.ffmpegPath ? config.server.rtmp.ffmpegPath : '/usr/bin/ffmpeg';
const ffmpeg = require('fluent-ffmpeg');
ffmpeg.setFfmpegPath(ffmpegPath);

عرض الملف

@@ -3,7 +3,8 @@
const config = require('./config');
const { PassThrough } = require('stream');
const ffmpeg = require('fluent-ffmpeg');
const ffmpegPath = config.server.rtmp && config.server.rtmp.ffmpeg ? config.server.rtmp.ffmpeg : '/usr/bin/ffmpeg';
const ffmpegPath =
config.server.rtmp && config.server.rtmp.ffmpegPath ? config.server.rtmp.ffmpegPath : '/usr/bin/ffmpeg';
ffmpeg.setFfmpegPath(ffmpegPath);
const Logger = require('./Logger');

عرض الملف

@@ -1,7 +1,8 @@
'use strict';
const config = require('./config');
const ffmpegPath = config.server.rtmp && config.server.rtmp.ffmpeg ? config.server.rtmp.ffmpeg : '/usr/bin/ffmpeg';
const ffmpegPath =
config.server.rtmp && config.server.rtmp.ffmpegPath ? config.server.rtmp.ffmpegPath : '/usr/bin/ffmpeg';
const ffmpeg = require('fluent-ffmpeg');
ffmpeg.setFfmpegPath(ffmpegPath);

عرض الملف

@@ -55,7 +55,7 @@ dev dependencies: {
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.7.03
* @version 1.7.04
*
*/

عرض الملف

@@ -2,6 +2,28 @@
const os = require('os');
// #############################
// HELPERS
// #############################
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...
}
// https://api.ipify.org
function getIPv4() {
@@ -99,7 +121,8 @@ module.exports = {
- apiSecret: The API secret for streaming WebRTC to RTMP through the MiroTalk API.
- expirationHours: The number of hours before the RTMP URL expires. Default is 4 hours.
- dir: Directory where your video files are stored to be streamed via RTMP.
- ffmpeg: Path of the ffmpeg installation on the system (which ffmpeg)
- ffmpegPath: Path of the ffmpeg installation on the system (which ffmpeg)
- platform: OS es darwin, linux, win32....
Important: Before proceeding, make sure your RTMP server is up and running.
For more information, refer to the documentation here: https://docs.mirotalk.com/mirotalk-sfu/rtmp/.
@@ -120,7 +143,8 @@ module.exports = {
apiSecret: 'mirotalkRtmpApiSecret',
expirationHours: 4,
dir: 'rtmp',
ffmpeg: '/usr/bin/ffmpeg',
ffmpegPath: ffmpegPath,
platform: platform,
},
},
middleware: {

عرض الملف

@@ -1,6 +1,6 @@
{
"name": "mirotalksfu",
"version": "1.7.03",
"version": "1.7.04",
"description": "WebRTC SFU browser-based video calls",
"main": "Server.js",
"scripts": {

عرض الملف

@@ -11,7 +11,7 @@ if (location.href.substr(0, 5) !== 'https') location.href = 'https' + location.h
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.7.03
* @version 1.7.04
*
*/
@@ -4904,7 +4904,7 @@ function showAbout() {
imageUrl: image.about,
customClass: { image: 'img-about' },
position: 'center',
title: 'WebRTC SFU v1.7.03',
title: 'WebRTC SFU v1.7.04',
html: `
<br />
<div id="about">

عرض الملف

@@ -9,7 +9,7 @@
* @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.7.03
* @version 1.7.04
*
*/

عرض الملف

@@ -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);