Sha256: 1af0d3e36a10a36052107eb869c5fd08d35b88dfc85659b8b0c9b901dd2c31dc

Contents?: true

Size: 907 Bytes

Versions: 2

Compression:

Stored size: 907 Bytes

Contents

module Abrizer
  class PackageHlsBento

    include FilepathHelpers

    def initialize(output_dir)
      @output_directory = output_dir
      @adaptations = Abrizer::AdaptationFinder.new(output_directory: @output_directory).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(output_directory)
      end
    end

    def bento_cmd
      cmd = %Q|mp4hls --output-dir=hls --force --output-single-file |
      if webvtt_input_filepath && 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

2 entries across 2 versions & 1 rubygems

Version Path
abrizer-0.6.0 lib/abrizer/package_hls_bento.rb
abrizer-0.5.0 lib/abrizer/package_hls_bento.rb