From 86a79d0cc0a0c1faed63c85a0988ed3de0c6b663 Mon Sep 17 00:00:00 2001 From: sethwv-alt Date: Sun, 9 Nov 2025 12:02:01 -0500 Subject: [PATCH] More music fixes --- Dockerfile | 18 +++++++++++++++--- src/streamHandler.js | 12 +++++++++--- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index a38404a..854beec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,13 +21,25 @@ RUN apk add --no-cache \ python3 # Download and extract Weatherscan music -RUN mkdir -p /music && \ +RUN mkdir -p /music /music-temp && \ echo "Downloading Weatherscan music..." && \ wget -O /tmp/weatherscan.zip "https://archive.org/compress/weatherscancompletecollection/formats=OGG%20VORBIS&file=/weatherscancompletecollection.zip" && \ echo "Extracting OGG files..." && \ - unzip -j /tmp/weatherscan.zip "*.ogg" -d /music && \ - echo "Music files extracted: $(ls -1 /music/*.ogg | wc -l) files" && \ + unzip -j /tmp/weatherscan.zip "*.ogg" -d /music-temp && \ rm /tmp/weatherscan.zip && \ + echo "Repairing and validating music files (fast parallel processing)..." && \ + cd /music-temp && \ + JOBS=0 && MAX_JOBS=12 && \ + for file in *.ogg; do \ + while [ $JOBS -ge $MAX_JOBS ]; do \ + wait -n 2>/dev/null && JOBS=$((JOBS-1)) || JOBS=0; \ + done; \ + (ffmpeg -y -v error -i "$file" -c:a libvorbis -b:a 128k "/music/$file" 2>&1 && echo "✓ $file" || echo "✗ $file") & \ + JOBS=$((JOBS+1)); \ + done && \ + wait && \ + cd / && rm -rf /music-temp && \ + echo "Music files ready: $(ls -1 /music/*.ogg 2>/dev/null | wc -l) files" && \ echo "Weatherscan music setup complete!" # Set Puppeteer to use installed Chromium diff --git a/src/streamHandler.js b/src/streamHandler.js index 541f974..e7acd3a 100644 --- a/src/streamHandler.js +++ b/src/streamHandler.js @@ -86,12 +86,18 @@ async function streamHandler(req, res, { useMusic = false, musicPath, lateGeocod ffmpegProcess.stderr.on('data', (data) => { const message = data.toString(); - // Log important warnings about audio discontinuities or errors + // Suppress expected warnings from corrupted audio frames and HLS piping + if (message.includes('failed to delete old segment') || + message.includes('Error submitting packet to decoder') || + message.includes('Invalid data found when processing input')) { + // These are expected with some music files - FFmpeg handles them gracefully + return; + } + // Log important warnings about stream issues if (message.includes('Non-monotonous DTS') || message.includes('Application provided invalid') || message.includes('past duration') || - message.includes('Error while decoding stream') || - message.includes('Invalid data found')) { + message.includes('Error while decoding stream')) { console.warn(`FFmpeg warning: ${message.trim()}`); } });