生成视频并且上传到minio-异步
This commit is contained in:
@@ -10,6 +10,15 @@ type ConcatReq struct {
|
||||
Upload bool `json:"upload" dc:"是否上传到MinIO" d:"false"`
|
||||
}
|
||||
|
||||
// ConcatAsyncReq 视频拼接-异步请求(URL模式)
|
||||
type ConcatAsyncReq struct {
|
||||
g.Meta `path:"/concat/async" method:"post" tags:"视频拼接" summary:"视频拼接-异步(URL模式)" dc:"异步拼接视频,立即返回taskId,完成后通过callback_url通知结果"`
|
||||
VideoURLs []string `json:"video_urls" v:"required#视频URL列表不能为空" dc:"视频URL列表(按此顺序拼接)"`
|
||||
Method string `json:"method" dc:"拼接方式(auto/fast/reencode)" d:"auto"`
|
||||
Upload bool `json:"upload" dc:"是否上传到MinIO" d:"false"`
|
||||
CallbackURL string `json:"callback_url" v:"required#回调地址不能为空" dc:"回调地址,拼接完成后POST结果到该地址"`
|
||||
}
|
||||
|
||||
// ConcatUploadReq 视频拼接请求(文件上传模式)
|
||||
type ConcatUploadReq struct {
|
||||
g.Meta `path:"/concat/upload" method:"post" tags:"视频拼接" summary:"视频拼接(文件上传)" dc:"上传视频文件并拼接(至少2个视频)"`
|
||||
@@ -17,6 +26,14 @@ type ConcatUploadReq struct {
|
||||
Upload bool `json:"upload" dc:"是否上传到MinIO" d:"false"`
|
||||
}
|
||||
|
||||
// ConcatUploadAsyncReq 视频拼接-异步请求(文件上传模式)
|
||||
type ConcatUploadAsyncReq struct {
|
||||
g.Meta `path:"/concat/upload/async" method:"post" tags:"视频拼接" summary:"视频拼接-异步(文件上传)" dc:"异步拼接上传的视频,立即返回taskId,完成后通过callback_url通知结果"`
|
||||
Method string `json:"method" dc:"拼接方式(auto/fast/reencode)" d:"auto"`
|
||||
Upload bool `json:"upload" dc:"是否上传到MinIO" d:"false"`
|
||||
CallbackURL string `json:"callback_url" v:"required#回调地址不能为空" dc:"回调地址,拼接完成后POST结果到该地址"`
|
||||
}
|
||||
|
||||
// ConcatRes 视频拼接响应
|
||||
type ConcatRes struct {
|
||||
OutputPath string `json:"outputPath" dc:"输出文件路径"`
|
||||
@@ -28,6 +45,36 @@ type ConcatRes struct {
|
||||
FileURL string `json:"fileURL" dc:"MinIO访问地址(上传后返回)"`
|
||||
}
|
||||
|
||||
// ---------- 异步拼接任务 ----------
|
||||
|
||||
// CreateConcatTaskRes 创建异步拼接任务响应
|
||||
type CreateConcatTaskRes struct {
|
||||
TaskID string `json:"taskId" dc:"任务ID"`
|
||||
}
|
||||
|
||||
// GetConcatTaskReq 查询异步拼接任务请求
|
||||
type GetConcatTaskReq struct {
|
||||
g.Meta `path:"/concat/task/{taskId}" method:"get" tags:"视频拼接" summary:"查询拼接任务结果" dc:"根据taskId查询异步拼接任务的结果"`
|
||||
TaskID string `json:"taskId" dc:"任务ID"`
|
||||
}
|
||||
|
||||
// GetConcatTaskRes 查询异步拼接任务响应
|
||||
type GetConcatTaskRes struct {
|
||||
TaskID string `json:"taskId" dc:"任务ID"`
|
||||
Status string `json:"status" dc:"状态: pending/running/success/failed"`
|
||||
FileURL string `json:"fileURL,omitempty" dc:"MinIO文件访问路径"`
|
||||
FileSize int64 `json:"fileSize,omitempty" dc:"文件大小(字节)"`
|
||||
FileName string `json:"fileName,omitempty" dc:"文件名"`
|
||||
FileFormat string `json:"fileFormat,omitempty" dc:"文件格式"`
|
||||
FileAddressPrefix string `json:"fileAddressPrefix,omitempty" dc:"MinIO地址前缀"`
|
||||
MethodUsed string `json:"methodUsed,omitempty" dc:"实际使用的拼接方式"`
|
||||
DurationStr string `json:"durationStr,omitempty" dc:"拼接后时长"`
|
||||
ErrorMessage string `json:"errorMessage,omitempty" dc:"错误信息"`
|
||||
CreatedAt int64 `json:"createdAt" dc:"创建时间戳"`
|
||||
}
|
||||
|
||||
// ---------- 上传工具 ----------
|
||||
|
||||
// UploadFileBytesReq 上传文件请求(字节流)
|
||||
type UploadFileBytesReq struct {
|
||||
FileName string `json:"fileName" dc:"文件名"`
|
||||
|
||||
48
model/entity/video/concat_task.go
Normal file
48
model/entity/video/concat_task.go
Normal file
@@ -0,0 +1,48 @@
|
||||
package video
|
||||
|
||||
import "gitea.com/red-future/common/beans"
|
||||
|
||||
// ConcatTask 视频拼接异步任务实体
|
||||
type ConcatTask struct {
|
||||
beans.SQLBaseDO `orm:",inherit"`
|
||||
TaskID string `orm:"task_id" json:"taskId" description:"任务唯一标识"`
|
||||
Status string `orm:"status" json:"status" description:"任务状态:pending/running/success/failed"`
|
||||
FileURL string `orm:"file_url" json:"fileUrl" description:"MinIO文件访问路径"`
|
||||
FileSize int64 `orm:"file_size" json:"fileSize" description:"文件大小(字节)"`
|
||||
FileName string `orm:"file_name" json:"fileName" description:"文件名"`
|
||||
FileFormat string `orm:"file_format" json:"fileFormat" description:"文件格式"`
|
||||
FileAddressPrefix string `orm:"file_address_prefix" json:"fileAddressPrefix" description:"MinIO地址前缀"`
|
||||
MethodUsed string `orm:"method_used" json:"methodUsed" description:"实际使用的拼接方式"`
|
||||
DurationStr string `orm:"duration_str" json:"durationStr" description:"拼接后时长"`
|
||||
ErrorMessage string `orm:"error_message" json:"errorMessage" description:"错误信息"`
|
||||
}
|
||||
|
||||
// ConcatTaskCol 字段定义
|
||||
type ConcatTaskCol struct {
|
||||
beans.SQLBaseCol
|
||||
TaskID string
|
||||
Status string
|
||||
FileURL string
|
||||
FileSize string
|
||||
FileName string
|
||||
FileFormat string
|
||||
FileAddressPrefix string
|
||||
MethodUsed string
|
||||
DurationStr string
|
||||
ErrorMessage string
|
||||
}
|
||||
|
||||
// ConcatTaskCols 字段常量
|
||||
var ConcatTaskCols = ConcatTaskCol{
|
||||
SQLBaseCol: beans.DefSQLBaseCol,
|
||||
TaskID: "task_id",
|
||||
Status: "status",
|
||||
FileURL: "file_url",
|
||||
FileSize: "file_size",
|
||||
FileName: "file_name",
|
||||
FileFormat: "file_format",
|
||||
FileAddressPrefix: "file_address_prefix",
|
||||
MethodUsed: "method_used",
|
||||
DurationStr: "duration_str",
|
||||
ErrorMessage: "error_message",
|
||||
}
|
||||
Reference in New Issue
Block a user