Class: VTranscoder

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

Constant Summary collapse

FFMPEG_OPTIONS =
{
  :b => 800,
  :r => 25,
  :vcodec => 'flv',
  :acodec => 'libmp3lame',
  :ab => 128,
  :ar => 44100
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source) ⇒ VTranscoder

Returns a new instance of VTranscoder.



18
19
20
21
# File 'lib/vtranscoder.rb', line 18

def initialize(source)
  @source = source
  verify_source_exists
end

Instance Attribute Details

#sourceObject

Returns the value of attribute source.



3
4
5
# File 'lib/vtranscoder.rb', line 3

def source
  @source
end

Class Method Details

.retrieve(url) ⇒ Object



14
15
16
# File 'lib/vtranscoder.rb', line 14

def self.retrieve(url)
  # download a file to a temporary location and return a VTranscoder object referencing it
end

Instance Method Details

#convert(destination) ⇒ Object



28
29
30
# File 'lib/vtranscoder.rb', line 28

def convert(destination)
  convert_with_options destination, FFMPEG_OPTIONS
end

#convert_with_options(destination, options) ⇒ Object



23
24
25
26
# File 'lib/vtranscoder.rb', line 23

def convert_with_options(destination,options)
  verify_ffmpeg_exists
  run_ffmpeg options, destination
end