streamio-ffmpeg 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +9 -5
- data/VERSION +1 -1
- data/lib/ffmpeg/movie.rb +9 -3
- data/lib/streamio-ffmpeg.rb +1 -1
- data/spec/ffmpeg/movie_spec.rb +4 -4
- data/spec/ffmpeg/transcoder_spec.rb +4 -4
- data/spec/fixtures/movies/awesome.mov b/data/spec/fixtures/movies/awesome → movie.mov +0 -0
- data/streamio-ffmpeg.gemspec +4 -4
- metadata +21 -10
data/CHANGELOG
CHANGED
@@ -1,20 +1,24 @@
|
|
1
|
-
== 0.4.
|
1
|
+
== 0.4.2 20010-04-06
|
2
|
+
|
3
|
+
* Escape the path to handle spaces in filenames and avoid CLI injection attacks (thanks J. Weir!)
|
4
|
+
|
5
|
+
== 0.4.1 2010-02-10
|
2
6
|
|
3
7
|
* Forgot to change the transcoding shortcut from Movie
|
4
8
|
|
5
|
-
== 0.4.0
|
9
|
+
== 0.4.0 2010-02-10
|
6
10
|
|
7
11
|
* Transcoding API changed to make use of more humanly readable options (see README for examples)
|
8
12
|
* Fixed frame rate parsing for integer frame rates
|
9
13
|
|
10
|
-
== 0.3.0
|
14
|
+
== 0.3.0 2010-02-07
|
11
15
|
|
12
16
|
* Simple transcoding
|
13
17
|
|
14
|
-
== 0.2.0
|
18
|
+
== 0.2.0 2010-02-06
|
15
19
|
|
16
20
|
* Some more metadata parsing
|
17
21
|
|
18
|
-
== 0.1.0
|
22
|
+
== 0.1.0 2010-02-05
|
19
23
|
|
20
24
|
* Some basic parsing of metadata added
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.2
|
data/lib/ffmpeg/movie.rb
CHANGED
@@ -7,9 +7,9 @@ module FFMPEG
|
|
7
7
|
def initialize(path)
|
8
8
|
raise Errno::ENOENT, "the file '#{path}' does not exist" unless File.exists?(path)
|
9
9
|
|
10
|
-
@path = path
|
11
|
-
|
12
|
-
stdin, stdout, stderr = Open3.popen3("ffmpeg -i #{path}") # Output will land in stderr
|
10
|
+
@path = escape(path)
|
11
|
+
|
12
|
+
stdin, stdout, stderr = Open3.popen3("ffmpeg -i '#{path}'") # Output will land in stderr
|
13
13
|
output = stderr.read
|
14
14
|
|
15
15
|
@valid = output[/Unknown format/].nil?
|
@@ -62,5 +62,11 @@ module FFMPEG
|
|
62
62
|
def transcode(output_file, options, &block)
|
63
63
|
Transcoder.new(self, output_file, options).run &block
|
64
64
|
end
|
65
|
+
|
66
|
+
protected
|
67
|
+
def escape(path)
|
68
|
+
map = { '\\' => '\\\\', '</' => '<\/', "\r\n" => '\n', "\n" => '\n', "\r" => '\n', '"' => '\\"', "'" => "\\'" }
|
69
|
+
path.gsub(/(\\|<\/|\r\n|[\n\r"'])/) { map[$1] }
|
70
|
+
end
|
65
71
|
end
|
66
72
|
end
|
data/lib/streamio-ffmpeg.rb
CHANGED
data/spec/ffmpeg/movie_spec.rb
CHANGED
@@ -20,13 +20,13 @@ module FFMPEG
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
describe "given awesome
|
23
|
+
describe "given an awesome movie file" do
|
24
24
|
before(:all) do
|
25
|
-
@movie = Movie.new("#{fixture_path}/movies/awesome.mov")
|
25
|
+
@movie = Movie.new("#{fixture_path}/movies/awesome movie.mov")
|
26
26
|
end
|
27
27
|
|
28
28
|
it "should remember the movie path" do
|
29
|
-
@movie.path.should == "#{fixture_path}/movies/awesome.mov"
|
29
|
+
@movie.path.should == "#{fixture_path}/movies/awesome movie.mov"
|
30
30
|
end
|
31
31
|
|
32
32
|
it "should parse duration to number of seconds" do
|
@@ -86,7 +86,7 @@ module FFMPEG
|
|
86
86
|
|
87
87
|
describe "transcode" do
|
88
88
|
it "should run the transcoder" do
|
89
|
-
movie = Movie.new("#{fixture_path}/movies/awesome.mov")
|
89
|
+
movie = Movie.new("#{fixture_path}/movies/awesome movie.mov")
|
90
90
|
|
91
91
|
mockery = mock(Transcoder)
|
92
92
|
Transcoder.should_receive(:new).with(movie, "#{tmp_path}/awesome.flv", :custom => "-vcodec libx264").and_return(mockery)
|
@@ -4,7 +4,7 @@ module FFMPEG
|
|
4
4
|
describe Transcoder do
|
5
5
|
describe "initialization" do
|
6
6
|
before(:each) do
|
7
|
-
@movie = Movie.new("#{fixture_path}/movies/awesome.mov")
|
7
|
+
@movie = Movie.new("#{fixture_path}/movies/awesome movie.mov")
|
8
8
|
@output_path = "#{tmp_path}/awesome.flv"
|
9
9
|
end
|
10
10
|
|
@@ -29,7 +29,7 @@ module FFMPEG
|
|
29
29
|
it "should transcode the movie with progress given an awesome movie" do
|
30
30
|
FileUtils.rm_f "#{tmp_path}/awesome.flv"
|
31
31
|
|
32
|
-
movie = Movie.new("#{fixture_path}/movies/awesome.mov")
|
32
|
+
movie = Movie.new("#{fixture_path}/movies/awesome movie.mov")
|
33
33
|
|
34
34
|
transcoder = Transcoder.new(movie, "#{tmp_path}/awesome.flv")
|
35
35
|
stored_progress = 0
|
@@ -42,7 +42,7 @@ module FFMPEG
|
|
42
42
|
it "should transcode the movie with EncodingOptions" do
|
43
43
|
FileUtils.rm_f "#{tmp_path}/optionalized.mp4"
|
44
44
|
|
45
|
-
movie = Movie.new("#{fixture_path}/movies/awesome.mov")
|
45
|
+
movie = Movie.new("#{fixture_path}/movies/awesome movie.mov")
|
46
46
|
options = {:video_codec => "libx264", :frame_rate => 10, :resolution => "320x240", :video_bitrate => 300,
|
47
47
|
:audio_codec => "libfaac", :audio_bitrate => 32, :audio_sample_rate => 22050, :audio_channels => 1,
|
48
48
|
: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"}
|
@@ -59,7 +59,7 @@ module FFMPEG
|
|
59
59
|
it "should transcode the movie with String options" do
|
60
60
|
FileUtils.rm_f "#{tmp_path}/string_optionalized.flv"
|
61
61
|
|
62
|
-
movie = Movie.new("#{fixture_path}/movies/awesome.mov")
|
62
|
+
movie = Movie.new("#{fixture_path}/movies/awesome movie.mov")
|
63
63
|
|
64
64
|
encoded = Transcoder.new(movie, "#{tmp_path}/string_optionalized.flv", "-s 300x200 -ac 2").run
|
65
65
|
encoded.resolution.should == "300x200"
|
File without changes
|
data/streamio-ffmpeg.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{streamio-ffmpeg}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.2"
|
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-
|
12
|
+
s.date = %q{2010-04-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 = [
|
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
|
|
31
31
|
"spec/ffmpeg/encoding_options_spec.rb",
|
32
32
|
"spec/ffmpeg/movie_spec.rb",
|
33
33
|
"spec/ffmpeg/transcoder_spec.rb",
|
34
|
-
"spec/fixtures/movies/awesome.mov",
|
34
|
+
"spec/fixtures/movies/awesome movie.mov",
|
35
35
|
"spec/spec.opts",
|
36
36
|
"spec/spec_helper.rb",
|
37
37
|
"streamio-ffmpeg.gemspec"
|
@@ -39,7 +39,7 @@ Gem::Specification.new do |s|
|
|
39
39
|
s.homepage = %q{http://github.com/dbackeus/streamio-ffmpeg}
|
40
40
|
s.rdoc_options = ["--charset=UTF-8"]
|
41
41
|
s.require_paths = ["lib"]
|
42
|
-
s.rubygems_version = %q{1.3.
|
42
|
+
s.rubygems_version = %q{1.3.6}
|
43
43
|
s.summary = %q{Simple wrapper around ffmpeg to get metadata from movies and do transcoding}
|
44
44
|
s.test_files = [
|
45
45
|
"spec/ffmpeg/encoding_options_spec.rb",
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: streamio-ffmpeg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 4
|
8
|
+
- 2
|
9
|
+
version: 0.4.2
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- David Backeus
|
@@ -9,19 +14,23 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date: 2010-
|
17
|
+
date: 2010-04-06 00:00:00 +02:00
|
13
18
|
default_executable:
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: rspec
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
24
|
requirements:
|
21
25
|
- - ">="
|
22
26
|
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 1
|
29
|
+
- 2
|
30
|
+
- 9
|
23
31
|
version: 1.2.9
|
24
|
-
|
32
|
+
type: :development
|
33
|
+
version_requirements: *id001
|
25
34
|
description: Simple wrapper around ffmpeg to get metadata from movies and do transcoding
|
26
35
|
email: duztdruid@gmail.com
|
27
36
|
executables: []
|
@@ -46,7 +55,7 @@ files:
|
|
46
55
|
- spec/ffmpeg/encoding_options_spec.rb
|
47
56
|
- spec/ffmpeg/movie_spec.rb
|
48
57
|
- spec/ffmpeg/transcoder_spec.rb
|
49
|
-
- spec/fixtures/movies/awesome.mov
|
58
|
+
- spec/fixtures/movies/awesome movie.mov
|
50
59
|
- spec/spec.opts
|
51
60
|
- spec/spec_helper.rb
|
52
61
|
- streamio-ffmpeg.gemspec
|
@@ -63,18 +72,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
63
72
|
requirements:
|
64
73
|
- - ">="
|
65
74
|
- !ruby/object:Gem::Version
|
75
|
+
segments:
|
76
|
+
- 0
|
66
77
|
version: "0"
|
67
|
-
version:
|
68
78
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
79
|
requirements:
|
70
80
|
- - ">="
|
71
81
|
- !ruby/object:Gem::Version
|
82
|
+
segments:
|
83
|
+
- 0
|
72
84
|
version: "0"
|
73
|
-
version:
|
74
85
|
requirements: []
|
75
86
|
|
76
87
|
rubyforge_project:
|
77
|
-
rubygems_version: 1.3.
|
88
|
+
rubygems_version: 1.3.6
|
78
89
|
signing_key:
|
79
90
|
specification_version: 3
|
80
91
|
summary: Simple wrapper around ffmpeg to get metadata from movies and do transcoding
|