Initial commit

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-15 13:57:10 +08:00
co-authored by Claude Opus 5
commit 8679200f41
1897 changed files with 257900 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
package common
import "math"
type Quality string
type Direction string
const (
High Quality = "high" //影片质量高 720P以上
Middle Quality = "middle" //影片质量高 480P-720P以上
Low Quality = "low" //影片质量高 480P以下
Vertical Direction = "vertical" //竖屏
Horizontal Direction = "horizontal" //横屏
Square Direction = "square" //方形屏
)
type IdentifiInfo struct {
Quality Quality
Direction Direction
}
// 提取视频信息
func IdentifiVideoInfo(width, height int64) (info IdentifiInfo) {
//竖屏
if height > width {
info.Direction = Vertical
}
if height == width {
info.Direction = Square
}
if height < width {
info.Direction = Horizontal
}
max := math.Max(float64(width), float64(height))
min := math.Min(float64(width), float64(height))
if min >= 720 && max >= 1280 {
info.Quality = High
} else if min >= 480 && max >= 800 {
info.Quality = Middle
} else {
info.Quality = Low
}
return
}