Class: Av::Commands::Ffmpeg
- Inherits:
-
Base
- Object
- Base
- Av::Commands::Ffmpeg
show all
- Defined in:
- lib/av/commands/ffmpeg.rb
Instance Attribute Summary
Attributes inherited from Base
#audio_filters, #command_name, #default_params, #destination, #input_params, #options, #output_format, #output_params, #source, #video_filters
Instance Method Summary
collapse
Methods inherited from Base
#add_destination, #add_input_param, #add_output_param, #add_source, #identify, #parse_param, #reset_default_filters, #reset_input_filters, #reset_output_filters, #run, #set_input_params, #set_output_params
Constructor Details
#initialize(options = {}) ⇒ Ffmpeg
8
9
10
11
12
|
# File 'lib/av/commands/ffmpeg.rb', line 8
def initialize(options = {})
super(options)
@command_name = "ffmpeg"
end
|
Instance Method Details
#filter_concat(list) ⇒ Object
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/av/commands/ffmpeg.rb', line 14
def filter_concat list
index_file = Tempfile.new('ffmpeg-concat')
File.open(index_file, 'w') do |file|
list.each do |item|
file.write("file '#{item}'\n")
end
end
add_input_param concat: "-i #{index_file.path}"
self
end
|
#filter_rotate(degrees) ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/av/commands/ffmpeg.rb', line 30
def filter_rotate degrees
raise ::Av::InvalidFilterParameter unless degrees % 90 == 0
case degrees
when 90
add_input_param vf: 'transpose=1'
when 180
add_input_param vf: 'vflip,hflip'
when 270
add_input_param vf: 'transpose=2'
end
self
end
|
#filter_volume(vol) ⇒ Object
25
26
27
28
|
# File 'lib/av/commands/ffmpeg.rb', line 25
def filter_volume vol
add_input_param af: "volume=#{vol}"
self
end
|