Skip to content

video-dev/zencoder

 
 

Repository files navigation

zencoder

Build Status Coverage Status

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]")
settings := &zencoder.EncodingSettings{
    Input: "s3://zencodertesting/test.mov",
    Test:  true,
}
job, err := zc.CreateJob(settings)
jobs, err := zc.ListJobs()
details, err := zc.GetJobDetails(12345)
progress, err := zc.GetJobProgress(12345)
err := zc.ResubmitJob(12345)
err := zc.CancelJob(12345)
err := zc.FinishLiveJob(12345)
details, err := zc.GetInputDetails(12345)
progress, err := zc.GetInputProgress(12345)
details, err := zc.GetOutputDetails(12345)
progress, err := zc.GetOutputProgress(12345)
account, err := zc.GetAccount()
err := zc.SetIntegrationMode()
err := zc.SetLiveMode()

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")
usage, err := zc.GetVodUsage(settings)
usage, err := zc.GetLiveUsage(settings)
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.

About

Go interface for Zencoder API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%