From 6f3583559f30a8be62e674f078d225bded60a8a0 Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Fri, 27 Sep 2024 11:16:34 +0000 Subject: [PATCH] [bugfix] better handle ogg container format (#3365) --- internal/media/ffmpeg.go | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/internal/media/ffmpeg.go b/internal/media/ffmpeg.go index 693b6f490..4baa3dbe5 100644 --- a/internal/media/ffmpeg.go +++ b/internal/media/ffmpeg.go @@ -381,11 +381,19 @@ func (res *result) GetFileType() (gtsmodel.FileType, string) { return gtsmodel.FileTypeAudio, "wma" } case "ogg": - switch { - case len(res.video) > 0: - return gtsmodel.FileTypeVideo, "ogv" - case len(res.audio) > 0: - return gtsmodel.FileTypeAudio, "ogg" + if len(res.video) > 0 { + switch res.video[0].codec { + case "theora", "dirac": // daala, tarkin + return gtsmodel.FileTypeVideo, "ogv" + } + } + if len(res.audio) > 0 { + switch res.audio[0].codec { + case "opus", "libopus": + return gtsmodel.FileTypeAudio, "opus" + default: + return gtsmodel.FileTypeAudio, "ogg" + } } case "matroska,webm": switch {