Class: StripAudio::Stripper

Inherits:
Object
  • Object
show all
Defined in:
lib/strip_audio/stripper.rb

Constant Summary collapse

@@options =
{format: "mp3", bitrate: "160k"}

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Stripper

Returns a new instance of Stripper.



9
10
11
12
13
# File 'lib/strip_audio/stripper.rb', line 9

def initialize options
  @@options.merge(options)

  doctor
end

Instance Method Details

#strip(video_file) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/strip_audio/stripper.rb', line 15

def strip video_file

  begin
    audio_file_exists?( video_file )
  rescue Exception => e
    puts e.message
    exit
  end

  o = `ffmpeg -i #{video_file} -ab #{@@options[:bitrate]} -ac 2 -ar 44100 -vn #{audio_file(video_file)} 2>&1`
  begin
    command_output o
  rescue Exception => e
    puts e.message
  end
end