# README
zencoder
Go integration for Zencoder API video transcoding service.
Requirements
- Go 1.1 or higher
- A Zencoder account/API key (get one at app.zencoder.com)
Documentation
Godoc documentation is available at http://godoc.org/github.com/brandscreen/zencoder.
Installation
$ go get github.com/video-dev/zencoder
Usage
Import Zencoder
Ensure you have imported the zencoder package at the top of your source file.
import "github.com/video-dev/zencoder"
Create a connection to Zencoder
All Zencoder methods are on the Zencoder struct. Create a new one bound to your API key using zencoder.NewZencoder
.
// make sure you replace [YOUR API KEY HERE] with your API key
zc := zencoder.NewZencoder("[YOUR API KEY HERE]")
Jobs
Create a Job
settings := &zencoder.EncodingSettings{
Input: "s3://zencodertesting/test.mov",
Test: true,
}
job, err := zc.CreateJob(settings)
List Jobs
jobs, err := zc.ListJobs()
Get Job Details
details, err := zc.GetJobDetails(12345)
Job Progress
progress, err := zc.GetJobProgress(12345)
Resubmit a Job
err := zc.ResubmitJob(12345)
Cancel a Job
err := zc.CancelJob(12345)
Finish a Live Job
err := zc.FinishLiveJob(12345)
Inputs
Get Input Details
details, err := zc.GetInputDetails(12345)
Input Progress
progress, err := zc.GetInputProgress(12345)
Outputs
Get Output Details
details, err := zc.GetOutputDetails(12345)
Output Progress
progress, err := zc.GetOutputProgress(12345)
Accounts
Get Account Details
account, err := zc.GetAccount()
Set Integration Mode
err := zc.SetIntegrationMode()
Set Live Mode
err := zc.SetLiveMode()
Reports
ReportSettings
All reporting interfaces take either nil
or a ReportSettings
object.
Using nil
denotes to use default settings. In this case, assume settings
in the examples below is defined as:
var settings *zencoder.ReportSettings = nil
A ReportSettings
object can either be constructed manually as in:
var start, end time.Date
settings := &zencoder.ReportSettings{
From: &start,
To: &end,
Grouping: "key",
}
Or, you can use a Fluent-style interface to build a ReportSettings
object, as in:
var start, end time.Date
settings := zencoder.ReportFrom(start).To(time).Grouping("key")
Get VOD Usage
usage, err := zc.GetVodUsage(settings)
Get Live Usage
usage, err := zc.GetLiveUsage(settings)
Get Total Usage
usage, err := zc.GetUsage(settings)
Encoding Settings
See Zencoder API documentation for all encoding settings available in zencoder.EncodingSettings. All settings are currently supported, with the main difference being the casing of the options to fit with Go naming conventions.
Contributing
Please see CONTRIBUTING.md. If you have a bugfix or new feature that you would like to contribute, please find or open an issue about it first.
License
Licensed under the MIT License.