From 2cf6e8a5fe9040b89e280146505c1241885f4788 Mon Sep 17 00:00:00 2001 From: Finn Dittmar Date: Fri, 7 Nov 2025 19:02:32 +0100 Subject: [PATCH 1/3] Support eac3 --- server/objects/Stream.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/server/objects/Stream.js b/server/objects/Stream.js index d9bdd583c..8150c43c3 100644 --- a/server/objects/Stream.js +++ b/server/objects/Stream.js @@ -73,7 +73,7 @@ class Stream extends EventEmitter { return [AudioMimeType.FLAC, AudioMimeType.OPUS, AudioMimeType.WMA, AudioMimeType.AIFF, AudioMimeType.WEBM, AudioMimeType.WEBMA, AudioMimeType.AWB, AudioMimeType.CAF] } get codecsToForceAAC() { - return ['alac'] + return ['alac', 'ac3', 'eac3'] } get userToken() { return this.user.token @@ -273,7 +273,16 @@ class Stream extends EventEmitter { audioCodec = 'aac' } - this.ffmpeg.addOption([`-loglevel ${logLevel}`, '-map 0:a', `-c:a ${audioCodec}`]) + const codecOptions = [`-loglevel ${logLevel}`, '-map 0:a'] + + if (this.codecsToForceAAC.slice(1, 3).includes(this.tracksCodec)) { + // In case for ac3/eac3 it needs to be passed the bitrate and channels to avoid ffmpeg errors + codecOptions.push(`-c:a ${audioCodec}`, `-b:a ${this.tracks[0].bitRate}`, `-ac ${this.tracks[0].channels}`) + } else { + codecOptions.push(`-c:a ${audioCodec}`) + } + + this.ffmpeg.addOption(codecOptions) const hlsOptions = ['-f hls', '-copyts', '-avoid_negative_ts make_non_negative', '-max_delay 5000000', '-max_muxing_queue_size 2048', `-hls_time 6`, `-hls_segment_type ${this.hlsSegmentType}`, `-start_number ${this.segmentStartNumber}`, '-hls_playlist_type vod', '-hls_list_size 0', '-hls_allow_cache 0'] this.ffmpeg.addOption(hlsOptions) if (this.hlsSegmentType === 'fmp4') { From 3316505d1c9b8f9af2606ef628aeb765d309cf11 Mon Sep 17 00:00:00 2001 From: Finn Dittmar Date: Fri, 7 Nov 2025 19:12:38 +0100 Subject: [PATCH 2/3] Really makes sure nothing can break --- server/objects/Stream.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/objects/Stream.js b/server/objects/Stream.js index 8150c43c3..b3582329d 100644 --- a/server/objects/Stream.js +++ b/server/objects/Stream.js @@ -275,7 +275,7 @@ class Stream extends EventEmitter { const codecOptions = [`-loglevel ${logLevel}`, '-map 0:a'] - if (this.codecsToForceAAC.slice(1, 3).includes(this.tracksCodec)) { + if (this.codecsToForceAAC.slice(1, 3).includes(this.tracksCodec) && this.tracks.length > 0 && this.tracks[0].bitRate && this.tracks[0].channels) { // In case for ac3/eac3 it needs to be passed the bitrate and channels to avoid ffmpeg errors codecOptions.push(`-c:a ${audioCodec}`, `-b:a ${this.tracks[0].bitRate}`, `-ac ${this.tracks[0].channels}`) } else { From 763d8810e3fcff9b8e16ff4a6769654a9e0541d3 Mon Sep 17 00:00:00 2001 From: advplyr Date: Sat, 8 Nov 2025 17:08:43 -0600 Subject: [PATCH 3/3] Update Stream ac3/eac3 check --- server/objects/Stream.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/objects/Stream.js b/server/objects/Stream.js index b3582329d..5aa013e8e 100644 --- a/server/objects/Stream.js +++ b/server/objects/Stream.js @@ -275,7 +275,7 @@ class Stream extends EventEmitter { const codecOptions = [`-loglevel ${logLevel}`, '-map 0:a'] - if (this.codecsToForceAAC.slice(1, 3).includes(this.tracksCodec) && this.tracks.length > 0 && this.tracks[0].bitRate && this.tracks[0].channels) { + if (['ac3', 'eac3'].includes(this.tracksCodec) && this.tracks.length > 0 && this.tracks[0].bitRate && this.tracks[0].channels) { // In case for ac3/eac3 it needs to be passed the bitrate and channels to avoid ffmpeg errors codecOptions.push(`-c:a ${audioCodec}`, `-b:a ${this.tracks[0].bitRate}`, `-ac ${this.tracks[0].channels}`) } else {