Class: RVideo::Tools::Lame

Inherits:
Object
  • Object
show all
Includes:
AbstractTool::InstanceMethods
Defined in:
lib/rvideo/tools/lame.rb

Instance Attribute Summary collapse

Attributes included from AbstractTool::InstanceMethods

#command, #options, #progress, #raw_result

Instance Method Summary collapse

Methods included from AbstractTool::InstanceMethods

abstract_attribute_formatter, #audio_bit_rate, #audio_channels, #audio_sample_rate, #calculate_height, #calculate_width, #deinterlace, #do_execute, #execute, #fps, #get_audio_bit_rate, #get_audio_channels, #get_audio_sample_rate, #get_constrain_resolution, #get_deinterlace, #get_fit_to_height_resolution, #get_fit_to_width_resolution, #get_fps, #get_letterbox_resolution, #get_mono_audio, #get_original_fps, #get_original_resolution, #get_padding_resolution, #get_resolution, #get_specific_audio_bit_rate, #get_specific_audio_sample_rate, #get_specific_fps, #get_specific_resolution, #get_stereo_audio, #get_valid_height, #get_valid_width, #get_video_bit_rate, #get_video_bit_rate_max, #get_video_bit_rate_min, #get_video_bit_rate_tolerance, #get_video_quality, #initialize, #original, #original=, #resolution, #resolution_and_padding, #resolution_keep_aspect_ratio, #temp_dir, #valid_dimension?, #video_bit_rate, #video_bit_rate_max, #video_bit_rate_min, #video_bit_rate_tolerance, #video_quality

Instance Attribute Details

#raw_metadataObject (readonly)

Returns the value of attribute raw_metadata.



5
6
7
# File 'lib/rvideo/tools/lame.rb', line 5

def 
  @raw_metadata
end

Instance Method Details

#do_execute_with_progress(command, &block) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/rvideo/tools/lame.rb', line 19

def do_execute_with_progress(command,&block)
  @raw_result = ''
  CommandExecutor::execute_with_block(command, "\r") do |line|
    progress = parse_progress(line)
    block.call(progress) if block && progress
    @raw_result += line + "\r"
  end
end

#execute_with_progress(&block) ⇒ Object



12
13
14
15
16
17
# File 'lib/rvideo/tools/lame.rb', line 12

def execute_with_progress(&block)
  RVideo.logger.info("\nExecuting Command: #{@command}\n")
  do_execute_with_progress(@command, &block)
rescue RVideo::CommandExecutor::ProcessHungError
  raise TranscoderError, "Transcoder hung."
end

#parse_progress(line) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/rvideo/tools/lame.rb', line 28

def parse_progress(line)
  if line =~ /\((\d+)\%\)/
    $1.to_i > 100 ? 100 : $1.to_i
  else
    nil
  end
end

#tool_commandObject



7
8
9
# File 'lib/rvideo/tools/lame.rb', line 7

def tool_command
  'lame'
end