Skip to content

bletchley/transmuxer

Repository files navigation

Transmuxer

A library for converting videos into HLS format.

Installation

Add this line to your application's Gemfile:

gem 'transmuxer'

And then execute:

$ bundle

Or install it yourself as:

$ gem install transmuxer

Usage

Generate Migration

To set up transmuxing for Medium model, run the following:

rails generate transmuxer media

Configuration

Notifications Host

Transmuxer.config do |c|
  c.notifications_host = "NOTIFICATIONS_HOST"
end

Zencoder

Transmuxer.config do |c|
  c.zencoder.api_key = "ZENCODER_API_KEY"
end

S3

Transmuxer.config do |c|
  c.s3.bucket_name = "S3_BUCKET_NAME"
end

Add to Active Record model

class Medium < ActiveRecord::Base
  include Transmuxer::Transmuxable
  transmuxable :original_url

  def original_url
    "PUBLICLY_ACCESSIBLE_URL"
  end
end

Additional class methods

Transmuxer::Transmuxable adds several class methods for finding objects that match a given state:

  • .processed returns videos that have finished processing.
  • .failed returns videos that failed processing.

Start Transmuxing

m = Medium.first
m.transmux 

you can pass { audio: true } to transmux if you only want to transcode to mp3

Restart Transmuxing

m = Medium.first
m.transmux_retry

Check Transmuxing Progress

m = Medium.first
m.transmux_progress

Contributing

  1. Fork it ( https://github.com/[my-github-username]/transmuxer/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages