Class: VideoConverter::F4fpackager

Inherits:
Object
  • Object
show all
Defined in:
lib/video_converter/f4fpackager.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.binObject

Returns the value of attribute bin.



6
7
8
# File 'lib/video_converter/f4fpackager.rb', line 6

def bin
  @bin
end

.commandObject

Returns the value of attribute command.



6
7
8
# File 'lib/video_converter/f4fpackager.rb', line 6

def command
  @command
end

.help_commandObject

Returns the value of attribute help_command.



6
7
8
# File 'lib/video_converter/f4fpackager.rb', line 6

def help_command
  @help_command
end

.inspect_index_commandObject

Returns the value of attribute inspect_index_command.



6
7
8
# File 'lib/video_converter/f4fpackager.rb', line 6

def inspect_index_command
  @inspect_index_command
end

Class Method Details

.run(output) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/video_converter/f4fpackager.rb', line 14

def self.run(output)
  manifest = nil
  output.streams.each_with_index do |stream, index|
    VideoConverter::Command.new(command, prepare_params(output.options.merge({
      :input_file => File.join(output.work_dir, stream[:path]),
      :output_path => output.work_dir,
      :bitrate => stream[:bandwidth],
      :manifest_file => manifest,
      :log => output.log
    }))).execute or return false
    FileUtils.rm manifest if manifest
    quality = File.basename(stream[:path], '.*')
    manifest = File.join(output.work_dir, quality + '.f4m')
    # extract fragments
    extract_fragments(output, quality) unless output.no_fragments
  end
  FileUtils.mv(manifest, File.join(output.work_dir, output.filename))
  true
end