Module: Bagel::Video::FFMPEG
- Defined in:
- lib/bagel/video/ffmpeg.rb,
lib/bagel/video/ffmpeg/concat_file.rb,
lib/bagel/video/ffmpeg/fade_filter.rb,
lib/bagel/video/ffmpeg/overlay_filter.rb
Defined Under Namespace
Classes: ConcatFile, FadeFilter, OverlayFilter
Constant Summary
collapse
- INDEX_VIDEO =
0
- LABEL_VIDEO =
'v'
- LABEL_OVERLAY =
'o'
Class Method Summary
collapse
Class Method Details
.concat(source:, destination:, transcode: false) ⇒ Object
9
10
11
12
13
14
15
16
17
|
# File 'lib/bagel/video/ffmpeg.rb', line 9
def self.concat(source:, destination:, transcode: false)
ConcatFile.create(source) do |path|
command = "ffmpeg -y -f concat -safe 0"
command << " -i #{path}"
command << " -c copy" unless transcode
command << " #{destination}"
system(command)
end
end
|
.filter(inputs:, filters:, destination:) ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/bagel/video/ffmpeg.rb', line 29
def self.filter(inputs:, filters:, destination:)
inputs = inputs.map { |input| "-i #{input} -loop 1" }.join(' ')
filters = filters.join(';')
command = "ffmpeg -y"
command << " #{inputs}"
command << " -filter_complex \"#{filters}\""
command << " -c:a copy"
command << " #{destination}"
system(command)
end
|
.trim(start:, source:, duration:, transcode: false, destination:) ⇒ Object
19
20
21
22
23
24
25
26
27
|
# File 'lib/bagel/video/ffmpeg.rb', line 19
def self.trim(start:, source:, duration:, transcode: false, destination:)
command = "ffmpeg -y"
command << " -ss #{start}"
command << " -i #{source}"
command << " -to #{duration}"
command << " -c copy" unless transcode
command << " -avoid_negative_ts make_zero #{destination}"
system(command)
end
|