From 2d475743f79cf433ccbad1f28b46567ffbed9047 Mon Sep 17 00:00:00 2001 From: lmk <1095689763@qq.com> Date: Thu, 25 Jun 2026 16:48:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=97=E5=B9=95=E9=BB=98=E8=AE=A4=E5=9B=BA?= =?UTF-8?q?=E5=AE=9A=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/dto/video/video_caption_dto.go | 6 +++--- service/video/caption_service.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/model/dto/video/video_caption_dto.go b/model/dto/video/video_caption_dto.go index d2e1dc2..ee36cf0 100644 --- a/model/dto/video/video_caption_dto.go +++ b/model/dto/video/video_caption_dto.go @@ -32,12 +32,12 @@ type SubtitleSegment struct { // SubtitleStyle 字幕样式配置 type SubtitleStyle struct { - FontSize int `json:"fontSize" d:"28" dc:"字号(默认28)"` + FontSize int `json:"fontSize" d:"48" dc:"字号(默认48)"` FontColor string `json:"fontColor" d:"#FFFFFF" dc:"字体颜色(默认白色)"` BgColor *string `json:"bgColor" dc:"背景色,空字符串=透明(默认#000000)。传空字符串 '' 可去掉背景色"` - BgOpacity *float64 `json:"bgOpacity" dc:"背景透明度0-1(默认0.6)。传0可使背景完全透明"` + BgOpacity *float64 `json:"bgOpacity" dc:"背景透明度0-1(默认0.4)。传0可使背景完全透明"` X string `json:"x" d:"center" dc:"水平位置:left/center/right或像素值(默认center)"` - Y string `json:"y" d:"bottom" dc:"垂直位置:top/center/bottom或像素值(默认bottom)"` + Y string `json:"y" d:"65%" dc:"垂直位置:top/center/bottom或像素值或百分比(默认65%)"` } // ---------- 创建字幕任务 ---------- diff --git a/service/video/caption_service.go b/service/video/caption_service.go index 0376475..e2ab6e4 100644 --- a/service/video/caption_service.go +++ b/service/video/caption_service.go @@ -726,10 +726,10 @@ func hexToRGBA(hex string, alpha float64) string { // subtitlesToElements 将外部传入的字幕时间线转为底部字幕元素 func subtitlesToElements(subtitles []dto.SubtitleSegment, style *dto.SubtitleStyle) []dto.CaptionElement { // 应用默认值 - fontSize := 28 + fontSize := 48 fontColor := "#FFFFFF" bgColor := "#000000" - bgOpacity := 0.6 + bgOpacity := 0.4 if style != nil { if style.FontSize > 0 { fontSize = style.FontSize @@ -750,7 +750,7 @@ func subtitlesToElements(subtitles []dto.SubtitleSegment, style *dto.SubtitleSty // 从样式配置中读取字幕位置 subtitleX := "center" - subtitleY := "bottom" + subtitleY := "65%" if style != nil { if style.X != "" { subtitleX = style.X