Module: VideoDimensions

Defined in:
lib/video_dimensions.rb,
lib/video_dimensions/version.rb,
lib/video_dimensions/backends.rb,
lib/video_dimensions/backends/base.rb,
lib/video_dimensions/backends/ffmpeg.rb,
lib/video_dimensions/backends/media_info.rb

Defined Under Namespace

Modules: Backends

Constant Summary collapse

VERSION =
"0.3.1"

Class Method Summary collapse

Class Method Details

.bitrate(input) ⇒ Object

Public: Video bitrate

input - Path to video file

Examples

VideoDimensions('720p.wmv').bitrate # => 5904

Returns video bitrate in kbps



87
88
89
# File 'lib/video_dimensions.rb', line 87

def bitrate(input)
  process(:bitrate, input)
end

.codec(input) ⇒ Object

Public: Video codec

input - Path to video file

Examples

VideoDimensions('720p.wmv').codec # => "wmv3"

Returns video codec ID



100
101
102
# File 'lib/video_dimensions.rb', line 100

def codec(input)
  process(:codec, input)
end

.dimensions(input) ⇒ Object

Public: Video dimensions

input - Path to video file

Examples

VideoDimensions('720p.wmv').dimensions # => [1280, 720]

Returns video dimensions as an array of width and height in pixels.



48
49
50
# File 'lib/video_dimensions.rb', line 48

def dimensions(input)
  process(:dimensions, input)
end

.duration(input) ⇒ Object

Public: Video duration

input - Path to video file

Examples

VideoDimensions('720p.wmv').duration # => "00:00:02"

Returns video duration as a string in hh:mm:ss format



113
114
115
# File 'lib/video_dimensions.rb', line 113

def duration(input)
  process(:duration, input)
end

.framerate(input) ⇒ Object

Public: Video framerate

input - Path to video file

Examples

VideoDimensions('720p.wmv').framerate # => 21.83

Returns video framerate in frames per second as a float



126
127
128
# File 'lib/video_dimensions.rb', line 126

def framerate(input)
  process(:framerate, input)
end

.height(input) ⇒ Object

Public: Video height

input - Path to video file

Examples

VideoDimensions('720p.wmv').height # => 720

Returns video height in pixels



74
75
76
# File 'lib/video_dimensions.rb', line 74

def height(input)
  process(:height, input)
end

.width(input) ⇒ Object

Public: Video width

input - Path to video file

Examples

VideoDimensions('720p.wmv').width # => 1280

Returns video width in pixels



61
62
63
# File 'lib/video_dimensions.rb', line 61

def width(input)
  process(:width, input)
end