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 +5 -0
- data/README.rdoc +1 -1
- data/lib/ffmpeg/transcoder.rb +11 -2
- data/lib/ffmpeg/version.rb +1 -1
- metadata +7 -4
data/CHANGELOG
CHANGED
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
|
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
|
|
data/lib/ffmpeg/transcoder.rb
CHANGED
@@ -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
|
33
|
-
time
|
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
|
data/lib/ffmpeg/version.rb
CHANGED
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.
|
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-
|
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:
|
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
|
-
|
66
|
+
hash: 3076190158678176815
|
67
|
+
segments:
|
68
|
+
- 0
|
69
|
+
version: "0"
|
67
70
|
requirements: []
|
68
71
|
|
69
72
|
rubyforge_project:
|