streamio-ffmpeg 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ == 0.8.2 2011-08-19
2
+
3
+ * Path to ffmpeg binary can now be specified (thanks jonathandean)
4
+ * If ffmpeg output contains "is not supported" the Movie will be considered invalid
5
+
1
6
  == 0.8.1 2011-07-28
2
7
 
3
8
  * Fix progress yielding with ffmpeg 0.8
@@ -94,6 +94,14 @@ Use ffpreset files to avoid headaches when encoding with libx264 (http://www.ffm
94
94
  options = {:video_codec => "libx264", :video_preset => "medium"} # audio_preset and file_preset also availible
95
95
  movie.transcode("movie.mp4", options) # encodes video using libx264-medium.ffpreset
96
96
 
97
+ == Specify the path to ffmpeg
98
+
99
+ By default, streamio assumes that the ffmpeg binary is available in the execution path and named ffmpeg and so will run commands that look something like "ffmpeg -i /path/to/input.file ...". Use the FFMPEG.ffmpeg_binary setter to specify the full path to the binary if necessary:
100
+
101
+ FFMPEG.ffmpeg_binary = '/usr/local/bin/ffmpeg'
102
+
103
+ This will cause the same command to run as "/usr/local/bin/ffmpeg -i /path/to/input.file ..." instead.
104
+
97
105
  == Copyright
98
106
 
99
107
  Copyright (c) 2010 Streamio Networks AB. See LICENSE for details.
@@ -9,7 +9,7 @@ module FFMPEG
9
9
 
10
10
  @path = escape(path)
11
11
 
12
- stdin, stdout, stderr = Open3.popen3("ffmpeg -i '#{path}'") # Output will land in stderr
12
+ stdin, stdout, stderr = Open3.popen3("#{FFMPEG.ffmpeg_binary} -i '#{path}'") # Output will land in stderr
13
13
  output = stderr.read
14
14
 
15
15
  fix_encoding(output)
@@ -44,7 +44,8 @@ module FFMPEG
44
44
  @audio_sample_rate = audio_sample_rate[/\d*/].to_i
45
45
  end
46
46
 
47
- @invalid = @video_stream.to_s.empty? && @audio_stream.to_s.empty?
47
+ @invalid = true if @video_stream.to_s.empty? && @audio_stream.to_s.empty?
48
+ @invalid = true if output.include?("is not supported")
48
49
  end
49
50
 
50
51
  def valid?
@@ -23,7 +23,7 @@ module FFMPEG
23
23
  # ffmpeg < 0.8: frame= 413 fps= 48 q=31.0 size= 2139kB time=16.52 bitrate=1060.6kbits/s
24
24
  # ffmpeg >= 0.8: frame= 4855 fps= 46 q=31.0 size= 45306kB time=00:02:42.28 bitrate=2287.0kbits/
25
25
  def run
26
- command = "ffmpeg -y -i '#{@movie.path}' #{@raw_options} '#{@output_file}'"
26
+ command = "#{FFMPEG.ffmpeg_binary} -y -i '#{@movie.path}' #{@raw_options} '#{@output_file}'"
27
27
  FFMPEG.logger.info("Running transcoding...\n#{command}\n")
28
28
  output = ""
29
29
  last_output = nil
@@ -1,3 +1,3 @@
1
1
  module FFMPEG
2
- VERSION = "0.8.1"
2
+ VERSION = "0.8.2"
3
3
  end
@@ -27,4 +27,20 @@ module FFMPEG
27
27
  logger.level = Logger::INFO
28
28
  @logger = logger
29
29
  end
30
+
31
+ # Set the path of the ffmpeg binary.
32
+ # Can be useful if you need to specify a path such as /usr/local/bin/ffmpeg
33
+ #
34
+ # @param [String] path to the ffmpeg binary
35
+ # @return [String] the path you set
36
+ def self.ffmpeg_binary=(bin)
37
+ @ffmpeg_binary = bin
38
+ end
39
+
40
+ # Get the path to the ffmpeg binary, defaulting to 'ffmpeg'
41
+ #
42
+ # @return [String] the path to the ffmpeg binary
43
+ def self.ffmpeg_binary
44
+ @ffmpeg_binary.nil? ? 'ffmpeg' : @ffmpeg_binary
45
+ end
30
46
  end
metadata CHANGED
@@ -1,38 +1,35 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: streamio-ffmpeg
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.8.2
4
5
  prerelease:
5
- version: 0.8.1
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - David Backeus
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-07-28 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
12
+ date: 2011-08-19 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
16
15
  name: rspec
17
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &2152909420 !ruby/object:Gem::Requirement
18
17
  none: false
19
- requirements:
18
+ requirements:
20
19
  - - ~>
21
- - !ruby/object:Gem::Version
20
+ - !ruby/object:Gem::Version
22
21
  version: 2.6.0
23
22
  type: :development
24
23
  prerelease: false
25
- version_requirements: *id001
26
- description: Simple yet powerful wrapper around ffmpeg to get metadata from movies and do transcoding.
27
- email:
24
+ version_requirements: *2152909420
25
+ description: Simple yet powerful wrapper around ffmpeg to get metadata from movies
26
+ and do transcoding.
27
+ email:
28
28
  - david@streamio.se
29
29
  executables: []
30
-
31
30
  extensions: []
32
-
33
31
  extra_rdoc_files: []
34
-
35
- files:
32
+ files:
36
33
  - lib/ffmpeg/encoding_options.rb
37
34
  - lib/ffmpeg/movie.rb
38
35
  - lib/ffmpeg/transcoder.rb
@@ -43,36 +40,32 @@ files:
43
40
  - CHANGELOG
44
41
  homepage: http://github.com/streamio/streamio-ffmpeg
45
42
  licenses: []
46
-
47
43
  post_install_message:
48
44
  rdoc_options: []
49
-
50
- require_paths:
45
+ require_paths:
51
46
  - lib
52
- required_ruby_version: !ruby/object:Gem::Requirement
47
+ required_ruby_version: !ruby/object:Gem::Requirement
53
48
  none: false
54
- requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- hash: 3076190158678176815
58
- segments:
49
+ requirements:
50
+ - - ! '>='
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ segments:
59
54
  - 0
60
- version: "0"
61
- required_rubygems_version: !ruby/object:Gem::Requirement
55
+ hash: 951887406957158189
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
57
  none: false
63
- requirements:
64
- - - ">="
65
- - !ruby/object:Gem::Version
66
- hash: 3076190158678176815
67
- segments:
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ segments:
68
63
  - 0
69
- version: "0"
64
+ hash: 951887406957158189
70
65
  requirements: []
71
-
72
66
  rubyforge_project:
73
- rubygems_version: 1.7.2
67
+ rubygems_version: 1.8.6
74
68
  signing_key:
75
69
  specification_version: 3
76
70
  summary: Reads metadata and transcodes movies.
77
71
  test_files: []
78
-