Sha256: 165a53ec7a71e1dd366d1060b034202c7000eb098634145e8416333ddb839ed4

Contents?: true

Size: 949 Bytes

Versions: 4

Compression:

Stored size: 949 Bytes

Contents

module Abrizer
  class PackageDashBento

    include FilepathHelpers

    def initialize(filename, output_dir=nil)
      @filename = filename
      @output_directory = output_dir
      @adaptations = Abrizer::AdaptationFinder.new(@filename).adaptations
    end

    def package
      # Must change to output directory so this all works as intended
      Dir.chdir output_directory
      `#{bento_cmd}`
    end

    def video_inputs
      @adaptations.map do |adaptation|
        adaptation.filepath_fragmented(@filename, output_directory)
      end
    end

    def bento_cmd
      cmd = %Q|mp4dash --output-dir=fmp4 --force --use-segment-template-number-padding --profiles=live --hls |
      if File.exist? webvtt_input_filepath
        cmd += %Q| [+format=webvtt,+language=eng]#{webvtt_input_filepath} |
      end
      cmd += %Q| #{video_inputs.join(' ')} [+language=eng]#{audio_filepath_fragmented} |
      puts cmd
      cmd
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
abrizer-0.4.0 lib/abrizer/package_dash_bento.rb
abrizer-0.3.0 lib/abrizer/package_dash_bento.rb
abrizer-0.2.0 lib/abrizer/package_dash_bento.rb
abrizer-0.1.0 lib/abrizer/package_dash_bento.rb