Class: VideoConverter::Input
Class Attribute Summary collapse
-
.metadata_command ⇒ Object
Returns the value of attribute metadata_command.
-
.show_frames_command ⇒ Object
Returns the value of attribute show_frames_command.
-
.show_streams_command ⇒ Object
Returns the value of attribute show_streams_command.
Instance Attribute Summary collapse
-
#input ⇒ Object
Returns the value of attribute input.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#output_groups(outputs) ⇒ Object
Returns the value of attribute output_groups.
Instance Method Summary collapse
-
#initialize(input, outputs = []) ⇒ Input
constructor
A new instance of Input.
- #mean_volume ⇒ Object
- #select_outputs(outputs) ⇒ Object
- #to_s ⇒ Object
- #unescape ⇒ Object
- #video_stream ⇒ Object
Constructor Details
#initialize(input, outputs = []) ⇒ Input
Returns a new instance of Input.
15 16 17 18 |
# File 'lib/video_converter/input.rb', line 15 def initialize input, outputs = [] self.input = input or raise ArgumentError.new('Input requred') raise ArgumentError.new("#{input} does not exist") unless exists? end |
Class Attribute Details
.metadata_command ⇒ Object
Returns the value of attribute metadata_command.
6 7 8 |
# File 'lib/video_converter/input.rb', line 6 def @metadata_command end |
.show_frames_command ⇒ Object
Returns the value of attribute show_frames_command.
6 7 8 |
# File 'lib/video_converter/input.rb', line 6 def show_frames_command @show_frames_command end |
.show_streams_command ⇒ Object
Returns the value of attribute show_streams_command.
6 7 8 |
# File 'lib/video_converter/input.rb', line 6 def show_streams_command @show_streams_command end |
Instance Attribute Details
#input ⇒ Object
Returns the value of attribute input.
13 14 15 |
# File 'lib/video_converter/input.rb', line 13 def input @input end |
#metadata ⇒ Object
Returns the value of attribute metadata.
13 14 15 |
# File 'lib/video_converter/input.rb', line 13 def @metadata end |
#output_groups(outputs) ⇒ Object
Returns the value of attribute output_groups.
13 14 15 |
# File 'lib/video_converter/input.rb', line 13 def output_groups @output_groups end |
Instance Method Details
#mean_volume ⇒ Object
73 74 75 |
# File 'lib/video_converter/input.rb', line 73 def mean_volume @mean_volume ||= Command.new(Ffmpeg.volume_detect_command, :bin => Ffmpeg.bin, :input => input).capture.match(/mean_volume:\s([-\d.]+)\sdB/).to_a[1] end |
#select_outputs(outputs) ⇒ Object
77 78 79 |
# File 'lib/video_converter/input.rb', line 77 def select_outputs(outputs) outputs.select { |output| !output.path || output.path == input } end |
#to_s ⇒ Object
20 21 22 |
# File 'lib/video_converter/input.rb', line 20 def to_s input end |
#unescape ⇒ Object
24 25 26 |
# File 'lib/video_converter/input.rb', line 24 def unescape input.gsub(/\\+([^n])/, '\1') end |
#video_stream ⇒ Object
69 70 71 |
# File 'lib/video_converter/input.rb', line 69 def video_stream [:video_streams].first end |