From ce63da1448491ed5c8d3d0bba61b4fab88fdc835 Mon Sep 17 00:00:00 2001 From: solidDoWant Date: Wed, 7 May 2025 19:08:59 -0500 Subject: [PATCH] Added support for considering DTS audio streams when determing player codec support (#942) --- transcoder/src/codec.go | 27 +++++++++++++++++++++++++++ transcoder/src/info.go | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/transcoder/src/codec.go b/transcoder/src/codec.go index 0bd23f44..acfe8839 100644 --- a/transcoder/src/codec.go +++ b/transcoder/src/codec.go @@ -115,6 +115,33 @@ func GetMimeCodec(stream *ffprobe.Stream) *string { ret := "alac" return &ret + // MIME type codec values: https://cconcolato.github.io/media-mime-support/#video/mp4;%20codecs=%22dtsc%22 + // Profiles supported by ffmpeg: https://github.com/FFmpeg/FFmpeg/blob/1b643e3f65d75a4e6a25986466254bdd4fc1a01a/libavcodec/profiles.c#L40-L50 + case "dts": + ret := "dts" + switch strings.ToLower(stream.Profile) { + case "dts-hd hra": // DTS-HD High Resolution Audio + ret += "h" + case "dts-hd ma": // DTS-HD Master Audio + ret += "l" + case "dts-hd ma + dts:x": // DTS-HD Master Audio + DTS:X + fallthrough + case "dts-hd ma + dts-hd imax": // DTS-HD Master Audio + DTS:X IMAX (?) + ret += "x" + case "dts express": // DTS Express, AKA DTS LBR + ret += "e" + case "dts": // Plain DTS. The original codec name was "Digital Coherent Acoustics", which is where the "c" comes from. All other codecs are a superset of "dtsc". + fallthrough + // Profiles with unknown MIME type codec value(s) + case "dts-es": // DTS-ES (Extended Surround) + fallthrough + case "dts 96/24": // DTS 96/24 + fallthrough + default: + ret += "c" + } + return &ret + default: log.Printf("No known mime format for: %s", stream.CodecName) return nil diff --git a/transcoder/src/info.go b/transcoder/src/info.go index 60f04a3c..e17c1bc3 100644 --- a/transcoder/src/info.go +++ b/transcoder/src/info.go @@ -17,7 +17,7 @@ import ( "gopkg.in/vansante/go-ffprobe.v2" ) -const InfoVersion = 1 +const InfoVersion = 2 type Versions struct { Info int32 `json:"info"`