Skip to content

Commit

Permalink
Try to find the ffmpeg binary automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
corny committed Dec 21, 2014
1 parent 1a7db76 commit 793c3ac
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions lib/streamio-ffmpeg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,27 @@ def self.ffmpeg_binary=(bin)
@ffmpeg_binary = bin
end

# Get the path to the ffmpeg binary, defaulting to 'ffmpeg'
# Get the path to the ffmpeg binary
#
# @return [String] the path to the ffmpeg binary
def self.ffmpeg_binary
@ffmpeg_binary || 'ffmpeg'
@ffmpeg_binary ||= find_ffmpeg_binary
end

# Tries find the ffmpeg binary
#
# @return [String] the path to the ffmpeg binary
def self.find_ffmpeg_binary
%w(
/usr/bin/avconv
/usr/bin/ffmpeg
/usr/local/bin/avconv
/usr/local/bin/ffmpeg
).each do |path|
return path if File.exists?(path)
end

raise "unable to find ffmpeg binary"
end

end

0 comments on commit 793c3ac

Please sign in to comment.