Class: Scissor::VideoFile

Inherits:
Object
  • Object
show all
Defined in:
lib/scissor-video/video_file.rb

Defined Under Namespace

Classes: Error, UnknownFormat

Constant Summary collapse

SUPPORTED_FORMATS =
%w/avi flv/

Instance Method Summary collapse

Constructor Details

#initialize(filename) ⇒ VideoFile

Returns a new instance of VideoFile.



9
10
11
12
13
14
15
16
# File 'lib/scissor-video/video_file.rb', line 9

def initialize(filename)
  @filename = Pathname.new(filename)
  @ext = @filename.extname.sub(/^\./, '').downcase

  unless SUPPORTED_FORMATS.include?(@ext)
    raise UnknownFormat
  end
end

Instance Method Details

#lengthObject



18
19
20
21
22
23
# File 'lib/scissor-video/video_file.rb', line 18

def length
#      FFmpeg.new.get_duration(@filename)
#      FFmpeg.get_duration(@filename)
#      ffmpeg.get_duration(@filename)
  Scissor.ffmpeg.get_duration(@filename)
end