You've already forked fm-dx-webserver
mirror of
https://github.com/KubaPro010/fm-dx-webserver.git
synced 2026-02-27 14:33:52 +01:00
UI changes, accessibility features, ffmpeg adjustments
This commit is contained in:
@@ -335,13 +335,13 @@ class FallbackProviderMp3 extends AFallbackProvider {
|
||||
GetFFmpegArguments() {
|
||||
return [
|
||||
"-fflags", "+nobuffer+flush_packets", "-flags", "low_delay", "-rtbufsize", "32", "-probesize", "32",
|
||||
"-f", "s16le",
|
||||
"-f", "libmp3lame",
|
||||
"-ar", this.Server.SampleRate.toString(),
|
||||
"-ac", this.Server.Channels.toString(),
|
||||
"-i", "pipe:0",
|
||||
"-c:a", "libmp3lame",
|
||||
"-b:a", Settings.FallbackMp3Bitrate.toString() + "k",
|
||||
"-ac", "1",
|
||||
"-ac", this.Server.Channels.toString(),
|
||||
"-reservoir", "0",
|
||||
"-f", "mp3", "-write_xing", "0", "-id3v2_version", "0",
|
||||
"-fflags", "+nobuffer", "-flush_packets", "1",
|
||||
|
||||
@@ -3,13 +3,20 @@ const config = require('../userconfig.js');
|
||||
const consoleCmd = require('../console.js');
|
||||
|
||||
function enableAudioStream() {
|
||||
var ffmpegCommand;
|
||||
// Specify the command and its arguments
|
||||
const command = 'ffmpeg';
|
||||
const flags = '-fflags +nobuffer+flush_packets -flags low_delay -rtbufsize 6192 -probesize 64 -audio_buffer_size 20';
|
||||
const codec = '-acodec pcm_s16le -ar 48000 -ac 1';
|
||||
const flags = '-fflags +nobuffer+flush_packets -flags low_delay -rtbufsize 6192 -probesize 64';
|
||||
const codec = '-acodec pcm_s16le -ar 48000 -ac 2';
|
||||
const output = '-f s16le -fflags +nobuffer+flush_packets -packetsize 384 -flush_packets 1 -bufsize 960';
|
||||
// Combine all the settings for the ffmpeg command
|
||||
const ffmpegCommand = `${flags} -f dshow -i audio="${config.audioDeviceName}" ${codec} ${output} pipe:1 | node stream/3las.server.js -port ${config.audioPort} -samplerate 48000 -channels 1`;
|
||||
if (process.platform === 'win32') {
|
||||
// Windows
|
||||
ffmpegCommand = `${flags} -f dshow -i audio="${config.audioDeviceName}" ${codec} ${output} pipe:1 | node stream/3las.server.js -port ${config.audioPort} -samplerate 44100 -channels 2`;
|
||||
} else {
|
||||
// Linux
|
||||
ffmpegCommand = `${flags} -f alsa -i "${config.audioDeviceName}" ${codec} ${output} pipe:1 | node stream/3las.server.js -port ${config.audioPort} -samplerate 48000 -channels 2`;
|
||||
}
|
||||
|
||||
consoleCmd.logInfo("Launching audio stream on port " + config.audioPort + ".");
|
||||
// Spawn the child process
|
||||
@@ -17,24 +24,24 @@ function enableAudioStream() {
|
||||
if(config.audioDeviceName.length > 2) {
|
||||
const childProcess = spawn(command, [ffmpegCommand], { shell: true });
|
||||
|
||||
// Handle the output of the child process (optional)
|
||||
/*childProcess.stdout.on('data', (data) => {
|
||||
console.log(`stdout: ${data}`);
|
||||
});
|
||||
// Handle the output of the child process (optional)
|
||||
childProcess.stdout.on('data', (data) => {
|
||||
consoleCmd.logDebug(`stdout: ${data}`);
|
||||
});
|
||||
|
||||
childProcess.stderr.on('data', (data) => {
|
||||
console.error(`stderr: ${data}`);
|
||||
childProcess.stderr.on('data', (data) => {
|
||||
consoleCmd.logDebug(`stderr: ${data}`);
|
||||
});
|
||||
|
||||
// Handle the child process exit event
|
||||
childProcess.on('close', (code) => {
|
||||
console.log(`Child process exited with code ${code}`);
|
||||
consoleCmd.logDebug(`Child process exited with code ${code}`);
|
||||
});
|
||||
|
||||
// You can also listen for the 'error' event in case the process fails to start
|
||||
childProcess.on('error', (err) => {
|
||||
console.error(`Error starting child process: ${err}`);
|
||||
});*/
|
||||
consoleCmd.logError(`Error starting child process: ${err}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
"RtcConfig" : null,
|
||||
"FallbackFFmpegPath": "ffmpeg.exe",
|
||||
"FallbackUseMp3": true,
|
||||
"FallbackUseWav": true,
|
||||
"FallbackMp3Bitrate": 128,
|
||||
"FallbackUseWav": false,
|
||||
"FallbackMp3Bitrate": 192,
|
||||
"FallbackWavSampleRate": 16000,
|
||||
"AdminKey": ""
|
||||
}
|
||||
Reference in New Issue
Block a user