Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

correct rounding

  • Loading branch information...
commit 3aabcf2f7834b10f76f4b590f867a8e4551fc8a9 1 parent 5817c6a
@vivienschilis vivienschilis authored
Showing with 3 additions and 1 deletion.
  1. +2 −0  lib/rvideo/tools/abstract_tool.rb
  2. +1 −1  spec/units/ffmpeg_spec.rb
View
2  lib/rvideo/tools/abstract_tool.rb
@@ -259,12 +259,14 @@ def get_specific_resolution
def calculate_width(ow, oh, h)
w = ((ow.to_f / oh.to_f) * h.to_f).to_f rescue get_valid_width
w = get_valid_width if w.nan?
+ w = w.ceil
(w - w % 2)
end
def calculate_height(ow, oh, w)
h = (w.to_f / (ow.to_f / oh.to_f)).to_f rescue get_valid_height
h = get_valid_height if h.nan?
+ h = h.ceil
(h - h % 2)
end
View
2  spec/units/ffmpeg_spec.rb
@@ -106,7 +106,7 @@ module Tools
it 'supports :width and :height options to build :resolution_and_padding with negatif ratio' do
@options.merge! :width => "160", :height => "100"
ffmpeg = Ffmpeg.new("ffmpeg -i $input_file$ -ar 44100 -ab 64 -vcodec xvid -acodec libmp3lame -r 29.97 $resolution_and_padding$ -y $output_file$", @options)
- ffmpeg.command.should == "ffmpeg -i '#{@options[:input_file]}' -ar 44100 -ab 64 -vcodec xvid -acodec libmp3lame -r 29.97 -vf 'scale=132:100' -y '#{@options[:output_file]}'"
+ ffmpeg.command.should == "ffmpeg -i '#{@options[:input_file]}' -ar 44100 -ab 64 -vcodec xvid -acodec libmp3lame -r 29.97 -vf 'scale=134:100' -y '#{@options[:output_file]}'"
end
it 'supports odd value on width or height' do
Please sign in to comment.
Something went wrong with that request. Please try again.