forked from streamio/streamio-ffmpeg
/
streamio-ffmpeg.rb
46 lines (40 loc) · 1.11 KB
/
streamio-ffmpeg.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
$LOAD_PATH.unshift File.dirname(__FILE__)
require 'logger'
require 'stringio'
require 'ffmpeg/version'
require 'ffmpeg/movie'
require 'ffmpeg/transcoder'
require 'ffmpeg/encoding_options'
module FFMPEG
# FFMPEG logs information about its progress when it's transcoding.
# Jack in your own logger through this method if you wish to.
#
# @param [Logger] log your own logger
# @return [Logger] the logger you set
def self.logger=(log)
@logger = log
end
# Get FFMPEG logger.
#
# @return [Logger]
def self.logger
return @logger if @logger
logger = Logger.new(STDOUT)
logger.level = Logger::INFO
@logger = logger
end
# Set the path of the ffmpeg binary.
# Can be useful if you need to specify a path such as /usr/local/bin/ffmpeg
#
# @param [String] path to the ffmpeg binary
# @return [String] the path you set
def self.ffmpeg_binary=(bin)
@ffmpeg_binary = bin
end
# Get the path to the ffmpeg binary, defaulting to 'ffmpeg'
#
# @return [String] the path to the ffmpeg binary
def self.ffmpeg_binary
@ffmpeg_binary.nil? ? 'ffmpeg' : @ffmpeg_binary
end
end