Class: MediaConverter
- Inherits:
-
Object
- Object
- MediaConverter
- Defined in:
- lib/media_converter.rb
Instance Method Summary collapse
- #convert_wav_to_mp3(name) ⇒ Object
- #dump_mms_stream(url, name) ⇒ Object
- #extract_wav(name) ⇒ Object
- #generate_flv(input_file, output_file) ⇒ Object
- #genertate_mp3(input_file, output_file) ⇒ Object
Instance Method Details
#convert_wav_to_mp3(name) ⇒ Object
29 30 31 32 33 |
# File 'lib/media_converter.rb', line 29 def convert_wav_to_mp3 name command = "-ab 128 -i #{name}.wav #{name}.mp3" execute("ffmpeg", command) end |
#dump_mms_stream(url, name) ⇒ Object
17 18 19 20 21 |
# File 'lib/media_converter.rb', line 17 def dump_mms_stream url, name command = "-dumpstream -dumpfile #{name}.wma #{url} 2>&1" execute("mplayer", command) end |
#extract_wav(name) ⇒ Object
23 24 25 26 27 |
# File 'lib/media_converter.rb', line 23 def extract_wav name command = "-vo null -vc dummy -ao pcm:file=#{name}.wav #{name}.wma" execute("mplayer", command) end |
#generate_flv(input_file, output_file) ⇒ Object
11 12 13 14 15 |
# File 'lib/media_converter.rb', line 11 def generate_flv input_file, output_file command = "ffmpeg -i #{input_file} -ab 56 -ar 44100 -b 200 -r 15 -s 320x240 -f flv #{output_file} 2>&1" execute("ffmpeg", command) end |
#genertate_mp3(input_file, output_file) ⇒ Object
5 6 7 8 9 |
# File 'lib/media_converter.rb', line 5 def genertate_mp3 input_file, output_file command = "ffmpeg -y -i #{input_file} -vn -ar 44100 -ac 2 -ab 192 -f mp3 #{output_file} 2>&1" execute("ffmpeg", command) end |