axtro-rvideo 0.9.6

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.
Files changed (69) hide show
  1. data/CHANGELOG +70 -0
  2. data/ENV +100 -0
  3. data/ENV2 +129 -0
  4. data/LICENSE +20 -0
  5. data/Manifest +67 -0
  6. data/README +91 -0
  7. data/RULES +11 -0
  8. data/Rakefile +63 -0
  9. data/axtro-rvideo.gemspec +36 -0
  10. data/config/boot.rb +25 -0
  11. data/lib/rvideo.rb +44 -0
  12. data/lib/rvideo/errors.rb +24 -0
  13. data/lib/rvideo/float.rb +7 -0
  14. data/lib/rvideo/frame_capturer.rb +129 -0
  15. data/lib/rvideo/inspector.rb +483 -0
  16. data/lib/rvideo/reporter.rb +176 -0
  17. data/lib/rvideo/reporter/views/index.html.erb +27 -0
  18. data/lib/rvideo/reporter/views/report.css +27 -0
  19. data/lib/rvideo/reporter/views/report.html.erb +81 -0
  20. data/lib/rvideo/reporter/views/report.js +9 -0
  21. data/lib/rvideo/string.rb +5 -0
  22. data/lib/rvideo/tools/abstract_tool.rb +414 -0
  23. data/lib/rvideo/tools/ffmpeg.rb +286 -0
  24. data/lib/rvideo/tools/ffmpeg2theora.rb +42 -0
  25. data/lib/rvideo/tools/flvtool2.rb +50 -0
  26. data/lib/rvideo/tools/mencoder.rb +103 -0
  27. data/lib/rvideo/tools/mp4box.rb +21 -0
  28. data/lib/rvideo/tools/mp4creator.rb +35 -0
  29. data/lib/rvideo/tools/mplayer.rb +31 -0
  30. data/lib/rvideo/tools/qtfaststart.rb +37 -0
  31. data/lib/rvideo/tools/yamdi.rb +44 -0
  32. data/lib/rvideo/transcoder.rb +120 -0
  33. data/lib/rvideo/version.rb +9 -0
  34. data/rvideo.gemspec +36 -0
  35. data/scripts/txt2html +67 -0
  36. data/setup.rb +1585 -0
  37. data/spec/files/boat.avi +0 -0
  38. data/spec/files/kites.mp4 +0 -0
  39. data/spec/fixtures/ffmpeg_builds.yml +28 -0
  40. data/spec/fixtures/ffmpeg_results.yml +608 -0
  41. data/spec/fixtures/files.yml +398 -0
  42. data/spec/fixtures/recipes.yml +58 -0
  43. data/spec/integrations/formats_spec.rb +315 -0
  44. data/spec/integrations/frame_capturer_spec.rb +26 -0
  45. data/spec/integrations/inspection_spec.rb +112 -0
  46. data/spec/integrations/recipes_spec.rb +0 -0
  47. data/spec/integrations/rvideo_spec.rb +17 -0
  48. data/spec/integrations/transcoder_integration_spec.rb +29 -0
  49. data/spec/integrations/transcoding_spec.rb +9 -0
  50. data/spec/spec.opts +1 -0
  51. data/spec/spec_helper.rb +16 -0
  52. data/spec/support.rb +36 -0
  53. data/spec/units/abstract_tool_spec.rb +123 -0
  54. data/spec/units/ffmpeg_spec.rb +327 -0
  55. data/spec/units/flvtool2_spec.rb +324 -0
  56. data/spec/units/frame_capturer_spec.rb +72 -0
  57. data/spec/units/inspector_spec.rb +59 -0
  58. data/spec/units/mencoder_spec.rb +4994 -0
  59. data/spec/units/mp4box_spec.rb +34 -0
  60. data/spec/units/mp4creator_spec.rb +34 -0
  61. data/spec/units/mplayer_spec.rb +34 -0
  62. data/spec/units/qtfaststart_spec.rb +35 -0
  63. data/spec/units/string_spec.rb +8 -0
  64. data/spec/units/transcoder_spec.rb +156 -0
  65. data/tasks/deployment.rake +5 -0
  66. data/tasks/testing.rake +27 -0
  67. data/tasks/transcoding.rake +40 -0
  68. data/tasks/website.rake +8 -0
  69. metadata +178 -0
@@ -0,0 +1,315 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ module RVideo
4
+ context "Using various builds of ffmpeg, RVideo should properly inspect" do
5
+ specify "a cell-phone MP4 file" do
6
+ file = Inspector.new(:raw_response => files(:kites))
7
+ file.container.should == "mov,mp4,m4a,3gp,3g2,mj2"
8
+ file.raw_duration.should == "00:00:19.6"
9
+ file.duration.should == 19600
10
+ file.bitrate.should == 98
11
+ file.bitrate_units.should == "kb/s"
12
+ file.audio_stream_id.should == "#0.1"
13
+ file.audio_codec.should == "samr / 0x726D6173"
14
+ file.audio_sample_rate.should == 8000
15
+ file.audio_sample_units.should == "Hz"
16
+ file.audio_channels_string.should == "mono"
17
+ file.video_codec.should == "mpeg4"
18
+ file.video_stream_id.should == "#0.0"
19
+ file.video_colorspace.should == "yuv420p"
20
+ file.width.should == 176
21
+ file.height.should == 144
22
+ file.fps.should == "10.00"
23
+ end
24
+
25
+ specify "a cell-phone MP4 file (2)" do
26
+ file = Inspector.new(:raw_response => files(:kites2))
27
+ file.container.should == "mov,mp4,m4a,3gp,3g2,mj2"
28
+ file.raw_duration.should == "00:00:19.6"
29
+ file.duration.should == 19600
30
+ file.bitrate.should == 98
31
+ file.bitrate_units.should == "kb/s"
32
+ file.audio_stream_id.should == "#0.1"
33
+ file.audio_codec.should == "samr / 0x726D6173"
34
+ file.audio_sample_rate.should == 8000
35
+ file.audio_sample_units.should == "Hz"
36
+ file.audio_channels_string.should == "mono"
37
+ file.video_codec.should == "mpeg4"
38
+ file.video_stream_id.should == "#0.0"
39
+ file.video_colorspace.should == "yuv420p"
40
+ file.width.should == 176
41
+ file.height.should == 144
42
+ file.fps.should == "10.00"
43
+ end
44
+
45
+ specify "fancypants" do
46
+ file = Inspector.new(:raw_response => files(:fancypants))
47
+ file.container.should == "mov,mp4,m4a,3gp,3g2,mj2"
48
+ file.raw_duration.should == "00:00:35.4"
49
+ file.duration.should == 35400
50
+ file.bitrate.should == 1980
51
+ file.bitrate_units.should == "kb/s"
52
+ file.audio_stream_id.should == "#0.1"
53
+ file.audio_codec.should == "aac"
54
+ file.audio_sample_rate.should == 44100
55
+ file.audio_sample_units.should == "Hz"
56
+ file.audio_channels_string.should == "stereo"
57
+ file.video_codec.should == "h264"
58
+ file.video_stream_id.should == "#0.0"
59
+ file.video_colorspace.should == "yuv420p"
60
+ file.width.should == 720
61
+ file.height.should == 400
62
+ file.fps.should == "23.98"
63
+ end
64
+
65
+ specify "mpeg4/xvid" do
66
+ file = Inspector.new(:raw_response => files(:chainsaw))
67
+ file.container.should == "mov,mp4,m4a,3gp,3g2,mj2"
68
+ file.raw_duration.should == "00:01:09.5"
69
+ file.duration.should == 69500
70
+ file.bitrate.should == 970
71
+ file.bitrate_units.should == "kb/s"
72
+ file.audio_stream_id.should == "#0.1"
73
+ file.audio_codec.should == "mp2"
74
+ file.audio_sample_rate.should == 48000
75
+ file.audio_sample_units.should == "Hz"
76
+ file.audio_channels_string.should == "stereo"
77
+ file.video_codec.should == "mpeg4"
78
+ file.video_stream_id.should == "#0.0"
79
+ file.video_colorspace.should == "yuv420p"
80
+ file.width.should == 624
81
+ file.height.should == 352
82
+ file.fps.should == "23.98"
83
+ end
84
+
85
+ specify "mpeg1" do
86
+ file = Inspector.new(:raw_response => files(:mpeg1_957))
87
+ file.container.should == "mpeg"
88
+ file.raw_duration.should == "00:00:22.6"
89
+ file.duration.should == 22600
90
+ file.bitrate.should == 808
91
+ file.bitrate_units.should == "kb/s"
92
+ file.audio_stream_id.should == "#0.0"
93
+ file.audio_codec.should == "mp2"
94
+ file.audio_sample_rate.should == 32000
95
+ file.audio_sample_units.should == "Hz"
96
+ file.audio_channels_string.should == "mono"
97
+ file.video_codec.should == "mpeg1video"
98
+ file.video_stream_id.should == "#0.1"
99
+ file.video_colorspace.should == "yuv420p"
100
+ file.width.should == 320
101
+ file.height.should == 240
102
+ file.fps.should == "25.00"
103
+ end
104
+
105
+ specify "avi/mpeg4/mp3" do
106
+ file = Inspector.new(:raw_response => files(:buffy))
107
+ file.container.should == "avi"
108
+ file.raw_duration.should == "00:43:25.3"
109
+ file.duration.should == 2605300
110
+ file.bitrate.should == 1266
111
+ file.bitrate_units.should == "kb/s"
112
+ file.audio_stream_id.should == "#0.1"
113
+ file.audio_codec.should == "mp3"
114
+ file.audio_sample_rate.should == 48000
115
+ file.audio_sample_units.should == "Hz"
116
+ file.audio_channels_string.should == "stereo"
117
+ file.video_codec.should == "mpeg4"
118
+ file.video_stream_id.should == "#0.0"
119
+ file.video_colorspace.should == "yuv420p"
120
+ file.width.should == 640
121
+ file.height.should == 464
122
+ file.fps.should == "23.98"
123
+ end
124
+
125
+ specify "HD mpeg2" do
126
+ file = Inspector.new(:raw_response => files(:chairprank))
127
+ file.container.should == "mov,mp4,m4a,3gp,3g2,mj2"
128
+ file.raw_duration.should == "00:00:36.6"
129
+ file.duration.should == 36600
130
+ file.bitrate.should == 26602
131
+ file.bitrate_units.should == "kb/s"
132
+ file.audio_stream_id.should == "#0.0"
133
+ file.audio_codec.should == "pcm_s16le"
134
+ file.audio_sample_rate.should == 48000
135
+ file.audio_sample_units.should == "Hz"
136
+ file.audio_channels_string.should == "stereo"
137
+ file.video_codec.should == "mpeg2video"
138
+ file.video_stream_id.should == "#0.1"
139
+ file.video_colorspace.should == "yuv420p"
140
+ file.width.should == 1440
141
+ file.height.should == 1080
142
+ file.fps.should == "29.97"
143
+ end
144
+
145
+ specify "h264 (1)" do
146
+ file = Inspector.new(:raw_response => files(:fire_short))
147
+ file.container.should == "mov,mp4,m4a,3gp,3g2,mj2"
148
+ file.raw_duration.should == "00:00:10.0"
149
+ file.duration.should == 10000
150
+ file.bitrate.should == 23232
151
+ file.bitrate_units.should == "kb/s"
152
+ file.audio_stream_id.should == "#0.0"
153
+ file.audio_codec.should == "pcm_s16le"
154
+ file.audio_sample_rate.should == 48000
155
+ file.audio_sample_units.should == "Hz"
156
+ file.audio_channels_string.should == "stereo"
157
+ file.video_codec.should == "h264"
158
+ file.video_stream_id.should == "#0.1"
159
+ file.video_colorspace.should == "yuv420p"
160
+ file.width.should == 1280
161
+ file.height.should == 720
162
+ file.fps.should == "29.97"
163
+ end
164
+
165
+ specify "h264 video only" do
166
+ file = Inspector.new(:raw_response => files(:fire_video_only))
167
+ file.container.should == "mov,mp4,m4a,3gp,3g2,mj2"
168
+ file.raw_duration.should == "00:00:10.0"
169
+ file.duration.should == 10000
170
+ file.bitrate.should == 506
171
+ file.bitrate_units.should == "kb/s"
172
+ file.audio?.should == false
173
+ file.audio_codec.should == nil
174
+ file.video_codec.should == "h264"
175
+ file.video_stream_id.should == "#0.0"
176
+ file.video_colorspace.should == "yuv420p"
177
+ file.width.should == 320
178
+ file.height.should == 180
179
+ file.fps.should == "29.97"
180
+ end
181
+
182
+ specify "aac audio only" do
183
+ file = Inspector.new(:raw_response => files(:fire_audio_only))
184
+ file.container.should == "mov,mp4,m4a,3gp,3g2,mj2"
185
+ file.raw_duration.should == "00:00:10.0"
186
+ file.duration.should == 10000
187
+ file.bitrate.should == 86
188
+ file.bitrate_units.should == "kb/s"
189
+ file.audio_stream_id.should == "#0.0"
190
+ file.audio_codec.should == "aac"
191
+ file.audio_sample_rate.should == 48000
192
+ file.audio_sample_units.should == "Hz"
193
+ file.audio_channels_string.should == "stereo"
194
+ file.video?.should == false
195
+ file.video_codec.should be_nil
196
+ end
197
+
198
+ specify "apple intermediate" do
199
+ file = Inspector.new(:raw_response => files(:fireproof))
200
+ file.container.should == "mov,mp4,m4a,3gp,3g2,mj2"
201
+ file.raw_duration.should == "00:00:18.7"
202
+ file.duration.should == 18700
203
+ file.bitrate.should == 24281
204
+ file.bitrate_units.should == "kb/s"
205
+ file.audio_stream_id.should == "#0.0"
206
+ file.audio_codec.should == "pcm_s16be"
207
+ file.audio_sample_rate.should == 48000
208
+ file.audio_sample_units.should == "Hz"
209
+ file.audio_channels_string.should == "mono"
210
+ file.video_codec.should == "Apple Intermediate Codec"
211
+ file.video_stream_id.should == "#0.1"
212
+ file.video_colorspace.should == nil
213
+ file.width.should == 1280
214
+ file.height.should == 720
215
+ file.fps.should == "600.00" # this is a known FFMPEG problem
216
+ end
217
+
218
+ specify "dv video" do
219
+
220
+ end
221
+
222
+ specify "msmpeg4" do
223
+
224
+ end
225
+
226
+ specify "mpeg2 ac3" do
227
+
228
+ end
229
+
230
+ specify "m4v h264" do
231
+
232
+ end
233
+
234
+ specify "3g2" do
235
+
236
+ end
237
+
238
+ specify "3gp (1)" do
239
+
240
+ end
241
+
242
+ specify "3gp (2)" do
243
+
244
+ end
245
+
246
+ specify "flv" do
247
+
248
+ end
249
+
250
+ specify "wmv (1)" do
251
+
252
+ end
253
+
254
+ specify "wmv/wmv3/wmav2" do
255
+
256
+ end
257
+
258
+ specify "wmva/wmva2" do
259
+
260
+ end
261
+
262
+ specify "mov/msmpeg4" do
263
+
264
+ end
265
+
266
+ specify "audio only mp3" do
267
+ file = Inspector.new(:raw_response => files(:duck))
268
+ file.container.should == "mp3"
269
+ file.raw_duration.should == "00:02:03.0"
270
+ file.duration.should == 123000
271
+ file.bitrate.should == 128
272
+ file.bitrate_units.should == "kb/s"
273
+ file.audio_stream_id.should == "#0.0"
274
+ file.audio_codec.should == "mp3"
275
+ file.audio_sample_rate.should == 44100
276
+ file.audio_sample_units.should == "Hz"
277
+ file.audio_channels_string.should == "stereo"
278
+ file.audio?.should == true
279
+ file.video?.should == false
280
+ end
281
+
282
+ specify "audio only aac" do
283
+ file = Inspector.new(:raw_response => files(:eiffel))
284
+ file.container.should == "mov,mp4,m4a,3gp,3g2,mj2"
285
+ file.raw_duration.should == "00:02:50.3"
286
+ file.duration.should == 170300
287
+ file.bitrate.should == 162
288
+ file.bitrate_units.should == "kb/s"
289
+ file.audio_stream_id.should == "#0.0"
290
+ file.audio_codec.should == "aac"
291
+ file.audio_sample_rate.should == 44100
292
+ file.audio_sample_units.should == "Hz"
293
+ file.audio_channels_string.should == "stereo"
294
+ file.audio?.should == true
295
+ file.video?.should == false
296
+ end
297
+
298
+ specify "invalid file" do
299
+ file = Inspector.new(:raw_response => files(:invalid))
300
+ file.container.should == "mov,mp4,m4a,3gp,3g2,mj2"
301
+ file.raw_duration.should be_nil
302
+ file.valid?.should be_false
303
+ file.unknown_format?.should be_false
304
+ file.unreadable_file?.should be_true
305
+ end
306
+
307
+ specify "failing mp3 file" do
308
+ file = Inspector.new(:raw_response => files(:failing_ogg))
309
+ file.raw_duration.should be_nil
310
+ file.invalid?.should be_true
311
+ # file.unknown_format?.should be_false
312
+ # file.unreadable_file?.should be_true
313
+ end
314
+ end
315
+ end
@@ -0,0 +1,26 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ module RVideo
4
+ describe FrameCapturer do
5
+ # TODO!
6
+ # These are the old specs, too tired to fix 'em up at the moment..
7
+ #
8
+ # it "should create a screenshot with a default output path" do
9
+ # output_file = "#{TEMP_PATH}/kites-10p.jpg"
10
+ # FileTest.exist?(output_file).should_not be_true
11
+ # file = Inspector.new(:file => spec_file("kites.mp4"))
12
+ # file.capture_frame("10%").should == output_file
13
+ # FileTest.exist?(output_file).should be_true
14
+ # FileUtils.rm_f(output_file)
15
+ # end
16
+ #
17
+ # it "should create a screenshot with a custom output path" do
18
+ # output_file = spec_file("kites-10p.jpg")
19
+ # FileTest.exist?(output_file).should be_false
20
+ # file = Inspector.new(:file => spec_file("kites.mp4"))
21
+ # file.capture_frame("10%", output_file).should == output_file
22
+ # FileTest.exist?(output_file).should be_true
23
+ # FileUtils.rm_f(output_file)
24
+ # end
25
+ end
26
+ end
@@ -0,0 +1,112 @@
1
+ require File.dirname(__FILE__) + "/../spec_helper"
2
+
3
+ module RVideo
4
+ describe Inspector, "with boat.avi" do
5
+ before :each do
6
+ @i = Inspector.new :file => spec_file("boat.avi")
7
+ end
8
+
9
+ it "is valid" do
10
+ assert @i.valid?
11
+ end
12
+
13
+ it "knows the bitrate" do
14
+ assert_equal 2078, @i.bitrate
15
+ end
16
+
17
+ it "knows the bitrate units" do
18
+ assert_equal "kb/s", @i.bitrate_units
19
+ end
20
+
21
+ it "gives the bitrate and units together" do
22
+ assert_equal "2078 kb/s", @i.bitrate_with_units
23
+ end
24
+
25
+ it "knows the duration in milliseconds" do
26
+ assert_equal 15160, @i.duration
27
+ end
28
+
29
+ it "gives the duration as a string with : separating units of time" do
30
+ assert_equal "00:00:15.16", @i.raw_duration
31
+ end
32
+
33
+ ###
34
+
35
+ it "knows the video codec" do
36
+ assert_equal "mjpeg", @i.video_codec
37
+ end
38
+
39
+ it "knows the resolution" do
40
+ assert_equal "320x240", @i.resolution
41
+ end
42
+
43
+ it "knows the width" do
44
+ assert_equal 320, @i.width
45
+ end
46
+
47
+ it "knows the height" do
48
+ assert_equal 240, @i.height
49
+ end
50
+
51
+ ###
52
+
53
+ it "knows the audio codec" do
54
+ assert_equal "adpcm_ima_wav", @i.audio_codec
55
+ end
56
+
57
+ it "knows the audio sample rate" do
58
+ assert_equal 11025, @i.audio_sample_rate
59
+ end
60
+
61
+ it "knows the audio sample rate units" do
62
+ assert_equal "Hz", @i.audio_sample_rate_units
63
+ end
64
+
65
+ it "gives the audio sample rate and units together" do
66
+ assert_equal "11025 Hz", @i.audio_sample_rate_with_units
67
+ end
68
+
69
+ it "knows the audio channels" do
70
+ assert_equal 1, @i.audio_channels
71
+ end
72
+
73
+ it "gives the audio channels as a string" do
74
+ assert_equal "mono", @i.audio_channels_string
75
+ end
76
+
77
+ it "knows the audio bit rate" do
78
+ assert_equal 44, @i.audio_bit_rate
79
+ end
80
+
81
+ it "knows the audio bit rate units" do
82
+ assert_equal "kb/s", @i.audio_bit_rate_units
83
+ end
84
+
85
+ it "gives the audio bit rate with units" do
86
+ assert_equal "44 kb/s", @i.audio_bit_rate_with_units
87
+ end
88
+
89
+ it "knows the audio sample bit depth" do
90
+ assert_equal 16, @i.audio_sample_bit_depth
91
+ end
92
+
93
+ # Input #0, avi, from 'spec/files/boat.avi':
94
+ # Duration: 00:00:15.16, start: 0.000000, bitrate: 2078 kb/s
95
+ # Stream #0.0: Video: mjpeg, yuvj420p, 320x240, 15.10 tbr, 15.10 tbn, 15.10 tbc
96
+ # Stream #0.1: Audio: adpcm_ima_wav, 11025 Hz, mono, s16, 44 kb/s
97
+ end
98
+
99
+ describe Inspector, "with kites.mp4" do
100
+ before :each do
101
+ @i = Inspector.new :file => spec_file("kites.mp4")
102
+ end
103
+
104
+ it "knows the pixel aspect ratio" do
105
+ assert_equal "1:1", @i.pixel_aspect_ratio
106
+ end
107
+
108
+ it "knows the display aspect ratio" do
109
+ assert_equal "11:9", @i.display_aspect_ratio
110
+ end
111
+ end
112
+ end