Class: Bagel::Video::ClipSaver

Inherits:
Object
  • Object
show all
Defined in:
lib/bagel/video/clip_saver.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(clip) ⇒ ClipSaver

Returns a new instance of ClipSaver.



5
6
7
# File 'lib/bagel/video/clip_saver.rb', line 5

def initialize(clip)
  @clip = clip
end

Instance Attribute Details

#clipObject (readonly)

Returns the value of attribute clip.



3
4
5
# File 'lib/bagel/video/clip_saver.rb', line 3

def clip
  @clip
end

Instance Method Details

#saveObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/bagel/video/clip_saver.rb', line 9

def save
  FFMPEG.trim(
    source: Bagel.config.source_video,
    start: clip.start,
    duration: clip.duration,
    destination: clip.trim_path
  )

  FFMPEG.filter(
    inputs: inputs,
    filters: filters,
    destination: clip.clip_path
  )
end