Class: Abrizer::PackageDashBento

Inherits:
Object
  • Object
show all
Includes:
FilepathHelpers
Defined in:
lib/abrizer/package_dash_bento.rb

Instance Method Summary collapse

Methods included from FilepathHelpers

#adaptations_filepath, #all_media_paths, #audio_filepath, #audio_filepath_fragmented, #basename, #canvas_filepath, #canvas_partial_filepath, #captions_filepath, #data_filepath, #data_partial_filepath, #ffprobe_filepath, #filename_directory, #first_image_filepath, #hlsts_aac_filepath, #hlsts_aac_partial_filepath, #hlsts_filepath, #hlsts_partial_filepath, #mp3_filepath, #mp3_partial_filepath, #mp4_filepath, #mp4_partial_filepath, #mpd_filepath, #mpd_partial_filepath, #output_directory, #output_directory_basename, #poster_filepath, #poster_image_filepath, #poster_partial_filepath, #sprites_filepath, #sprites_partial_filepath, #vp9_filepath, #vp9_partial_filepath, #webvtt_input_filepath

Constructor Details

#initialize(output_dir) ⇒ PackageDashBento

Returns a new instance of PackageDashBento.



6
7
8
9
# File 'lib/abrizer/package_dash_bento.rb', line 6

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

Instance Method Details

#bento_cmdObject



23
24
25
26
27
28
29
30
31
# File 'lib/abrizer/package_dash_bento.rb', line 23

def bento_cmd
  cmd = %Q|mp4dash --output-dir=fmp4 --force --use-segment-template-number-padding --profiles=live --hls |
  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

#packageObject



11
12
13
14
15
# File 'lib/abrizer/package_dash_bento.rb', line 11

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

#video_inputsObject



17
18
19
20
21
# File 'lib/abrizer/package_dash_bento.rb', line 17

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