From 832658ad5822213fa4b97dc8e4c08e2fcc65e230 Mon Sep 17 00:00:00 2001 From: HenryDu8133 <813367384@qq.com> Date: Sun, 2 Aug 2026 08:50:28 +0800 Subject: [PATCH] feat: apply 5x volume boost to all FFmpeg audio processing (broadcast sequences, HLS, DFPWM) to maximize loudness --- CloudServer/server.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/CloudServer/server.js b/CloudServer/server.js index c90feed..29cd241 100644 --- a/CloudServer/server.js +++ b/CloudServer/server.js @@ -1289,7 +1289,7 @@ function buildSequenceWavFile(seq) { const inputs = files.map(f => `-i "${f}"`).join(' '); const filterResamples = files.map((_, i) => `[${i}:a]aformat=sample_rates=48000:channel_layouts=mono,aresample=48000[a${i}]`).join(';'); - const filterConcat = files.map((_, i) => `[a${i}]`).join('') + `concat=n=${files.length}:v=0:a=1[a]`; + const filterConcat = files.map((_, i) => `[a${i}]`).join('') + `concat=n=${files.length}:v=0:a=1,volume=5.0[a]`; const filterComplex = `${filterResamples};${filterConcat}`; try { @@ -1330,7 +1330,7 @@ function runFfmpegRtmpPush(streamName, seq) { const tmpAacPath = path.join(tmpDir, `prebuild-${Date.now()}-${Math.random().toString(16).slice(2)}.aac`); const inputs = files.map(f => `-i "${f}"`).join(' '); const filterResamples = files.map((_, i) => `[${i}:a]aformat=sample_rates=48000:channel_layouts=mono,aresample=48000[a${i}]`).join(';'); - const filterConcat = files.map((_, i) => `[a${i}]`).join('') + `concat=n=${files.length}:v=0:a=1[a]`; + const filterConcat = files.map((_, i) => `[a${i}]`).join('') + `concat=n=${files.length}:v=0:a=1,volume=5.0[a]`; const filterComplex = `${filterResamples};${filterConcat}`; const buildArgs = [ @@ -1425,7 +1425,7 @@ function runFfmpegRtmpPush(streamName, seq) { } const filterResamples = files.map((_, i) => `[${i}:a]aformat=sample_rates=48000:channel_layouts=mono,aresample=48000[a${i}]`).join(';'); - const filterConcat = files.map((_, i) => `[a${i}]`).join('') + `concat=n=${files.length}:v=0:a=1[a]`; + const filterConcat = files.map((_, i) => `[a${i}]`).join('') + `concat=n=${files.length}:v=0:a=1,volume=5.0[a]`; const filterComplex = `${filterResamples};${filterConcat}`; const args = [ @@ -2086,7 +2086,8 @@ function convertToDfpwm(filePath) { // -f s8: signed 8-bit pcm // -ac 1: mono // -ar 48000: 48kHz - execSync(`ffmpeg -y -v quiet -i "${filePath}" -f s8 -acodec pcm_s8 -ac 1 -ar 48000 "${rawPath}"`); + // -filter:a volume=5.0: boost volume significantly + execSync(`ffmpeg -y -v quiet -i "${filePath}" -filter:a volume=5.0 -f s8 -acodec pcm_s8 -ac 1 -ar 48000 "${rawPath}"`); if (fs.existsSync(rawPath)) { const buffer = fs.readFileSync(rawPath); @@ -2714,7 +2715,7 @@ function buildTempBroadcastFromWav(prefixWavPath, contentWavPath) { const filterComplex = [ '[0:a]aformat=sample_rates=48000:channel_layouts=mono,aresample=48000[a0]', '[1:a]aformat=sample_rates=48000:channel_layouts=mono,aresample=48000[a1]', - '[a0][a1]concat=n=2:v=0:a=1[a]' + '[a0][a1]concat=n=2:v=0:a=1,volume=5.0[a]' ].join(';'); execSync(`ffmpeg -hide_banner -loglevel error -y -i "${prefixWavPath}" -i "${contentWavPath}" -filter_complex "${filterComplex}" -map "[a]" -ac 1 -ar 48000 -c:a pcm_s16le "${outWavPath}"`);