File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,10 +39,27 @@ def self.ffmpeg_binary=(bin)
3939 @ffmpeg_binary = bin
4040 end
4141
42- # Get the path to the ffmpeg binary, defaulting to 'ffmpeg'
42+ # Get the path to the ffmpeg binary
4343 #
4444 # @return [String] the path to the ffmpeg binary
4545 def self . ffmpeg_binary
46- @ffmpeg_binary || 'ffmpeg'
46+ @ffmpeg_binary ||= find_ffmpeg_binary
4747 end
48+
49+ # Tries find the ffmpeg binary
50+ #
51+ # @return [String] the path to the ffmpeg binary
52+ def self . find_ffmpeg_binary
53+ %w(
54+ /usr/bin/avconv
55+ /usr/bin/ffmpeg
56+ /usr/local/bin/avconv
57+ /usr/local/bin/ffmpeg
58+ ) . each do |path |
59+ return path if File . exists? ( path )
60+ end
61+
62+ raise "unable to find ffmpeg binary"
63+ end
64+
4865end
Original file line number Diff line number Diff line change 2727 FFMPEG . ffmpeg_binary = nil
2828 end
2929
30- it "should default to 'ffmpeg'" do
31- FFMPEG . ffmpeg_binary . should == 'ffmpeg'
30+ it "should default to 'avconv'" do
31+ File . stub ( :exists? ) { true }
32+ FFMPEG . ffmpeg_binary . should == '/usr/bin/avconv'
3233 end
3334
3435 it "should be assignable" do
You can’t perform that action at this time.
0 commit comments