High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
fix: downmix audio to stereo to fix broken channel layout (#29485)
Lukas Schaefer5645149e094d
diff --git a/server/src/services/transcoding.service.spec.ts b/server/src/services/transcoding.service.spec.tsindex 8909a43342..68e1700743 100644--- a/server/src/services/transcoding.service.spec.ts+++ b/server/src/services/transcoding.service.spec.ts@@ -381,6 +381,8 @@ describe(TranscodingService.name, () => {'50','-keyint_min','50',+ '-ac',+ '2','-copyts','-r','50130000/2012441',diff --git a/server/src/utils/media.ts b/server/src/utils/media.tsindex eb775e20d3..de925cf571 100644--- a/server/src/utils/media.ts+++ b/server/src/utils/media.ts@@ -200,6 +200,11 @@ export class BaseConfig implements VideoCodecSWConfig {const options = ['-c:v', videoCodec, '-c:a', audioCodec, '-map', `0:${videoStream.index}`, '-map_metadata', '-1'];if (audioStream) {options.push('-map', `0:${audioStream.index}`);+ // If there are more than 2 channels sometimes the channel config is broken when re-encoded+ // TODO: Store the number of channels in the db and then set it during the transcoding: -channel_layout 5.1+ if ([TranscodeTarget.All, TranscodeTarget.Audio].includes(target)) {+ options.push('-ac', '2');+ }}if (this.getBFrames() > -1) {options.push('-bf', `${this.getBFrames()}`);