streamio-ffmpeg 0.8.0 → 0.8.1

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.1 2011-07-28
2
+
3
+ * Fix progress yielding with ffmpeg 0.8
4
+ * Updated specs to pass with ffmpeg 0.8
5
+
1
6
  == 0.8.0 2011-05-26
2
7
 
3
8
  * Duration is now ALWAYS considered uncertain (we've noticed that ffmpeg is not always correct)
data/README.rdoc CHANGED
@@ -6,7 +6,7 @@ Simple yet powerful wrapper around the ffmpeg command for reading metadata and t
6
6
 
7
7
  (sudo) gem install streamio-ffmpeg
8
8
 
9
- This version is written against an ffmpeg build from july 2010 (tested against r24069). So no guarantees with earlier (or much later) versions. Output and input standards have inconveniently changed rather a lot between versions of ffmpeg. My goal is to keep this library in sync with new versions of ffmpeg as they come along.
9
+ This version is tested against ffmpeg 0.8. So no guarantees with earlier (or much later) versions. Output and input standards have inconveniently changed rather a lot between versions of ffmpeg. My goal is to keep this library in sync with new versions of ffmpeg as they come along.
10
10
 
11
11
  == Usage
12
12
 
@@ -20,17 +20,26 @@ module FFMPEG
20
20
  apply_transcoder_options
21
21
  end
22
22
 
23
+ # ffmpeg < 0.8: frame= 413 fps= 48 q=31.0 size= 2139kB time=16.52 bitrate=1060.6kbits/s
24
+ # ffmpeg >= 0.8: frame= 4855 fps= 46 q=31.0 size= 45306kB time=00:02:42.28 bitrate=2287.0kbits/
23
25
  def run
24
26
  command = "ffmpeg -y -i '#{@movie.path}' #{@raw_options} '#{@output_file}'"
25
27
  FFMPEG.logger.info("Running transcoding...\n#{command}\n")
26
28
  output = ""
27
29
  last_output = nil
28
30
  Open3.popen3(command) do |stdin, stdout, stderr|
31
+ yield(0.0) if block_given?
29
32
  stderr.each("r") do |line|
30
33
  fix_encoding(line)
31
34
  output << line
32
- if line =~ /time=(\d+.\d+)/
33
- time = $1.to_f
35
+ if line.include?("time=")
36
+ if line =~ /time=(\d+):(\d+):(\d+.\d+)/ # ffmpeg 0.8 and above style
37
+ time = ($1.to_i * 3600) + ($2.to_i * 60) + $3.to_f
38
+ elsif line =~ /time=(\d+.\d+)/ # ffmpeg 0.7 and below style
39
+ time = $1.to_f
40
+ else # better make sure it wont blow up in case of unexpected output
41
+ time = 0.0
42
+ end
34
43
  progress = time / @movie.duration
35
44
  yield(progress) if block_given?
36
45
  end
@@ -1,3 +1,3 @@
1
1
  module FFMPEG
2
- VERSION = "0.8.0"
2
+ VERSION = "0.8.1"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: streamio-ffmpeg
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.8.0
5
+ version: 0.8.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - David Backeus
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-26 00:00:00 Z
13
+ date: 2011-07-28 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
@@ -54,7 +54,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
54
54
  requirements:
55
55
  - - ">="
56
56
  - !ruby/object:Gem::Version
57
- hash: -4354055556747967075
57
+ hash: 3076190158678176815
58
58
  segments:
59
59
  - 0
60
60
  version: "0"
@@ -63,7 +63,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
63
63
  requirements:
64
64
  - - ">="
65
65
  - !ruby/object:Gem::Version
66
- version: 1.3.6
66
+ hash: 3076190158678176815
67
+ segments:
68
+ - 0
69
+ version: "0"
67
70
  requirements: []
68
71
 
69
72
  rubyforge_project: