stlondemand-rvideo 0.9.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) 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 +72 -0
  6. data/README +106 -0
  7. data/RULES +11 -0
  8. data/Rakefile +63 -0
  9. data/config/boot.rb +25 -0
  10. data/lib/rvideo.rb +49 -0
  11. data/lib/rvideo/command_executor.rb +91 -0
  12. data/lib/rvideo/errors.rb +24 -0
  13. data/lib/rvideo/float.rb +7 -0
  14. data/lib/rvideo/frame_capturer.rb +139 -0
  15. data/lib/rvideo/inspector.rb +519 -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 +459 -0
  23. data/lib/rvideo/tools/ffmpeg.rb +314 -0
  24. data/lib/rvideo/tools/ffmpeg2theora.rb +72 -0
  25. data/lib/rvideo/tools/flvtool2.rb +50 -0
  26. data/lib/rvideo/tools/handbrakecli.rb +61 -0
  27. data/lib/rvideo/tools/lame.rb +58 -0
  28. data/lib/rvideo/tools/mencoder.rb +126 -0
  29. data/lib/rvideo/tools/mp4box.rb +21 -0
  30. data/lib/rvideo/tools/mp4creator.rb +35 -0
  31. data/lib/rvideo/tools/mplayer.rb +31 -0
  32. data/lib/rvideo/tools/qtfaststart.rb +37 -0
  33. data/lib/rvideo/tools/segmenter.rb +29 -0
  34. data/lib/rvideo/tools/yamdi.rb +44 -0
  35. data/lib/rvideo/transcoder.rb +170 -0
  36. data/lib/rvideo/version.rb +9 -0
  37. data/scripts/txt2html +67 -0
  38. data/spec/files/boat.avi +0 -0
  39. data/spec/files/kites.mp4 +0 -0
  40. data/spec/fixtures/ffmpeg_builds.yml +28 -0
  41. data/spec/fixtures/ffmpeg_results.yml +608 -0
  42. data/spec/fixtures/files.yml +398 -0
  43. data/spec/fixtures/recipes.yml +58 -0
  44. data/spec/integrations/formats_spec.rb +315 -0
  45. data/spec/integrations/frame_capturer_spec.rb +26 -0
  46. data/spec/integrations/inspection_spec.rb +125 -0
  47. data/spec/integrations/recipes_spec.rb +0 -0
  48. data/spec/integrations/rvideo_spec.rb +17 -0
  49. data/spec/integrations/transcoder_integration_spec.rb +29 -0
  50. data/spec/integrations/transcoding_spec.rb +9 -0
  51. data/spec/spec.opts +1 -0
  52. data/spec/spec_helper.rb +16 -0
  53. data/spec/support.rb +36 -0
  54. data/spec/units/abstract_tool_spec.rb +111 -0
  55. data/spec/units/command_executor_spec.rb +106 -0
  56. data/spec/units/ffmpeg_spec.rb +385 -0
  57. data/spec/units/flvtool2_spec.rb +323 -0
  58. data/spec/units/frame_capturer_spec.rb +71 -0
  59. data/spec/units/inspector_spec.rb +59 -0
  60. data/spec/units/mencoder_spec.rb +4994 -0
  61. data/spec/units/mp4box_spec.rb +34 -0
  62. data/spec/units/mp4creator_spec.rb +34 -0
  63. data/spec/units/mplayer_spec.rb +34 -0
  64. data/spec/units/qtfaststart_spec.rb +35 -0
  65. data/spec/units/string_spec.rb +8 -0
  66. data/spec/units/transcoder_spec.rb +154 -0
  67. data/stlondemand-rvideo.gemspec +36 -0
  68. data/tasks/deployment.rake +5 -0
  69. data/tasks/testing.rake +27 -0
  70. data/tasks/transcoding.rake +40 -0
  71. data/tasks/website.rake +8 -0
  72. data/test_progress_reporting.rb +14 -0
  73. metadata +187 -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
+ it "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
+ it "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
+ it "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
+ it "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
+ it "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
+ it "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
+ it "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
+ it "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
+ it "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
+ it "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
+ it "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
+ it "dv video" do
219
+
220
+ end
221
+
222
+ it "msmpeg4" do
223
+
224
+ end
225
+
226
+ it "mpeg2 ac3" do
227
+
228
+ end
229
+
230
+ it "m4v h264" do
231
+
232
+ end
233
+
234
+ it "3g2" do
235
+
236
+ end
237
+
238
+ it "3gp (1)" do
239
+
240
+ end
241
+
242
+ it "3gp (2)" do
243
+
244
+ end
245
+
246
+ it "flv" do
247
+
248
+ end
249
+
250
+ it "wmv (1)" do
251
+
252
+ end
253
+
254
+ it "wmv/wmv3/wmav2" do
255
+
256
+ end
257
+
258
+ it "wmva/wmva2" do
259
+
260
+ end
261
+
262
+ it "mov/msmpeg4" do
263
+
264
+ end
265
+
266
+ it "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
+ it "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
+ it "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
+ it "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,125 @@
1
+ require File.dirname(__FILE__) + "/../spec_helper"
2
+ module RVideo
3
+
4
+ describe Inspector, "with boat.avi" do
5
+
6
+ before(:each) do
7
+ @i = Inspector.new :file => spec_file("boat.avi")
8
+ end
9
+
10
+ it "is valid" do
11
+ assert @i.valid?
12
+ end
13
+
14
+ it "knows the bitrate" do
15
+ assert_equal 2078, @i.bitrate
16
+ end
17
+
18
+ it "knows the bitrate units" do
19
+ assert_equal "kb/s", @i.bitrate_units
20
+ end
21
+
22
+ it "gives the bitrate and units together" do
23
+ assert_equal "2078 kb/s", @i.bitrate_with_units
24
+ end
25
+
26
+ it "knows the duration in milliseconds" do
27
+ assert_equal 15160, @i.duration
28
+ end
29
+
30
+ it "gives the duration as a string with : separating units of time" do
31
+ assert_equal "00:00:15.16", @i.raw_duration
32
+ end
33
+
34
+ ###
35
+
36
+ it "knows the video codec" do
37
+ assert_equal "mjpeg", @i.video_codec
38
+ end
39
+
40
+ it "knows the resolution" do
41
+ assert_equal "320x240", @i.resolution
42
+ end
43
+
44
+ it "knows the width" do
45
+ assert_equal 320, @i.width
46
+ end
47
+
48
+ it "knows the height" do
49
+ assert_equal 240, @i.height
50
+ end
51
+
52
+ ###
53
+
54
+ it "knows the audio codec" do
55
+ assert_equal "adpcm_ima_wav", @i.audio_codec
56
+ end
57
+
58
+ it "knows the audio sample rate" do
59
+ assert_equal 11025, @i.audio_sample_rate
60
+ end
61
+
62
+ it "knows the audio sample rate units" do
63
+ assert_equal "Hz", @i.audio_sample_rate_units
64
+ end
65
+
66
+ it "gives the audio sample rate and units together" do
67
+ assert_equal "11025 Hz", @i.audio_sample_rate_with_units
68
+ end
69
+
70
+ it "knows the audio channels" do
71
+ assert_equal 1, @i.audio_channels
72
+ end
73
+
74
+ it "gives the audio channels as a string" do
75
+ assert_equal "1 channels", @i.audio_channels_string
76
+ end
77
+
78
+ it "knows the audio bit rate" do
79
+ assert_equal 44, @i.audio_bit_rate
80
+ end
81
+
82
+ it "knows the audio bit rate units" do
83
+ assert_equal "kb/s", @i.audio_bit_rate_units
84
+ end
85
+
86
+ it "gives the audio bit rate with units" do
87
+ assert_equal "44 kb/s", @i.audio_bit_rate_with_units
88
+ end
89
+
90
+ it "knows the audio sample bit depth" do
91
+ assert_equal 16, @i.audio_sample_bit_depth
92
+ end
93
+
94
+ # Input #0, avi, from 'spec/files/boat.avi':
95
+ # Duration: 00:00:15.16, start: 0.000000, bitrate: 2078 kb/s
96
+ # Stream #0.0: Video: mjpeg, yuvj420p, 320x240, 15.10 tbr, 15.10 tbn, 15.10 tbc
97
+ # Stream #0.1: Audio: adpcm_ima_wav, 11025 Hz, mono, s16, 44 kb/s
98
+ end
99
+
100
+ describe Inspector, "with kites.mp4" do
101
+ before(:each) do
102
+ @i = Inspector.new :file => spec_file("kites.mp4")
103
+ end
104
+
105
+ it "knows the pixel aspect ratio" do
106
+ assert_equal "1:1", @i.pixel_aspect_ratio
107
+ end
108
+
109
+ it "knows the display aspect ratio" do
110
+ assert_equal "11:9", @i.display_aspect_ratio
111
+ end
112
+ end
113
+
114
+ describe Inspector, "with kites.mp4" do
115
+ before(:each) do
116
+ @i = Inspector.new :file => '/Users/vivien/Downloads/995b7684b98fac47b7b9affd5578c15a.avi'
117
+ end
118
+
119
+ it "knows the pixel aspect ratio" do
120
+ assert_equal "384 kb/s", @i.audio_bit_rate_with_units
121
+ end
122
+
123
+ end
124
+
125
+ end