Class: LaserBlob::Blob::Video

Inherits:
LaserBlob::Blob show all
Defined in:
app/models/laserblob/blob/video.rb

Instance Attribute Summary

Attributes inherited from LaserBlob::Blob

#data

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from LaserBlob::Blob

#extension, #file, #file=, new, #open, #url, #url=

Methods included from LaserBlob::BlobHelpers

#file_content_type, #file_sha1, filename_from_file

Class Method Details

.process(record, path) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'app/models/laserblob/blob/video.rb', line 29

def self.process(record, path)
  require 'streamio-ffmpeg' unless defined?(FFMPEG)

  video = FFMPEG::Movie.new(path)

  record. = {
    'duration' =>   video.duration,
    'bitrate' =>    video.bitrate,
    'codec' =>      video.video_codec,
    'width' =>      video.width,
    'height' =>     video.height,
    'frame_rate' => video.frame_rate
  }
end

Instance Method Details

#bitrateObject



17
18
19
# File 'app/models/laserblob/blob/video.rb', line 17

def bitrate
  ['bitrate']
end

#codecObject



21
22
23
# File 'app/models/laserblob/blob/video.rb', line 21

def codec
  ['codec']
end

#durationObject



13
14
15
# File 'app/models/laserblob/blob/video.rb', line 13

def duration
  ['duration']
end

#frame_rateObject



25
26
27
# File 'app/models/laserblob/blob/video.rb', line 25

def frame_rate
  ['frame_rate']
end

#heightObject



9
10
11
# File 'app/models/laserblob/blob/video.rb', line 9

def height
  ['height']
end

#widthObject



5
6
7
# File 'app/models/laserblob/blob/video.rb', line 5

def width
  ['width']
end