streamio-ffmpeg 0.6.7 → 0.6.8

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,10 +1,15 @@
1
+ == 0.6.8 2010-07-06
2
+
3
+ * Don't use encoding options with nil values
4
+ * Added encoding options video_max_bitrate, video_min_bitrate and buffer_size for constant bitrate encoding
5
+
1
6
  == 0.6.7 2010-06-10
2
7
 
3
8
  * Bugfix - aspect ratio preserver could suggest non even resolutions in certain circumstances
4
9
 
5
10
  == 0.6.6 2010-06-10
6
11
 
7
- * Transcodings to .jpg and .png will now work as they will skip duration validation.
12
+ * Transcodings to .jpg and .png will now work as they will skip duration validation
8
13
 
9
14
  == 0.6.5 2010-05-19
10
15
 
data/README.rdoc CHANGED
@@ -52,11 +52,12 @@ Give custom command line options with a string.
52
52
 
53
53
  movie.transcode("movie.mp4", "-ac aac -vc libx264 -ac 2 ...")
54
54
 
55
- Use the EncodingOptions parser for humanly readable transcoding options. Below you'll find all the supported options. Note that the :custom key will be used as is without modification so use it for any tricky business you might need.
55
+ Use the EncodingOptions parser for humanly readable transcoding options. Below you'll find most of the supported options. Note that the :custom key will be used as is without modification so use it for any tricky business you might need.
56
56
 
57
57
  options = {:video_codec => "libx264", :frame_rate => 10, :resolution => "320x240", :video_bitrate => 300,
58
58
  :croptop => 60, :cropbottom => 60, :cropleft => 10, :cropright => 10, :aspect => 1.333333,
59
59
  :audio_codec => "libfaac", :audio_bitrate => 32, :audio_sample_rate => 22050, :audio_channels => 1,
60
+ :threads => 2,
60
61
  :custom => "-flags +loop -cmp +chroma -partitions +parti4x4+partp8x8 -flags2 +mixed_refs -me_method umh -subq 6 -refs 6 -rc_eq 'blurCplx^(1-qComp)' -coder 0 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 21"}
61
62
  movie.transcode("movie.mp4", options)
62
63
 
@@ -83,6 +84,11 @@ Preserve aspect ratio on width or height by using the preserve_aspect_ratio tran
83
84
  transcoder_options = {:preserve_aspect_ratio => :height}
84
85
  widescreen_movie.transcode("movie.mp4", options, transcoder_options) # Output resolution will be 426x240
85
86
 
87
+ For constant bitrate encoding use video_min_bitrate and video_max_bitrate with buffer_size.
88
+
89
+ options = {:video_min_bitrate => 600, :video_max_bitrate => 600, :buffer_size => 2000}
90
+ movie.transcode("movie.mp4", options)
91
+
86
92
  == Copyright
87
93
 
88
94
  Copyright (c) 2010 David Backeus. See LICENSE for details.
data/Rakefile CHANGED
@@ -10,7 +10,7 @@ begin
10
10
  gem.email = "duztdruid@gmail.com"
11
11
  gem.homepage = "http://github.com/streamio/streamio-ffmpeg"
12
12
  gem.authors = ["David Backeus"]
13
- gem.add_development_dependency "rspec", ">= 1.2.9"
13
+ gem.add_development_dependency "rspec", "1.3.0"
14
14
  end
15
15
  Jeweler::GemcutterTasks.new
16
16
  rescue LoadError
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.7
1
+ 0.6.8
@@ -1,5 +1,3 @@
1
- # Include support for -bt -maxrate -minrate -bufsize?
2
-
3
1
  module FFMPEG
4
2
  class EncodingOptions < Hash
5
3
  def initialize(options = {})
@@ -8,7 +6,7 @@ module FFMPEG
8
6
 
9
7
  def to_s
10
8
  parameters = collect do |key, value|
11
- send("convert_#{key}", value) if supports_option?(key)
9
+ send("convert_#{key}", value) if value && supports_option?(key)
12
10
  end.join(" ")
13
11
  parameters << " #{convert_aspect(calculate_aspect)}" if calculate_aspect?
14
12
  parameters
@@ -70,7 +68,7 @@ module FFMPEG
70
68
  end
71
69
 
72
70
  def convert_video_bitrate(value)
73
- "-b #{value}#{k_format(value)}"
71
+ "-b #{k_format(value)}"
74
72
  end
75
73
 
76
74
  def convert_audio_codec(value)
@@ -78,7 +76,7 @@ module FFMPEG
78
76
  end
79
77
 
80
78
  def convert_audio_bitrate(value)
81
- "-ab #{value}#{k_format(value)}"
79
+ "-ab #{k_format(value)}"
82
80
  end
83
81
 
84
82
  def convert_audio_sample_rate(value)
@@ -89,12 +87,28 @@ module FFMPEG
89
87
  "-ac #{value}"
90
88
  end
91
89
 
90
+ def convert_video_max_bitrate(value)
91
+ "-maxrate #{k_format(value)}"
92
+ end
93
+
94
+ def convert_video_min_bitrate(value)
95
+ "-minrate #{k_format(value)}"
96
+ end
97
+
98
+ def convert_buffer_size(value)
99
+ "-bufsize #{k_format(value)}"
100
+ end
101
+
102
+ def convert_threads(value)
103
+ "-threads #{value}"
104
+ end
105
+
92
106
  def convert_custom(value)
93
107
  value
94
108
  end
95
109
 
96
110
  def k_format(value)
97
- "k" unless value.to_s.include?("k")
111
+ value.to_s.include?("k") ? value : "#{value}k"
98
112
  end
99
113
  end
100
114
  end
@@ -70,10 +70,30 @@ module FFMPEG
70
70
  EncodingOptions.new(:audio_channels => 2).to_s.should == "-ac 2"
71
71
  end
72
72
 
73
+ it "should convert maximum video bitrate" do
74
+ EncodingOptions.new(:video_max_bitrate => 600).to_s.should == "-maxrate 600k"
75
+ end
76
+
77
+ it "should convert mininimum video bitrate" do
78
+ EncodingOptions.new(:video_min_bitrate => 600).to_s.should == "-minrate 600k"
79
+ end
80
+
81
+ it "should convert buffer size" do
82
+ EncodingOptions.new(:buffer_size => 2000).to_s.should == "-bufsize 2000k"
83
+ end
84
+
85
+ it "should convert threads" do
86
+ EncodingOptions.new(:threads => 2).to_s.should == "-threads 2"
87
+ end
88
+
73
89
  it "should convert a lot of them simultaneously" do
74
90
  converted = EncodingOptions.new(:video_codec => "libx264", :audio_codec => "aac", :video_bitrate => "1000k").to_s
75
91
  converted.should match(/-acodec aac/)
76
92
  end
93
+
94
+ it "should ignore options with nil value" do
95
+ EncodingOptions.new(:video_codec => "libx264", :frame_rate => nil).to_s.should == "-vcodec libx264 "
96
+ end
77
97
  end
78
98
  end
79
99
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{streamio-ffmpeg}
8
- s.version = "0.6.7"
8
+ s.version = "0.6.8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["David Backeus"]
12
- s.date = %q{2010-06-15}
12
+ s.date = %q{2010-07-06}
13
13
  s.description = %q{Simple wrapper around ffmpeg to get metadata from movies and do transcoding}
14
14
  s.email = %q{duztdruid@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -59,12 +59,12 @@ Gem::Specification.new do |s|
59
59
  s.specification_version = 3
60
60
 
61
61
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
62
- s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
62
+ s.add_development_dependency(%q<rspec>, ["= 1.3.0"])
63
63
  else
64
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
64
+ s.add_dependency(%q<rspec>, ["= 1.3.0"])
65
65
  end
66
66
  else
67
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
67
+ s.add_dependency(%q<rspec>, ["= 1.3.0"])
68
68
  end
69
69
  end
70
70
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: streamio-ffmpeg
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 7
10
- version: 0.6.7
9
+ - 8
10
+ version: 0.6.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Backeus
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-06-15 00:00:00 +02:00
18
+ date: 2010-07-06 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -24,14 +24,14 @@ dependencies:
24
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ">="
27
+ - - "="
28
28
  - !ruby/object:Gem::Version
29
- hash: 13
29
+ hash: 27
30
30
  segments:
31
31
  - 1
32
- - 2
33
- - 9
34
- version: 1.2.9
32
+ - 3
33
+ - 0
34
+ version: 1.3.0
35
35
  type: :development
36
36
  version_requirements: *id001
37
37
  description: Simple wrapper around ffmpeg to get metadata from movies and do transcoding