summaryrefslogtreecommitdiff
path: root/internal/media/ffmpeg.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2024-09-27 11:16:34 +0000
committerLibravatar GitHub <noreply@github.com>2024-09-27 13:16:34 +0200
commit6f3583559f30a8be62e674f078d225bded60a8a0 (patch)
tree1db7dc175dd6d4b62e8a7597705c2321b4c45b78 /internal/media/ffmpeg.go
parent[bugfix] fix media limit reader check (#3363) (diff)
downloadgotosocial-6f3583559f30a8be62e674f078d225bded60a8a0.tar.xz
[bugfix] better handle ogg container format (#3365)
Diffstat (limited to 'internal/media/ffmpeg.go')
-rw-r--r--internal/media/ffmpeg.go18
1 files 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 {