-
Notifications
You must be signed in to change notification settings - Fork 73
How to Integrate with the Video Transcoding API?
Flávio Ribeiro edited this page Dec 14, 2016
·
6 revisions
This document aims to describe the steps to integrate a transcoding provider with the Video Transcoding API.
In a high level, an encoding provider should be able to store Presets and run encoding Jobs.
A Preset consists of a set of configurations such as codec, resolution, bitrate, GOP size and others. The Transcoding API will be responsible to call the CreatePreset()
method and map the presetID
returned by the call in an internal PresetMap so the same Preset Name can be reused across all providers.
Here you can see the Preset type. You can also check the presets being used at The New York Times.
type TranscodingProvider interface {
Transcode(*db.Job) (*JobStatus, error)
JobStatus(*db.Job) (*JobStatus, error)
CancelJob(id string) error
CreatePreset(db.Preset) (string, error)
DeletePreset(presetID string) error
GetPreset(presetID string) (interface{}, error)
// Healthcheck should return nil if the provider is currently available
// for transcoding videos, otherwise it should return an error
// explaining what's going on.
Healthcheck() error
// Capabilities describes the capabilities of the provider.
Capabilities() Capabilities
}
type Job struct {
ID string `redis-hash:"jobID" json:"jobId"`
ProviderName string `redis-hash:"providerName" json:"providerName"`
ProviderJobID string `redis-hash:"providerJobID" json:"providerJobId"`
StreamingParams StreamingParams `redis-hash:"streamingparams,expand" json:"streamingParams,omitempty"`
CreationTime time.Time `redis-hash:"creationTime" json:"creationTime"`
SourceMedia string `redis-hash:"source" json:"source"`
Outputs []TranscodeOutput `redis-hash:"-" json:"outputs"`
}
type JobStatus struct {
ProviderJobID string `json:"providerJobId,omitempty"`
Status Status `json:"status,omitempty"`
ProviderName string `json:"providerName,omitempty"`
StatusMessage string `json:"statusMessage,omitempty"`
Progress float64 `json:"progress"`
ProviderStatus map[string]interface{} `json:"providerStatus,omitempty"`
Output JobOutput `json:"output"`
SourceInfo SourceInfo `json:"sourceInfo,omitempty"`
}