Documentation
¶
Index ¶
- type AnalyzeRequest
- type AnalyzeResponse
- type BoundingBox
- type DetectedObject
- type FrameAnalysis
- type GeminiConfig
- type GeminiProvider
- func (p *GeminiProvider) Analyze(ctx context.Context, req *AnalyzeRequest) (*AnalyzeResponse, error)
- func (p *GeminiProvider) Generate(ctx context.Context, req *GenerateRequest) (*GenerateResponse, error)
- func (p *GeminiProvider) Name() string
- func (p *GeminiProvider) SupportedFormats() []VideoFormat
- func (p *GeminiProvider) SupportsGeneration() bool
- type GenerateRequest
- type GenerateResponse
- type Provider
- type RunwayConfig
- type RunwayProvider
- func (p *RunwayProvider) Analyze(ctx context.Context, req *AnalyzeRequest) (*AnalyzeResponse, error)
- func (p *RunwayProvider) Generate(ctx context.Context, req *GenerateRequest) (*GenerateResponse, error)
- func (p *RunwayProvider) Name() string
- func (p *RunwayProvider) SupportedFormats() []VideoFormat
- func (p *RunwayProvider) SupportsGeneration() bool
- type VeoConfig
- type VeoProvider
- func (p *VeoProvider) Analyze(ctx context.Context, req *AnalyzeRequest) (*AnalyzeResponse, error)
- func (p *VeoProvider) Generate(ctx context.Context, req *GenerateRequest) (*GenerateResponse, error)
- func (p *VeoProvider) Name() string
- func (p *VeoProvider) SupportedFormats() []VideoFormat
- func (p *VeoProvider) SupportsGeneration() bool
- type VideoData
- type VideoFormat
- type VideoUsage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnalyzeRequest ¶
type AnalyzeRequest struct {
VideoURL string `json:"video_url,omitempty"`
VideoData string `json:"video_data,omitempty"` // Base64 encoded
VideoFormat VideoFormat `json:"video_format,omitempty"`
Prompt string `json:"prompt"`
Model string `json:"model,omitempty"`
MaxFrames int `json:"max_frames,omitempty"` // Max frames to analyze
Interval float64 `json:"interval,omitempty"` // Frame interval in seconds
StartTime float64 `json:"start_time,omitempty"` // Start time in seconds
EndTime float64 `json:"end_time,omitempty"` // End time in seconds
Metadata map[string]string `json:"metadata,omitempty"`
}
AnalyzeRequest 表示视频分析请求.
type AnalyzeResponse ¶
type AnalyzeResponse struct {
Provider string `json:"provider"`
Model string `json:"model"`
Content string `json:"content"`
Frames []FrameAnalysis `json:"frames,omitempty"`
Duration float64 `json:"duration,omitempty"`
Usage VideoUsage `json:"usage,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
AnalyzeResponse 表示视频分析的响应.
type BoundingBox ¶
type BoundingBox struct {
X float64 `json:"x"`
Y float64 `json:"y"`
Width float64 `json:"width"`
Height float64 `json:"height"`
}
BoundingBox 表示帧中的对象位置.
type DetectedObject ¶
type DetectedObject struct {
Label string `json:"label"`
Confidence float64 `json:"confidence"`
BoundingBox *BoundingBox `json:"bounding_box,omitempty"`
}
DetectedObject 表示在帧中检测到的对象.
type FrameAnalysis ¶
type FrameAnalysis struct {
Timestamp float64 `json:"timestamp"`
Description string `json:"description,omitempty"`
Objects []DetectedObject `json:"objects,omitempty"`
Text string `json:"text,omitempty"` // OCR text
Metadata map[string]string `json:"metadata,omitempty"`
}
FrameAnalysis 表示单帧的分析结果.
type GeminiConfig ¶
type GeminiConfig struct {
providers.BaseProviderConfig `yaml:",inline"`
ProjectID string `json:"project_id,omitempty" yaml:"project_id,omitempty"`
Location string `json:"location,omitempty" yaml:"location,omitempty"`
}
GeminiConfig 配置 Google Gemini 视频理解提供者. 嵌入 providers.BaseProviderConfig 以复用 APIKey、Model、Timeout 字段。 保留 ProjectID 和 Location 作为视频领域特有字段。
func DefaultGeminiConfig ¶
func DefaultGeminiConfig() GeminiConfig
DefaultGeminiConfig 返回默认 Gemini 视频配置.
type GeminiProvider ¶
type GeminiProvider struct {
// contains filtered or unexported fields
}
GeminiProvider 使用 Google Gemini 执行视频分析.
func NewGeminiProvider ¶
func NewGeminiProvider(cfg GeminiConfig) *GeminiProvider
NewGeminiProvider 创建新的 Gemini 视频提供者.
func (*GeminiProvider) Analyze ¶
func (p *GeminiProvider) Analyze(ctx context.Context, req *AnalyzeRequest) (*AnalyzeResponse, error)
Analyze 利用 Gemini 多模态能力分析视频内容.
func (*GeminiProvider) Generate ¶
func (p *GeminiProvider) Generate(ctx context.Context, req *GenerateRequest) (*GenerateResponse, error)
Generate 不被 Gemini 视频提供者支持.
func (*GeminiProvider) Name ¶
func (p *GeminiProvider) Name() string
func (*GeminiProvider) SupportedFormats ¶
func (p *GeminiProvider) SupportedFormats() []VideoFormat
func (*GeminiProvider) SupportsGeneration ¶
func (p *GeminiProvider) SupportsGeneration() bool
type GenerateRequest ¶
type GenerateRequest struct {
Prompt string `json:"prompt"`
NegativePrompt string `json:"negative_prompt,omitempty"`
Model string `json:"model,omitempty"`
Duration float64 `json:"duration,omitempty"` // Duration in seconds
AspectRatio string `json:"aspect_ratio,omitempty"` // 16:9, 9:16, 1:1
Resolution string `json:"resolution,omitempty"` // 720p, 1080p
FPS int `json:"fps,omitempty"`
Seed int64 `json:"seed,omitempty"`
Image string `json:"image,omitempty"` // Image-to-video base64
ImageURL string `json:"image_url,omitempty"` // Image-to-video URL
ResponseFormat string `json:"response_format,omitempty"` // url, b64_json
Metadata map[string]string `json:"metadata,omitempty"`
}
GenerateRequest 表示视频生成请求.
type GenerateResponse ¶
type GenerateResponse struct {
Provider string `json:"provider"`
Model string `json:"model"`
Videos []VideoData `json:"videos"`
Usage VideoUsage `json:"usage,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
GenerateResponse 表示视频生成响应.
type Provider ¶
type Provider interface {
// Analyze 处理和理解视频内容.
Analyze(ctx context.Context, req *AnalyzeRequest) (*AnalyzeResponse, error)
// Generate 从文本/图像提示生成视频.
Generate(ctx context.Context, req *GenerateRequest) (*GenerateResponse, error)
// Name 返回提供者名称.
Name() string
// SupportedFormats 返回支持用于分析的视频格式.
SupportedFormats() []VideoFormat
// SupportsGeneration 返回提供者是否支持视频生成.
SupportsGeneration() bool
}
Provider 定义视频处理提供者接口.
type RunwayConfig ¶
type RunwayConfig struct {
providers.BaseProviderConfig `yaml:",inline"`
}
RunwayConfig 配置 Runway ML 视频生成提供者.
func DefaultRunwayConfig ¶
func DefaultRunwayConfig() RunwayConfig
DefaultRunwayConfig 返回默认 Runway 配置.
type RunwayProvider ¶
type RunwayProvider struct {
// contains filtered or unexported fields
}
Runway Provider执行视频生成,使用Runway ML Gen-4. API 文件: https://docs.dev.runwayml.com/api/
func NewRunwayProvider ¶
func NewRunwayProvider(cfg RunwayConfig) *RunwayProvider
NewRunway Provider创建了新的跑道视频提供商.
func (*RunwayProvider) Analyze ¶
func (p *RunwayProvider) Analyze(ctx context.Context, req *AnalyzeRequest) (*AnalyzeResponse, error)
分析不由跑道支持.
func (*RunwayProvider) Generate ¶
func (p *RunwayProvider) Generate(ctx context.Context, req *GenerateRequest) (*GenerateResponse, error)
利用跑道Gen-4生成视频. 终点: POST /v1/image to video Auth: 熊克令牌 + X- Runway-Version 信头
func (*RunwayProvider) Name ¶
func (p *RunwayProvider) Name() string
func (*RunwayProvider) SupportedFormats ¶
func (p *RunwayProvider) SupportedFormats() []VideoFormat
func (*RunwayProvider) SupportsGeneration ¶
func (p *RunwayProvider) SupportsGeneration() bool
type VeoConfig ¶
type VeoConfig struct {
providers.BaseProviderConfig `yaml:",inline"`
}
VeoConfig 配置 Google Veo 视频生成提供者.
type VeoProvider ¶
type VeoProvider struct {
// contains filtered or unexported fields
}
VeoProvider使用Google Veo 3.1执行视频生成.
func NewVeoProvider ¶
func NewVeoProvider(cfg VeoConfig) *VeoProvider
NewVeoProvider创建了一个新的Veo视频提供商.
func (*VeoProvider) Analyze ¶
func (p *VeoProvider) Analyze(ctx context.Context, req *AnalyzeRequest) (*AnalyzeResponse, error)
Veo不支持分析。
func (*VeoProvider) Generate ¶
func (p *VeoProvider) Generate(ctx context.Context, req *GenerateRequest) (*GenerateResponse, error)
生成视频使用Veo 3.1.
func (*VeoProvider) Name ¶
func (p *VeoProvider) Name() string
func (*VeoProvider) SupportedFormats ¶
func (p *VeoProvider) SupportedFormats() []VideoFormat
func (*VeoProvider) SupportsGeneration ¶
func (p *VeoProvider) SupportsGeneration() bool
type VideoData ¶
type VideoData struct {
URL string `json:"url,omitempty"`
B64JSON string `json:"b64_json,omitempty"`
Duration float64 `json:"duration,omitempty"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
RevisedPrompt string `json:"revised_prompt,omitempty"`
}
VideoData 表示一个已生成的视频.
type VideoFormat ¶
type VideoFormat string
VideoFormat 表示支持的视频格式.
const ( VideoFormatMP4 VideoFormat = "mp4" VideoFormatWebM VideoFormat = "webm" VideoFormatMOV VideoFormat = "mov" VideoFormatAVI VideoFormat = "avi" VideoFormatMKV VideoFormat = "mkv" )
type VideoUsage ¶
type VideoUsage struct {
VideosGenerated int `json:"videos_generated"`
DurationSeconds float64 `json:"duration_seconds"`
Cost float64 `json:"cost,omitempty"`
}
VideoUsage 表示使用统计.