Class: RVideo::Tools::Ffmpeg2theora

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

Instance Attribute Summary collapse

Attributes included from AbstractTool::InstanceMethods

#command, #options, #original, #raw_result

Instance Method Summary collapse

Methods included from AbstractTool::InstanceMethods

#audio_bit_rate, #audio_channels, #audio_sample_rate, #calculate_height, #calculate_width, #execute, #format_audio_bit_rate, #format_audio_channels, #format_audio_sample_rate, #format_fps, #format_resolution, #fps, #get_audio_bit_rate, #get_audio_channels, #get_audio_sample_rate, #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_resolution, #get_specific_audio_bit_rate, #get_specific_audio_sample_rate, #get_specific_fps, #get_specific_resolution, #get_stereo_audio, #get_video_quality, #initialize, #resolution, #temp_dir, #valid_dimension?, #video_quality

Instance Attribute Details

#raw_metadataObject (readonly)

Returns the value of attribute raw_metadata.



6
7
8
# File 'lib/rvideo/tools/ffmpeg2theora.rb', line 6

def 
  @raw_metadata
end

Instance Method Details

#format_video_quality(params = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/rvideo/tools/ffmpeg2theora.rb', line 12

def format_video_quality(params={})
  bitrate = params[:video_bit_rate].blank? ? nil : params[:video_bit_rate]
  factor = (params[:scale][:width].to_f * params[:scale][:height].to_f * params[:fps].to_f)
  case params[:video_quality]
  when 'low'
    " -v 1 "
  when 'medium'
    "-v 5 "
  when 'high'
    "-v 10 "
  else
    ""
  end
end

#parse_result(result) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/rvideo/tools/ffmpeg2theora.rb', line 27

def parse_result(result)
  if m = /does not exist or has an unknown data format/.match(result)
    raise TranscoderError::InvalidFile, "I/O error"
  end
  
  if m = /General output options/.match(result)
    raise TranscoderError::InvalidCommand, "no command passed to ffmpeg2theora, or no output file specified"
  end
  
  @raw_metadata = result.empty? ? "No Results" : result
  return true
end

#tool_commandObject



8
9
10
# File 'lib/rvideo/tools/ffmpeg2theora.rb', line 8

def tool_command
  'ffmpeg2theora'
end