video_dimensions 0.3.0 → 0.3.1
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.
- checksums.yaml +7 -0
- data/LICENSE.txt +1 -1
- data/README.md +5 -1
- data/lib/video_dimensions/backends/ffmpeg.rb +10 -4
- data/lib/video_dimensions/version.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/video_dimensions/backends/ffmpeg_spec.rb +48 -13
- data/spec/video_dimensions/backends/media_info_spec.rb +4 -4
- data/spec/video_dimensions/backends_spec.rb +2 -2
- data/spec/video_dimensions_spec.rb +1 -1
- data/video_dimensions.gemspec +4 -3
- metadata +37 -39
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 429db8d27c2415bb3be6cfda51417f8ebfdcbc32
|
4
|
+
data.tar.gz: 0df0b2b5f97654db70aca0d055189a02ec4d67db
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2af0a574cc75c92a49c968ae7435a9e864d230babf91abbdd7ac7ea8904b25c95e8205e7a3278f326485ee752499e05011fa30b36a823f829ad4293326594d2b
|
7
|
+
data.tar.gz: e564548b4fdef9d4b51a5d7edb6d18f8fd7b229f870d4d1921b6b8784f84288a0600fd24b23ecfb5d1397458dbd44d0c5c11dcc53bf86c4b6054e47568a458d0
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -47,6 +47,10 @@ One of the supported backends available in the system's `$PATH`.
|
|
47
47
|
|
48
48
|
## Version History
|
49
49
|
|
50
|
+
**0.3.1** (2015-02-23)
|
51
|
+
|
52
|
+
* Fix edge case in FFmpeg backend
|
53
|
+
|
50
54
|
**0.3.0** (2013-03-25)
|
51
55
|
|
52
56
|
* Add `framerate` attribute
|
@@ -65,6 +69,6 @@ One of the supported backends available in the system's `$PATH`.
|
|
65
69
|
|
66
70
|
## Copyright
|
67
71
|
|
68
|
-
Copyright (c) 2012 Robert Speicher
|
72
|
+
Copyright (c) 2012-2015 Robert Speicher
|
69
73
|
|
70
74
|
See LICENSE.txt for details.
|
@@ -56,12 +56,18 @@ module VideoDimensions
|
|
56
56
|
|
57
57
|
private
|
58
58
|
|
59
|
+
def ffmpeg_output
|
60
|
+
`#{self.class.binary} -i "#{@input}" 2>&1`.strip
|
61
|
+
end
|
62
|
+
|
59
63
|
def output
|
60
64
|
unless @output
|
61
|
-
|
62
|
-
|
63
|
-
# Strip out the Audio codec section(s)
|
64
|
-
@output
|
65
|
+
# Get raw output, then:
|
66
|
+
# - Guard against invalid UTF-8 byte sequences
|
67
|
+
# - Strip out the Audio codec section(s)
|
68
|
+
@output = ffmpeg_output
|
69
|
+
.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')
|
70
|
+
.gsub(/.*(Input #0.*)output file must be specified.*/m, '\1')
|
65
71
|
end
|
66
72
|
|
67
73
|
@output
|
data/spec/spec_helper.rb
CHANGED
@@ -5,12 +5,12 @@ module VideoDimensions::Backends
|
|
5
5
|
describe ".available?" do
|
6
6
|
it "returns true when utility is available" do
|
7
7
|
described_class.stubs(:binary).returns('whoami')
|
8
|
-
described_class.
|
8
|
+
expect(described_class).to be_available
|
9
9
|
end
|
10
10
|
|
11
11
|
it "returns false when utility is not available" do
|
12
12
|
described_class.stubs(:binary).returns('invalidbinary')
|
13
|
-
described_class.
|
13
|
+
expect(described_class).not_to be_available
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -55,8 +55,6 @@ module VideoDimensions::Backends
|
|
55
55
|
end
|
56
56
|
|
57
57
|
its(:dimensions) { should == [1280, 720] }
|
58
|
-
its(:width) { should == 1280 }
|
59
|
-
its(:height) { should == 720 }
|
60
58
|
its(:bitrate) { should == 3578 }
|
61
59
|
its(:codec) { should == 'h264' }
|
62
60
|
its(:duration) { should == '00:47:10' }
|
@@ -87,8 +85,6 @@ module VideoDimensions::Backends
|
|
87
85
|
end
|
88
86
|
|
89
87
|
its(:dimensions) { should == [720, 404] }
|
90
|
-
its(:width) { should == 720 }
|
91
|
-
its(:height) { should == 404 }
|
92
88
|
its(:bitrate) { should == 1333 }
|
93
89
|
its(:codec) { should == 'h264' }
|
94
90
|
its(:duration) { should == '00:21:08' }
|
@@ -109,8 +105,6 @@ module VideoDimensions::Backends
|
|
109
105
|
end
|
110
106
|
|
111
107
|
its(:dimensions) { should == [624, 352] }
|
112
|
-
its(:width) { should == 624 }
|
113
|
-
its(:height) { should == 352 }
|
114
108
|
its(:bitrate) { should == 1109 }
|
115
109
|
its(:codec) { should == 'mpeg4' }
|
116
110
|
its(:duration) { should == '00:21:58' }
|
@@ -131,8 +125,6 @@ module VideoDimensions::Backends
|
|
131
125
|
end
|
132
126
|
|
133
127
|
its(:dimensions) { should == [624, 352] }
|
134
|
-
its(:width) { should == 624 }
|
135
|
-
its(:height) { should == 352 }
|
136
128
|
its(:bitrate) { should == 949 }
|
137
129
|
its(:codec) { should == 'mpeg4' }
|
138
130
|
its(:duration) { should == '00:51:33' }
|
@@ -152,15 +144,58 @@ module VideoDimensions::Backends
|
|
152
144
|
EOF
|
153
145
|
end
|
154
146
|
|
155
|
-
|
156
147
|
its(:dimensions) { should == [1280, 720] }
|
157
|
-
its(:width) { should == 1280 }
|
158
|
-
its(:height) { should == 720 }
|
159
148
|
its(:bitrate) { should == 9728 }
|
160
149
|
its(:codec) { should == 'h264' }
|
161
150
|
its(:duration) { should == '00:10:14' }
|
162
151
|
its(:framerate) { should == 60.00 }
|
163
152
|
end
|
153
|
+
|
154
|
+
context "invalid UTF-8 byte sequence sample" do
|
155
|
+
subject { FFmpeg.new('') }
|
156
|
+
|
157
|
+
before do
|
158
|
+
subject.stubs(:ffmpeg_output).returns <<-EOF
|
159
|
+
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'foo.mov':
|
160
|
+
Metadata:
|
161
|
+
major_brand : qt
|
162
|
+
minor_version : 537199360
|
163
|
+
compatible_brands: qt
|
164
|
+
creation_time : 2014-11-30 18:01:59
|
165
|
+
Duration: 00:10:21.32, start: 0.000000, bitrate: 3589 kb/s
|
166
|
+
Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709), 720x480, 2049 kb/s, SAR 40:33 DAR 20:11, 29.97 fps, 29.97 tbr, 30k tbn, 60k tbc (default)
|
167
|
+
Metadata:
|
168
|
+
creation_time : 2014-11-30 18:02:00
|
169
|
+
handler_name : \xCE\xE1\xF0\xE0\xE1\xEE\xF2\xF7\xE8\xEA \xEF\xF1\xE5\xE2\xE4\xEE\xED\xE8\xEC\xEE\xE2 Apple
|
170
|
+
encoder : H.264
|
171
|
+
Stream #0:1(eng): Audio: pcm_s16be (twos / 0x736F7774), 48000 Hz, 2 channels, s16, 1536 kb/s (default)
|
172
|
+
Metadata:
|
173
|
+
creation_time : 2014-11-30 18:02:06
|
174
|
+
handler_name : \xCE\xE1\xF0\xE0\xE1\xEE\xF2\xF7\xE8\xEA \xEF\xF1\xE5\xE2\xE4\xEE\xED\xE8\xEC\xEE\xE2 Apple
|
175
|
+
At least one output file must be specified
|
176
|
+
EOF
|
177
|
+
end
|
178
|
+
|
179
|
+
it 'returns the correct dimensions' do
|
180
|
+
expect(subject.dimensions).to eq [720, 480]
|
181
|
+
end
|
182
|
+
|
183
|
+
it 'returns the correct bitrate' do
|
184
|
+
expect(subject.bitrate).to eq 3589
|
185
|
+
end
|
186
|
+
|
187
|
+
it 'returns the correct codec' do
|
188
|
+
expect(subject.codec).to eq 'h264'
|
189
|
+
end
|
190
|
+
|
191
|
+
it 'returns the correct duration' do
|
192
|
+
expect(subject.duration).to eq '00:10:21'
|
193
|
+
end
|
194
|
+
|
195
|
+
it 'returns the correct framerate' do
|
196
|
+
expect(subject.framerate).to eq 29.97
|
197
|
+
end
|
198
|
+
end
|
164
199
|
end
|
165
200
|
end
|
166
201
|
end
|
@@ -5,12 +5,12 @@ module VideoDimensions::Backends
|
|
5
5
|
describe ".available?" do
|
6
6
|
it "returns true when utility is available" do
|
7
7
|
described_class.stubs(:binary).returns('whoami')
|
8
|
-
described_class.
|
8
|
+
expect(described_class).to be_available
|
9
9
|
end
|
10
10
|
|
11
11
|
it "returns false when utility is not available" do
|
12
12
|
described_class.stubs(:binary).returns('invalidbinary')
|
13
|
-
described_class.
|
13
|
+
expect(described_class).not_to be_available
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -91,7 +91,7 @@ module VideoDimensions::Backends
|
|
91
91
|
""".unindent)
|
92
92
|
end
|
93
93
|
|
94
|
-
its(:duration)
|
94
|
+
its(:duration) { should == '01:32:00' }
|
95
95
|
end
|
96
96
|
|
97
97
|
context "duration of at least 1 minute" do
|
@@ -114,7 +114,7 @@ module VideoDimensions::Backends
|
|
114
114
|
""".unindent)
|
115
115
|
end
|
116
116
|
|
117
|
-
its(:duration)
|
117
|
+
its(:duration) { should == '00:04:10' }
|
118
118
|
end
|
119
119
|
end
|
120
120
|
end
|
@@ -6,11 +6,11 @@ module VideoDimensions
|
|
6
6
|
it "returns the first available backend" do
|
7
7
|
Backends::MediaInfo.stubs(:available?).returns(true)
|
8
8
|
Backends::FFmpeg.stubs(:available?).returns(false)
|
9
|
-
Backends.first_available.
|
9
|
+
expect(Backends.first_available).to eq Backends::MediaInfo
|
10
10
|
|
11
11
|
Backends::MediaInfo.stubs(:available?).returns(false)
|
12
12
|
Backends::FFmpeg.stubs(:available?).returns(true)
|
13
|
-
Backends.first_available.
|
13
|
+
expect(Backends.first_available).to eq Backends::FFmpeg
|
14
14
|
end
|
15
15
|
|
16
16
|
it "raises exception when none are available" do
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe VideoDimensions do
|
4
4
|
describe "method" do
|
5
5
|
it "instantiates a Backend object" do
|
6
|
-
VideoDimensions(fixture('720p.wmv')).
|
6
|
+
expect(VideoDimensions(fixture('720p.wmv'))).to be_kind_of(VideoDimensions::Backends::Base)
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
data/video_dimensions.gemspec
CHANGED
@@ -16,8 +16,9 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
17
17
|
gem.require_paths = ['lib']
|
18
18
|
|
19
|
-
gem.add_development_dependency 'bundler'
|
19
|
+
gem.add_development_dependency 'bundler'
|
20
20
|
gem.add_development_dependency 'mocha'
|
21
|
-
gem.add_development_dependency 'rake'
|
22
|
-
gem.add_development_dependency 'rspec',
|
21
|
+
gem.add_development_dependency 'rake'
|
22
|
+
gem.add_development_dependency 'rspec', '~> 2.14'
|
23
|
+
gem.add_development_dependency 'rspec-its'
|
23
24
|
end
|
metadata
CHANGED
@@ -1,80 +1,85 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: video_dimensions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Robert Speicher
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-02-23 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bundler
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
19
|
+
version: '0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
26
|
+
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: mocha
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rake
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - ">="
|
52
46
|
- !ruby/object:Gem::Version
|
53
|
-
version: '0
|
47
|
+
version: '0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - ">="
|
60
53
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0
|
54
|
+
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: rspec
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- - ~>
|
59
|
+
- - "~>"
|
68
60
|
- !ruby/object:Gem::Version
|
69
|
-
version: '2.
|
61
|
+
version: '2.14'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.14'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec-its
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
76
74
|
- !ruby/object:Gem::Version
|
77
|
-
version: '
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
78
83
|
description: Quick and easy video attributes -- width, height, bitrate, codec, duration,
|
79
84
|
framerate.
|
80
85
|
email: rspeicher@gmail.com
|
@@ -82,8 +87,8 @@ executables: []
|
|
82
87
|
extensions: []
|
83
88
|
extra_rdoc_files: []
|
84
89
|
files:
|
85
|
-
- .gitignore
|
86
|
-
- .rspec
|
90
|
+
- ".gitignore"
|
91
|
+
- ".rspec"
|
87
92
|
- Gemfile
|
88
93
|
- LICENSE.txt
|
89
94
|
- README.md
|
@@ -107,33 +112,26 @@ files:
|
|
107
112
|
homepage: https://github.com/tsigo/video_dimensions
|
108
113
|
licenses:
|
109
114
|
- MIT
|
115
|
+
metadata: {}
|
110
116
|
post_install_message:
|
111
117
|
rdoc_options: []
|
112
118
|
require_paths:
|
113
119
|
- lib
|
114
120
|
required_ruby_version: !ruby/object:Gem::Requirement
|
115
|
-
none: false
|
116
121
|
requirements:
|
117
|
-
- -
|
122
|
+
- - ">="
|
118
123
|
- !ruby/object:Gem::Version
|
119
124
|
version: '0'
|
120
|
-
segments:
|
121
|
-
- 0
|
122
|
-
hash: -2405270881637614437
|
123
125
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
|
-
none: false
|
125
126
|
requirements:
|
126
|
-
- -
|
127
|
+
- - ">="
|
127
128
|
- !ruby/object:Gem::Version
|
128
129
|
version: '0'
|
129
|
-
segments:
|
130
|
-
- 0
|
131
|
-
hash: -2405270881637614437
|
132
130
|
requirements: []
|
133
131
|
rubyforge_project:
|
134
|
-
rubygems_version:
|
132
|
+
rubygems_version: 2.4.5
|
135
133
|
signing_key:
|
136
|
-
specification_version:
|
134
|
+
specification_version: 4
|
137
135
|
summary: Quick and easy video attributes
|
138
136
|
test_files:
|
139
137
|
- spec/fixtures/1080p.wmv
|