ActiveEncode

ActiveEncode

ActiveEncode is the basis for the interface between a Ruby (Rails) application and a provider of transcoding services such as Opencast Matterhorn, Zencoder, and Amazon Elastic Transcoder.

More details: https://github.com/projecthydra-labs/active-encode

 

ActiveEncode is under development and has only been tested with Avalon's default configuration.  Please send any issues and feedback to the avalon discussion email list.

Avalon's use of ActiveEncode

Avalon uses ActiveEncode for transcoding master files into access copies. It should be possible to use any encoding engine supported by ActiveEncode. At this time, however, only Matterhorn is supported at the level required by Avalon. This was planned as a stepping stone to support other encoding services like a local ffmpeg queue, local infrastructure, Zencoder, or Amazon elastic transcoder. Avalon configures ActiveEncode to use matterhorn in an initializer.

When Avalon processes a master file it initializes an ActiveEncode::Base (or subclass) object with the master file (as a file url) and the workflow name determined by Avalon as the preset. This is passed to a background job which submits the encoding job by calling create!. This background job will update the master file with the progress of the encoding every 10 seconds until the encoding job is complete or failed. The master files' progress update reads standard fields from the encoding job to update itself and create derivative objects if processing completed.

Multiple quality pretranscoded derivatives are currently sent to ActiveEncode as a hash of file urls. This will probably change soon to make the processing of skip transcoding master files more lightweight and more general as the current process is very Matterhorn specific.

When a master file is destroyed, Avalon uses ActiveEncode to cancel the encoding job and not purge it. This is because purge is not supported well by Matterhorn and other encoding engines and because Avalon lets the child derivative objects deal with their outputs by calling remove_output!.

Subclassing of ActiveEncode::Base is supported by Avalon through encoder_class reader and writer methods. Avalon will first try to use a class set using the encoder_class writer, then attempt to find a subclass named the same as the master file's workflow name, and fallback to ActiveEncode::Base.

In summary, Avalon uses the following methods/fields provided by ActiveEncode:

Class Methods
#new
#find

Instance Methods
#create!
#cancel!
#id
#remove_output!
#created?
#current_operations
#percent_complete
#errors
#state
#tech_metadata
#output
#options[:preset]