Documentation
¶
Index ¶
- Constants
- type AliyunVideoCensor
- type QCloudVideoCensor
- type QiniuVideoCensor
- func (c *QiniuVideoCensor) GetCensorResult(taskID string) (interface{}, error)
- func (c *QiniuVideoCensor) GetCensorResultFull(jobID string) (*VideoCensorJobResponse, error)
- func (c *QiniuVideoCensor) SubmitCensor(req VideoCensorRequest) (*VideoCensorSubmitResponse, error)
- func (c *QiniuVideoCensor) SubmitCensorVideo(videoURL string) (string, error)
- func (c *QiniuVideoCensor) SubmitCensorVideoFull(uri, videoID string, scenes []string, intervalMsecs int) (*VideoCensorSubmitResponse, error)
- type VideoCensor
- type VideoCensorCutDetail
- type VideoCensorCutResult
- type VideoCensorData
- type VideoCensorDetection
- type VideoCensorJobResponse
- type VideoCensorParams
- type VideoCensorRequest
- type VideoCensorResult
- type VideoCensorResultDetail
- type VideoCensorSceneResult
- type VideoCensorSubmitResponse
- type VideoCutParam
- type VideoPoliticianSample
Constants ¶
const ( // VideoCensorEndpoint is the video moderation API endpoint VideoCensorEndpoint = "/v3/video/censor" // VideoJobEndpoint is the video job query API endpoint template VideoJobEndpoint = "/v3/jobs/video" // VideoCensorHost is the video moderation API host VideoCensorHost = "ai.qiniuapi.com" )
const ( // Provider kinds KindQiniu = "qiniu" KindQCloud = "qcloud" KindAliyun = "aliyun" )
const (
// Aliyun default endpoint for Green
AliyunGreenDefaultEndpoint = "green-cip.cn-shanghai.aliyuncs.com"
)
const (
// QCloud default region for VOD
QCloudVODDefaultRegion = "ap-guangzhou"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AliyunVideoCensor ¶
type AliyunVideoCensor struct {
AccessKeyID string
AccessKeySecret string
Endpoint string
Client *green.Client
}
AliyunVideoCensor is the client for Alibaba Cloud video content moderation
func NewAliyunVideoCensor ¶
func NewAliyunVideoCensor(accessKeyID, accessKeySecret, endpoint string) (*AliyunVideoCensor, error)
NewAliyunVideoCensor creates a new Alibaba Cloud video moderation client
func (*AliyunVideoCensor) GetCensorResult ¶
func (c *AliyunVideoCensor) GetCensorResult(taskID string) (interface{}, error)
GetCensorResult retrieves the video moderation result
func (*AliyunVideoCensor) SubmitCensorVideo ¶
func (c *AliyunVideoCensor) SubmitCensorVideo(videoURL string) (string, error)
SubmitCensorVideo submits a video moderation task
type QCloudVideoCensor ¶
QCloudVideoCensor is the client for Tencent Cloud video content moderation
func NewQCloudVideoCensor ¶
func NewQCloudVideoCensor(secretID, secretKey, region string) (*QCloudVideoCensor, error)
NewQCloudVideoCensor creates a new Tencent Cloud video moderation client
func (*QCloudVideoCensor) GetCensorResult ¶
func (c *QCloudVideoCensor) GetCensorResult(taskID string) (interface{}, error)
GetCensorResult retrieves the video moderation result
func (*QCloudVideoCensor) SubmitCensorVideo ¶
func (c *QCloudVideoCensor) SubmitCensorVideo(videoURL string) (string, error)
SubmitCensorVideo submits a video moderation task
func (*QCloudVideoCensor) SubmitCensorVideoByFileID ¶
func (c *QCloudVideoCensor) SubmitCensorVideoByFileID(fileID string) (string, error)
SubmitCensorVideoByFileID submits a video moderation task using file ID
type QiniuVideoCensor ¶
QiniuVideoCensor is the client for video content moderation
func NewQiniuVideoCensor ¶
func NewQiniuVideoCensor(accessKey, secretKey string) *QiniuVideoCensor
NewQiniuVideoCensor creates a new video moderation client
func (*QiniuVideoCensor) GetCensorResult ¶
func (c *QiniuVideoCensor) GetCensorResult(taskID string) (interface{}, error)
GetCensorResult retrieves the video moderation result This method implements the VideoCensor interface
func (*QiniuVideoCensor) GetCensorResultFull ¶
func (c *QiniuVideoCensor) GetCensorResultFull(jobID string) (*VideoCensorJobResponse, error)
GetCensorResultFull retrieves the video moderation result with full details
func (*QiniuVideoCensor) SubmitCensor ¶
func (c *QiniuVideoCensor) SubmitCensor(req VideoCensorRequest) (*VideoCensorSubmitResponse, error)
SubmitCensor submits a video moderation task
func (*QiniuVideoCensor) SubmitCensorVideo ¶
func (c *QiniuVideoCensor) SubmitCensorVideo(videoURL string) (string, error)
SubmitCensorVideo submits a video moderation task with just the video URL This method implements the VideoCensor interface
func (*QiniuVideoCensor) SubmitCensorVideoFull ¶
func (c *QiniuVideoCensor) SubmitCensorVideoFull(uri, videoID string, scenes []string, intervalMsecs int) (*VideoCensorSubmitResponse, error)
SubmitCensorVideoFull is a full-featured method to submit a video moderation task uri: video URI videoID: unique identifier for the video (optional) scenes: moderation scene list, e.g., []string{"pulp", "terror", "politician"} intervalMsecs: frame extraction interval (milliseconds), e.g., 5000
type VideoCensor ¶
type VideoCensor interface {
SubmitCensorVideo(videoURL string) (string, error)
GetCensorResult(taskID string) (interface{}, error)
}
VideoCensor interface for video content moderation
func GetVideoCensor ¶
func GetVideoCensor(kind string, credentials ...interface{}) (VideoCensor, error)
GetVideoCensor returns a video censor client based on the provider kind
type VideoCensorCutDetail ¶
type VideoCensorCutDetail struct {
Suggestion string `json:"suggestion"` // Detailed suggestion: pass/review/block
Label string `json:"label"` // Moderation label
Score float64 `json:"score"` // Confidence score
Group string `json:"group,omitempty"` // Group (specific to politician type)
Sample *VideoPoliticianSample `json:"sample,omitempty"` // Reference image information (specific to politician type)
Detections []VideoCensorDetection `json:"detections,omitempty"` // Detected object information
}
VideoCensorCutDetail represents detailed moderation information for a frame extraction
type VideoCensorCutResult ¶
type VideoCensorCutResult struct {
Offset int `json:"offset"` // Time position of the frame extraction (milliseconds)
Suggestion string `json:"suggestion"` // Suggestion for this frame: pass/review/block
URI string `json:"uri,omitempty"` // Frame extraction URI
Details []VideoCensorCutDetail `json:"details,omitempty"` // Detailed information array
}
VideoCensorCutResult represents the moderation result for a frame extraction
type VideoCensorData ¶
type VideoCensorData struct {
URI string `json:"uri"` // Video URI
ID string `json:"id"` // Unique identifier for the video, optional
}
VideoCensorData represents the video data to be moderated
type VideoCensorDetection ¶
type VideoCensorDetection struct {
Pts [][]int `json:"pts"` // Object/face bounding box coordinates
Score float64 `json:"score"` // Confidence score
}
VideoCensorDetection represents detected object information
type VideoCensorJobResponse ¶
type VideoCensorJobResponse struct {
ID string `json:"id"` // Task ID
VID string `json:"vid"` // Unique identifier for the video
Request json.RawMessage `json:"request"` // Original moderation request data
Status string `json:"status"` // Task status: WAITING/DOING/RESCHEDULED/FAILED/FINISHED
Result *VideoCensorResult `json:"result"` // Moderation result
CreatedAt string `json:"created_at"` // Task creation time
UpdatedAt string `json:"updated_at"` // Task update time
RescheduledAt string `json:"rescheduled_at"` // Task retry time
}
VideoCensorJobResponse represents the video moderation task status response
type VideoCensorParams ¶
type VideoCensorParams struct {
Scenes []string `json:"scenes,omitempty"` // Moderation scenes: pulp (pornography), terror (violence), politician (politics), etc.
CutParam *VideoCutParam `json:"cut_param,omitempty"` // Frame extraction parameters
}
VideoCensorParams represents moderation parameters
type VideoCensorRequest ¶
type VideoCensorRequest struct {
Data VideoCensorData `json:"data"`
Params VideoCensorParams `json:"params,omitempty"`
}
VideoCensorRequest represents the request parameters for video moderation
type VideoCensorResult ¶
type VideoCensorResult struct {
Code int `json:"code"` // Processing status: 200 means success
Message string `json:"message"` // Status description
Result *VideoCensorResultDetail `json:"result"` // Moderation result details
}
VideoCensorResult represents the video moderation result
type VideoCensorResultDetail ¶
type VideoCensorResultDetail struct {
Suggestion string `json:"suggestion"` // pass (approved), review (needs manual review), block (violation)
Scenes map[string]VideoCensorSceneResult `json:"scenes"` // Moderation results for each scene
}
VideoCensorResultDetail represents detailed moderation result
type VideoCensorSceneResult ¶
type VideoCensorSceneResult struct {
Suggestion string `json:"suggestion"` // Overall suggestion for this scene: pass/review/block
Cuts []VideoCensorCutResult `json:"cuts"` // Frame extraction moderation result array
}
VideoCensorSceneResult represents the moderation result for a scene
type VideoCensorSubmitResponse ¶
type VideoCensorSubmitResponse struct {
Job string `json:"job"` // Task ID
}
VideoCensorSubmitResponse represents the response for submitting a video moderation task
type VideoCutParam ¶
type VideoCutParam struct {
IntervalMsecs int `json:"interval_msecs"` // Frame extraction interval (milliseconds), e.g., 5000
}
VideoCutParam represents frame extraction parameters
type VideoPoliticianSample ¶
type VideoPoliticianSample struct {
URI string `json:"uri"` // Reference image link
Pts [][]int `json:"pts"` // Face bounding box coordinates of sensitive persons in the reference image
}
VideoPoliticianSample represents reference image information for politicians