fix(server): don't select an audio stream ffprobe could not identify (#32062)

fix(server): don't select an audio stream ffprobe could not identify (#30901)

iPhone videos recorded with Apple Spatial Audio carry two audio tracks: an
AAC track and an APAC track that ffmpeg has no decoder for. Both are marked
default, so `compareStreams` ties on disposition and falls through to
bitrate, where the APAC track wins because spatial audio is encoded at a
higher rate. `audioStreams[0]` is then persisted and mapped into the
transcode command, and ffmpeg fails before it starts encoding:

    [aist#0:2/none] Decoding requested, but no decoder found for: none
    Error opening output file .../out.mp4
    Error opening output files: Invalid argument

Drop audio streams ffprobe reported as `unknown` before the existing
disposition/bitrate ordering runs. A stream with no codec to decode is not a
usable audio stream, so an asset whose every audio track is unidentified is
treated as having no audio at all. The video pipeline is unchanged, since the
evidence here covers audio selection only.


(cherry picked from commit 69f06a29ca67613355348172480054ebd7e09f6c)

Co-authored-by: Lin, Chiang-Yu <110763842+RxChi1d@users.noreply.github.com>
Co-authored-by: Mert <101130780+mertalev@users.noreply.github.com>
This commit is contained in:
immich-push-o-matic[bot]
2026-10-03 21:30:26 +00:00
committed by GitHub
co-authored by Lin, Chiang-Yu <110763842+RxChi1d@users.noreply.github.com> Mert
parent 20f103c4b9
commit d15972e722
+1 -1
View File
@@ -291,7 +291,7 @@ export class MediaRepository {
};
}),
audioStreams: results.streams
.filter((stream) => stream.codec_type === 'audio')
.filter((stream) => stream.codec_type === 'audio' && stream.codec_name !== 'unknown')
.sort((a, b) => this.compareStreams(a, b))
.map((stream) => ({
index: stream.index,