Class: FFMPEG::EncodingOptions
- Inherits:
-
Hash
- Object
- Hash
- FFMPEG::EncodingOptions
- Defined in:
- lib/ffmpeg/encoding_options.rb
Instance Method Summary collapse
- #height ⇒ Object
-
#initialize(options = {}) ⇒ EncodingOptions
constructor
A new instance of EncodingOptions.
- #to_s ⇒ Object
- #width ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ EncodingOptions
Returns a new instance of EncodingOptions.
3 4 5 |
# File 'lib/ffmpeg/encoding_options.rb', line 3 def initialize( = {}) merge!() end |
Instance Method Details
#height ⇒ Object
28 29 30 |
# File 'lib/ffmpeg/encoding_options.rb', line 28 def height self[:resolution].split("x").last.to_i rescue nil end |
#to_s ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ffmpeg/encoding_options.rb', line 7 def to_s params = collect do |key, value| send("convert_#{key}", value) if value && supports_option?(key) end # codecs should go before the presets so that the files will be matched successfully # all other parameters go after so that we can override whatever is in the preset codecs = params.select { |p| p =~ /codec/ } presets = params.select { |p| p =~ /\-.pre/ } other = params - codecs - presets params = codecs + presets + other params_string = params.join(" ") params_string << " #{convert_aspect(calculate_aspect)}" if calculate_aspect? params_string end |
#width ⇒ Object
24 25 26 |
# File 'lib/ffmpeg/encoding_options.rb', line 24 def width self[:resolution].split("x").first.to_i rescue nil end |