rvideo 0.8.0

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 (45) hide show
  1. data/ENV +100 -0
  2. data/ENV2 +129 -0
  3. data/History.txt +3 -0
  4. data/License.txt +20 -0
  5. data/Manifest.txt +44 -0
  6. data/README.txt +91 -0
  7. data/RULES +11 -0
  8. data/Rakefile +163 -0
  9. data/config/boot.rb +16 -0
  10. data/lib/rvideo.rb +19 -0
  11. data/lib/rvideo/errors.rb +21 -0
  12. data/lib/rvideo/inspector.rb +486 -0
  13. data/lib/rvideo/reporter.rb +176 -0
  14. data/lib/rvideo/reporter/views/index.html.erb +27 -0
  15. data/lib/rvideo/reporter/views/report.css +27 -0
  16. data/lib/rvideo/reporter/views/report.html.erb +81 -0
  17. data/lib/rvideo/reporter/views/report.js +9 -0
  18. data/lib/rvideo/tools/abstract_tool.rb +79 -0
  19. data/lib/rvideo/tools/ffmpeg.rb +111 -0
  20. data/lib/rvideo/tools/flvtool2.rb +45 -0
  21. data/lib/rvideo/transcoder.rb +113 -0
  22. data/lib/rvideo/version.rb +9 -0
  23. data/scripts/txt2html +67 -0
  24. data/setup.rb +1585 -0
  25. data/spec/files/kites.mp4 +0 -0
  26. data/spec/fixtures/ffmpeg_builds.yml +28 -0
  27. data/spec/fixtures/files.yml +374 -0
  28. data/spec/fixtures/recipes.yml +6 -0
  29. data/spec/integrations/files/files.yml +361 -0
  30. data/spec/integrations/formats_spec.rb +287 -0
  31. data/spec/integrations/inspection_spec.rb +15 -0
  32. data/spec/integrations/recipes_spec.rb +0 -0
  33. data/spec/integrations/rvideo_spec.rb +17 -0
  34. data/spec/integrations/transcoding_spec.rb +9 -0
  35. data/spec/spec.opts +1 -0
  36. data/spec/spec_helper.rb +11 -0
  37. data/spec/units/abstract_tool_spec.rb +112 -0
  38. data/spec/units/ffmpeg_spec.rb +703 -0
  39. data/spec/units/flvtool2_spec.rb +314 -0
  40. data/spec/units/inspector_spec.rb +41 -0
  41. data/spec/units/transcoder_spec.rb +140 -0
  42. data/website/index.html +219 -0
  43. data/website/index.txt +142 -0
  44. data/website/javascripts/rounded_corners_lite.inc.js +285 -0
  45. metadata +94 -0
@@ -0,0 +1,703 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ module RVideo
4
+ module Tools
5
+
6
+ describe Ffmpeg do
7
+ before do
8
+ setup_ffmpeg_spec
9
+ end
10
+
11
+ it "should initialize with valid arguments" do
12
+ @ffmpeg.class.should == Ffmpeg
13
+ end
14
+
15
+ it "should have the correct tool_command" do
16
+ @ffmpeg.tool_command.should == 'ffmpeg'
17
+ end
18
+
19
+ it "should call parse_result on execute, with a ffmpeg result string" do
20
+ @ffmpeg.should_receive(:parse_result).once.with /\AFFmpeg version/
21
+ @ffmpeg.execute
22
+ end
23
+
24
+ it "should mixin AbstractTool" do
25
+ Ffmpeg.included_modules.include?(AbstractTool::InstanceMethods).should be_true
26
+ end
27
+
28
+ it "should set supported options successfully" do
29
+ @ffmpeg.options[:resolution].should == @options[:resolution]
30
+ @ffmpeg.options[:input_file].should == @options[:input_file]
31
+ @ffmpeg.options[:output_file].should == @options[:output_file]
32
+ end
33
+
34
+ end
35
+
36
+ describe Ffmpeg, " when parsing a result" do
37
+ before do
38
+ setup_ffmpeg_spec
39
+ @result = "FFmpeg version CVS, Copyright (c) 2000-2004 Fabrice Bellard
40
+ Mac OSX universal build for ffmpegX
41
+ configuration: --enable-memalign-hack --enable-mp3lame --enable-gpl --disable-vhook --disable-ffplay --disable-ffserver --enable-a52 --enable-xvid --enable-faac --enable-faad --enable-amr_nb --enable-amr_wb --enable-pthreads --enable-x264
42
+ libavutil version: 49.0.0
43
+ libavcodec version: 51.9.0
44
+ libavformat version: 50.4.0
45
+ built on Apr 15 2006 04:58:19, gcc: 4.0.1 (Apple Computer, Inc. build 5250)
46
+
47
+ Seems that stream 1 comes from film source: 600.00 (600/1) -> 59.75 (239/4)
48
+ Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'jobjob2.mov':
49
+ Duration: 00:01:09.0, start: 0.000000, bitrate: 28847 kb/s
50
+ Stream #0.0(eng): Audio: aac, 44100 Hz, stereo
51
+ Stream #0.1(eng), 59.75 fps(r): Video: dvvideo, yuv411p, 720x480
52
+ Stream mapping:
53
+ Stream #0.1 -> #0.0
54
+ Stream #0.0 -> #0.1
55
+ Press [q] to stop encoding
56
+ frame= 4126 q=31.0 Lsize= 5917kB time=69.1 bitrate= 702.0kbits/s
57
+ video:2417kB audio:540kB global headers:0kB muxing overhead 100.140277%
58
+ "
59
+
60
+ @result2 = "FFmpeg version CVS, Copyright (c) 2000-2004 Fabrice Bellard
61
+ Mac OSX universal build for ffmpegX
62
+ configuration: --enable-memalign-hack --enable-mp3lame --enable-gpl --disable-vhook --disable-ffplay --disable-ffserver --enable-a52 --enable-xvid --enable-faac --enable-faad --enable-amr_nb --enable-amr_wb --enable-pthreads --enable-x264
63
+ libavutil version: 49.0.0
64
+ libavcodec version: 51.9.0
65
+ libavformat version: 50.4.0
66
+ built on Apr 15 2006 04:58:19, gcc: 4.0.1 (Apple Computer, Inc. build 5250)
67
+ Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/jon/code/spinoza/rvideo/config/../spec/files/kites.mp4':
68
+ Duration: 00:00:19.6, start: 0.000000, bitrate: 98 kb/s
69
+ Stream #0.0(und), 10.00 fps(r): Video: mpeg4, yuv420p, 176x144
70
+ Stream #0.1(und): Audio: amr_nb, 8000 Hz, mono
71
+ Output #0, avi, to '/Users/jon/code/spinoza/rvideo/config/../tmp/kites-transcoded.avi':
72
+ Stream #0.0, 29.97 fps(c): Video: xvid, yuv420p, 320x240, q=2-31, 200 kb/s
73
+ Stream #0.1: Audio: mp3, 44100 Hz, mono, 64 kb/s
74
+ Stream mapping:
75
+ Stream #0.0 -> #0.0
76
+ Stream #0.1 -> #0.1
77
+ Press [q] to stop encoding
78
+ frame= 584 q=6.0 Lsize= 708kB time=19.5 bitrate= 297.8kbits/s
79
+ video:49kB audio:153kB global headers:0kB muxing overhead 250.444444%
80
+ "
81
+
82
+ @result3 = "FFmpeg version CVS, Copyright (c) 2000-2004 Fabrice Bellard
83
+ Mac OSX universal build for ffmpegX
84
+ configuration: --enable-memalign-hack --enable-mp3lame --enable-gpl --disable-vhook --disable-ffplay --disable-ffserver --enable-a52 --enable-xvid --enable-faac --enable-faad --enable-amr_nb --enable-amr_wb --enable-pthreads --enable-x264
85
+ libavutil version: 49.0.0
86
+ libavcodec version: 51.9.0
87
+ libavformat version: 50.4.0
88
+ built on Apr 15 2006 04:58:19, gcc: 4.0.1 (Apple Computer, Inc. build 5250)
89
+ Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/jon/code/spinoza/rvideo/config/../spec/files/kites.mp4':
90
+ Duration: 00:00:19.6, start: 0.000000, bitrate: 98 kb/s
91
+ Stream #0.0(und), 10.00 fps(r): Video: mpeg4, yuv420p, 176x144
92
+ Stream #0.1(und): Audio: amr_nb, 8000 Hz, mono
93
+ Output #0, avi, to '/Users/jon/code/spinoza/rvideo/config/../tmp/kites-transcoded.avi':
94
+ Stream #0.0, 29.97 fps(c): Video: xvid, yuv420p, 320x240, q=2-31, 200 kb/s
95
+ Stream #0.1: Audio: mp3, 44100 Hz, mono, 64 kb/s
96
+ Stream mapping:
97
+ Stream #0.0 -> #0.0
98
+ Stream #0.1 -> #0.1
99
+ Press [q] to stop encoding
100
+ frame= 273 fps= 31 q=10.0 Lsize= 398kB time=5.9 bitrate= 551.8kbits/s
101
+ video:284kB audio:92kB global headers:0kB muxing overhead 5.723981%
102
+ "
103
+
104
+ @result4 = "FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2007 Fabrice Bellard, et al.
105
+ configuration: --prefix=/opt/local --prefix=/opt/local --disable-vhook --mandir=/opt/local/share/man --enable-shared --enable-pthreads --enable-libmp3lame --enable-gpl --enable-libfaac --enable-libfaad --enable-xvid --enable-x264
106
+ libavutil version: 49.4.0
107
+ libavcodec version: 51.40.4
108
+ libavformat version: 51.12.1
109
+ built on Sep 19 2007 11:30:28, gcc: 4.0.1 (Apple Computer, Inc. build 5367)
110
+ Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/Eric/Projects/rvidtest/rvideo/report/input_files/jobjob.mov':
111
+ Duration: 00:01:12.0, start: 0.000000, bitrate: 972 kb/s
112
+ Stream #0.0(eng): Video: mpeg4, yuv420p, 512x384, 29.97 fps(r)
113
+ Stream #0.1(eng): Audio: mp3, 48000 Hz, stereo
114
+ Output #0, mp3, to '/Users/Eric/Projects/rvidtest/rvideo/report/generated_reports/62/output_files/jobjob_mov/private_mp3.mp3':
115
+ Stream #0.0: Audio: mp3, 48000 Hz, stereo, 0 kb/s
116
+ Stream mapping:
117
+ Stream #0.1 -> #0.0
118
+ Press [q] to stop encoding
119
+ mdb:94, lastbuf:0 skipping granule 0
120
+ size= 1080kB time=69.1 bitrate= 128.0kbits /s
121
+ video:0kB audio:1080kB global headers:0kB muxing overhead 0.002893%
122
+ "
123
+ end
124
+
125
+ it "should create correct result metadata" do
126
+ @ffmpeg.send(:parse_result, @result).should be_true
127
+ @ffmpeg.frame.should == '4126'
128
+ @ffmpeg.fps.should be_nil
129
+ @ffmpeg.q.should == '31.0'
130
+ @ffmpeg.size.should == '5917kB'
131
+ @ffmpeg.time.should == '69.1'
132
+ @ffmpeg.bitrate.should == '702.0kbits/s'
133
+ @ffmpeg.video_size.should == "2417kB"
134
+ @ffmpeg.audio_size.should == "540kB"
135
+ @ffmpeg.header_size.should == "0kB"
136
+ @ffmpeg.overhead.should == "100.140277%"
137
+ @ffmpeg.psnr.should be_nil
138
+ end
139
+
140
+ it "should create correct result metadata (2)" do
141
+ @ffmpeg.send(:parse_result, @result2).should be_true
142
+ @ffmpeg.frame.should == '584'
143
+ @ffmpeg.fps.should be_nil
144
+ @ffmpeg.q.should == '6.0'
145
+ @ffmpeg.size.should == '708kB'
146
+ @ffmpeg.time.should == '19.5'
147
+ @ffmpeg.bitrate.should == '297.8kbits/s'
148
+ @ffmpeg.video_size.should == "49kB"
149
+ @ffmpeg.audio_size.should == "153kB"
150
+ @ffmpeg.header_size.should == "0kB"
151
+ @ffmpeg.overhead.should == "250.444444%"
152
+ @ffmpeg.psnr.should be_nil
153
+ end
154
+
155
+ it "should create correct result metadata (3)" do
156
+ @ffmpeg.send(:parse_result, @result3).should be_true
157
+ @ffmpeg.frame.should == '273'
158
+ @ffmpeg.fps.should == "31"
159
+ @ffmpeg.q.should == '10.0'
160
+ @ffmpeg.size.should == '398kB'
161
+ @ffmpeg.time.should == '5.9'
162
+ @ffmpeg.bitrate.should == '551.8kbits/s'
163
+ @ffmpeg.video_size.should == "284kB"
164
+ @ffmpeg.audio_size.should == "92kB"
165
+ @ffmpeg.header_size.should == "0kB"
166
+ @ffmpeg.overhead.should == "5.723981%"
167
+ @ffmpeg.psnr.should be_nil
168
+ end
169
+
170
+ it "should create correct result metadata (4)" do
171
+ @ffmpeg.send(:parse_result, @result4).should be_true
172
+ @ffmpeg.frame.should be_nil
173
+ @ffmpeg.fps.should be_nil
174
+ @ffmpeg.q.should be_nil
175
+ @ffmpeg.size.should == '1080kB'
176
+ @ffmpeg.time.should == '69.1'
177
+ @ffmpeg.bitrate.should == '128.0kbits'
178
+ @ffmpeg.video_size.should == "0kB"
179
+ @ffmpeg.audio_size.should == "1080kB"
180
+ @ffmpeg.header_size.should == "0kB"
181
+ @ffmpeg.overhead.should == "0.002893%"
182
+ @ffmpeg.psnr.should be_nil
183
+ end
184
+
185
+ it "ffmpeg should calculate PSNR if it is turned on" do
186
+ @ffmpeg.send(:parse_result, @result.gsub("Lsize=","LPSNR=Y:33.85 U:37.61 V:37.46 *:34.77 size=")).should be_true
187
+ @ffmpeg.psnr.should == "Y:33.85 U:37.61 V:37.46 *:34.77"
188
+ end
189
+ end
190
+
191
+ context Ffmpeg, " result parsing should raise an exception" do
192
+
193
+ setup do
194
+ setup_ffmpeg_spec
195
+ end
196
+
197
+ specify "when not passed a command" do
198
+ result = "FFmpeg version CVS, Copyright (c) 2000-2004 Fabrice Bellard
199
+ Mac OSX universal build for ffmpegX
200
+ configuration: --enable-memalign-hack --enable-mp3lame --enable-gpl --disable-vhook --disable-ffplay --disable-ffserver --enable-a52 --enable-xvid --enable-faac --enable-faad --enable-amr_nb --enable-amr_wb --enable-pthreads --enable-x264
201
+ libavutil version: 49.0.0
202
+ libavcodec version: 51.9.0
203
+ libavformat version: 50.4.0
204
+ built on Apr 15 2006 04:58:19, gcc: 4.0.1 (Apple Computer, Inc. build 5250)
205
+ usage: ffmpeg [[infile options] -i infile]... {[outfile options] outfile}...
206
+ Hyper fast Audio and Video encoder
207
+
208
+ Main options:
209
+ -L show license
210
+ -h show help
211
+ -version show version
212
+ -formats show available formats, codecs, protocols, ...
213
+ -f fmt force format
214
+ -img img_fmt force image format
215
+ -i filename input file name
216
+ -y overwrite output files
217
+ -t duration set the recording time
218
+ -fs limit_size set the limit file size
219
+ -ss time_off set the start time offset
220
+ -itsoffset time_off set the input ts offset
221
+ -title string set the title
222
+ -timestamp time set the timestamp
223
+ -author string set the author
224
+ -copyright string set the copyright
225
+ -comment string set the comment
226
+ -v verbose control amount of logging
227
+ -target type specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\", \"dv50\", \pal-vcd\", \"ntsc-svcd\", ...)
228
+ -dframes number set the number of data frames to record
229
+ -scodec codec force subtitle codec ('copy' to copy stream)
230
+ -newsubtitle add a new subtitle stream to the current output stream
231
+ -slang code set the ISO 639 language code (3 letters) of the current subtitle stream
232
+
233
+ Video options:
234
+ -b bitrate set video bitrate (in kbit/s)
235
+ -vframes number set the number of video frames to record
236
+ -r rate set frame rate (Hz value, fraction or abbreviation)
237
+ -s size set frame size (WxH or abbreviation)
238
+ -aspect aspect set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)
239
+ -croptop size set top crop band size (in pixels)
240
+ -cropbottom size set bottom crop band size (in pixels)
241
+ -cropleft size set left crop band size (in pixels)
242
+ -cropright size set right crop band size (in pixels)
243
+ -padtop size set top pad band size (in pixels)
244
+ -padbottom size set bottom pad band size (in pixels)
245
+ -padleft size set left pad band size (in pixels)
246
+ -padright size set right pad band size (in pixels)
247
+ -padcolor color set color of pad bands (Hex 000000 thru FFFFFF)
248
+ -vn disable video
249
+ -bt tolerance set video bitrate tolerance (in kbit/s)
250
+ -maxrate bitrate set max video bitrate tolerance (in kbit/s)
251
+ -minrate bitrate set min video bitrate tolerance (in kbit/s)
252
+ -bufsize size set ratecontrol buffer size (in kByte)
253
+ -vcodec codec force video codec ('copy' to copy stream)
254
+ -sameq use same video quality as source (implies VBR)
255
+ -pass n select the pass number (1 or 2)
256
+ -passlogfile file select two pass log file name
257
+ -newvideo add a new video stream to the current output stream
258
+
259
+ Advanced Video options:
260
+ -pix_fmt format set pixel format
261
+ -g gop_size set the group of picture size
262
+ -intra use only intra frames
263
+ -vdt n discard threshold
264
+ -qscale q use fixed video quantiser scale (VBR)
265
+ -qmin q min video quantiser scale (VBR)
266
+ -qmax q max video quantiser scale (VBR)
267
+ -lmin lambda min video lagrange factor (VBR)
268
+ -lmax lambda max video lagrange factor (VBR)
269
+ -mblmin q min macroblock quantiser scale (VBR)
270
+ -mblmax q max macroblock quantiser scale (VBR)
271
+ -qdiff q max difference between the quantiser scale (VBR)
272
+ -qblur blur video quantiser scale blur (VBR)
273
+ -qsquish squish how to keep quantiser between qmin and qmax (0 = clip, 1 = use differentiable function)
274
+ -qcomp compression video quantiser scale compression (VBR)
275
+ -rc_init_cplx complexity initial complexity for 1-pass encoding
276
+ -b_qfactor factor qp factor between p and b frames
277
+ -i_qfactor factor qp factor between p and i frames
278
+ -b_qoffset offset qp offset between p and b frames
279
+ -i_qoffset offset qp offset between p and i frames
280
+ -ibias bias intra quant bias
281
+ -pbias bias inter quant bias
282
+ -rc_eq equation set rate control equation
283
+ -rc_override override rate control override for specific intervals
284
+ -me method set motion estimation method
285
+ -me_threshold motion estimaton threshold
286
+ -mb_threshold macroblock threshold
287
+ -bf frames use 'frames' B frames
288
+ -preme pre motion estimation
289
+ -bug param workaround not auto detected encoder bugs
290
+ -strict strictness how strictly to follow the standards
291
+ -deinterlace deinterlace pictures
292
+ -psnr calculate PSNR of compressed frames
293
+ -vstats dump video coding statistics to file
294
+ -vhook module insert video processing module
295
+ -intra_matrix matrix specify intra matrix coeffs
296
+ -inter_matrix matrix specify inter matrix coeffs
297
+ -top top=1/bottom=0/auto=-1 field first
298
+ -sc_threshold threshold scene change threshold
299
+ -me_range range limit motion vectors range (1023 for DivX player)
300
+ -dc precision intra_dc_precision
301
+ -mepc factor (1.0 = 256) motion estimation bitrate penalty compensation
302
+ -vtag fourcc/tag force video tag/fourcc
303
+ -skip_threshold threshold frame skip threshold
304
+ -skip_factor factor frame skip factor
305
+ -skip_exp exponent frame skip exponent
306
+ -genpts generate pts
307
+ -qphist show QP histogram
308
+
309
+ Audio options:
310
+ -aframes number set the number of audio frames to record
311
+ -ab bitrate set audio bitrate (in kbit/s)
312
+ -aq quality set audio quality (codec-specific)
313
+ -ar rate set audio sampling rate (in Hz)
314
+ -ac channels set number of audio channels
315
+ -an disable audio
316
+ -acodec codec force audio codec ('copy' to copy stream)
317
+ -vol volume change audio volume (256=normal)
318
+ -newaudio add a new audio stream to the current output stream
319
+ -alang code set the ISO 639 language code (3 letters) of the current audio stream
320
+
321
+ Advanced Audio options:
322
+ -atag fourcc/tag force audio tag/fourcc
323
+
324
+ Subtitle options:
325
+ -scodec codec force subtitle codec ('copy' to copy stream)
326
+ -newsubtitle add a new subtitle stream to the current output stream
327
+ -slang code set the ISO 639 language code (3 letters) of the current subtitle stream
328
+
329
+ Audio/Video grab options:
330
+ -vd device set video grab device
331
+ -vc channel set video grab channel (DV1394 only)
332
+ -tvstd standard set television standard (NTSC, PAL (SECAM))
333
+ -ad device set audio device
334
+ -grab format request grabbing using
335
+ -gd device set grab device
336
+
337
+ Advanced options:
338
+ -map file:stream[:syncfile:syncstream] set input stream mapping
339
+ -map_meta_data outfile:infile set meta data information of outfile from infile
340
+ -benchmark add timings for benchmarking
341
+ -dump dump each input packet
342
+ -hex when dumping packets, also dump the payload
343
+ -re read input at native frame rate
344
+ -loop_input loop (current only works with images)
345
+ -loop_output number of times to loop output in formats that support looping (0 loops forever)
346
+ -threads count thread count
347
+ -vsync video sync method
348
+ -async audio sync method
349
+ -vglobal video global header storage type
350
+ -copyts copy timestamps
351
+ -shortest finish encoding within shortest input
352
+ -dts_delta_threshold timestamp discontinuity delta threshold
353
+ -ps size set packet size in bits
354
+ -error rate error rate
355
+ -muxrate rate set mux rate
356
+ -packetsize size set packet size
357
+ -muxdelay seconds set the maximum demux-decode delay
358
+ -muxpreload seconds set the initial demux-decode delay
359
+ AVCodecContext AVOptions:
360
+ -bit_rate <int> E.VA.
361
+ -bit_rate_tolerance <int> E.V..
362
+ -flags <flags> EDVA.
363
+ -mv4 E.V.. use four motion vector by macroblock (mpeg4)
364
+ -obmc E.V.. use overlapped block motion compensation (h263+)
365
+ -qpel E.V.. use 1/4 pel motion compensation
366
+ -loop E.V.. use loop filter
367
+ -gmc E.V.. use gmc
368
+ -mv0 E.V.. always try a mb with mv=<0,0>
369
+ -part E.V.. use data partitioning
370
+ -gray EDV.. only decode/encode grayscale
371
+ -psnr E.V.. error[?] variables will be set during encoding
372
+ -naq E.V.. normalize adaptive quantization
373
+ -ildct E.V.. use interlaced dct
374
+ -low_delay .DV.. force low delay
375
+ -alt E.V.. enable alternate scantable (mpeg2/mpeg4)
376
+ -trell E.V.. use trellis quantization
377
+ -bitexact EDVAS use only bitexact stuff (except (i)dct)
378
+ -aic E.V.. h263 advanced intra coding / mpeg4 ac prediction
379
+ -umv E.V.. use unlimited motion vectors
380
+ -cbp E.V.. use rate distortion optimization for cbp
381
+ -qprd E.V.. use rate distortion optimization for qp selection
382
+ -aiv E.V.. h263 alternative inter vlc
383
+ -slice E.V..
384
+ -ilme E.V.. interlaced motion estimation
385
+ -scan_offset E.V.. will reserve space for svcd scan offset user data
386
+ -cgop E.V.. closed gop
387
+ -fast E.V.. allow non spec compliant speedup tricks
388
+ -sgop E.V.. strictly enforce gop size
389
+ -noout E.V.. skip bitstream encoding
390
+ -local_header E.V.. place global headers at every keyframe instead of in extradata
391
+ -me_method <int> E.V..
392
+ -gop_size <int> E.V..
393
+ -cutoff <int> E..A. set cutoff bandwidth
394
+ -qcompress <float> E.V..
395
+ -qblur <float> E.V..
396
+ -qmin <int> E.V..
397
+ -qmax <int> E.V..
398
+ -max_qdiff <int> E.V..
399
+ -max_b_frames <int> E.V..
400
+ -b_quant_factor <float> E.V..
401
+ -rc_strategy <int> E.V..
402
+ -b_strategy <int> E.V..
403
+ -hurry_up <int> .DV..
404
+ -bugs <int> .DV..
405
+ -autodetect .DV..
406
+ -old_msmpeg4 .DV..
407
+ -xvid_ilace .DV..
408
+ -ump4 .DV..
409
+ -no_padding .DV..
410
+ -amv .DV..
411
+ -ac_vlc .DV..
412
+ -qpel_chroma .DV..
413
+ -std_qpel .DV..
414
+ -qpel_chroma2 .DV..
415
+ -direct_blocksize .DV..
416
+ -edge .DV..
417
+ -hpel_chroma .DV..
418
+ -dc_clip .DV..
419
+ -ms .DV..
420
+ -lelim <int> E.V.. single coefficient elimination threshold for luminance (negative values also consider dc coefficient)
421
+ -celim <int> E.V.. single coefficient elimination threshold for chrominance (negative values also consider dc coefficient)
422
+ -strict <int> E.V..
423
+ -very E.V..
424
+ -strict E.V..
425
+ -normal E.V..
426
+ -inofficial E.V..
427
+ -experimental E.V..
428
+ -b_quant_offset <float> E.V..
429
+ -er <int> .DV..
430
+ -careful .DV..
431
+ -compliant .DV..
432
+ -aggressive .DV..
433
+ -very_aggressive .DV..
434
+ -mpeg_quant <int> E.V..
435
+ -rc_qsquish <float> E.V..
436
+ -rc_qmod_amp <float> E.V..
437
+ -rc_qmod_freq <int> E.V..
438
+ -rc_eq <string> E.V..
439
+ -rc_max_rate <int> E.V..
440
+ -rc_min_rate <int> E.V..
441
+ -rc_buffer_size <int> E.V..
442
+ -rc_buf_aggressivity <float> E.V..
443
+ -i_quant_factor <float> E.V..
444
+ -i_quant_offset <float> E.V..
445
+ -rc_initial_cplx <float> E.V..
446
+ -dct <int> E.V..
447
+ -auto E.V..
448
+ -fastint E.V..
449
+ -int E.V..
450
+ -mmx E.V..
451
+ -mlib E.V..
452
+ -altivec E.V..
453
+ -faan E.V..
454
+ -lumi_mask <float> E.V.. lumimasking
455
+ -tcplx_mask <float> E.V.. temporal complexity masking
456
+ -scplx_mask <float> E.V.. spatial complexity masking
457
+ -p_mask <float> E.V.. inter masking
458
+ -dark_mask <float> E.V.. darkness masking
459
+ -idct <int> EDV..
460
+ -auto EDV..
461
+ -int EDV..
462
+ -simple EDV..
463
+ -simplemmx EDV..
464
+ -libmpeg2mmx EDV..
465
+ -ps2 EDV..
466
+ -mlib EDV..
467
+ -arm EDV..
468
+ -altivec EDV..
469
+ -sh4 EDV..
470
+ -simplearm EDV..
471
+ -h264 EDV..
472
+ -vp3 EDV..
473
+ -ipp EDV..
474
+ -xvidmmx EDV..
475
+ -ec <flags> .DV..
476
+ -guess_mvs .DV..
477
+ -deblock .DV..
478
+ -pred <int> E.V.. prediction method
479
+ -left E.V..
480
+ -plane E.V..
481
+ -median E.V..
482
+ -aspect <rational> E.V..
483
+ -debug <flags> EDVAS print specific debug info
484
+ -pict .DV..
485
+ -rc E.V..
486
+ -bitstream .DV..
487
+ -mb_type .DV..
488
+ -qp .DV..
489
+ -mv .DV..
490
+ -dct_coeff .DV..
491
+ -skip .DV..
492
+ -startcode .DV..
493
+ -pts .DV..
494
+ -er .DV..
495
+ -mmco .DV..
496
+ -bugs .DV..
497
+ -vis_qp .DV..
498
+ -vis_mb_type .DV..
499
+ -vismv <int> .DV.. visualize motion vectors
500
+ -pf .DV..
501
+ -bf .DV..
502
+ -bb .DV..
503
+ -mb_qmin <int> E.V..
504
+ -mb_qmax <int> E.V..
505
+ -cmp <int> E.V.. full pel me compare function
506
+ -subcmp <int> E.V.. sub pel me compare function
507
+ -mbcmp <int> E.V.. macroblock compare function
508
+ -ildctcmp <int> E.V.. interlaced dct compare function
509
+ -dia_size <int> E.V..
510
+ -last_pred <int> E.V..
511
+ -preme <int> E.V..
512
+ -precmp <int> E.V.. pre motion estimation compare function
513
+ -sad E.V..
514
+ -sse E.V..
515
+ -satd E.V..
516
+ -dct E.V..
517
+ -psnr E.V..
518
+ -bit E.V..
519
+ -rd E.V..
520
+ -zero E.V..
521
+ -vsad E.V..
522
+ -vsse E.V..
523
+ -nsse E.V..
524
+ -w53 E.V..
525
+ -w97 E.V..
526
+ -dctmax E.V..
527
+ -chroma E.V..
528
+ -pre_dia_size <int> E.V..
529
+ -subq <int> E.V.. sub pel motion estimation quality
530
+ -me_range <int> E.V..
531
+ -ibias <int> E.V..
532
+ -pbias <int> E.V..
533
+ -coder <int> E.V..
534
+ -vlc E.V.. variable length coder / huffman coder
535
+ -ac E.V.. arithmetic coder
536
+ -context <int> E.V.. context model
537
+ -mbd <int> E.V..
538
+ -simple E.V..
539
+ -bits E.V..
540
+ -rd E.V..
541
+ -sc_threshold <int> E.V..
542
+ -lmin <int> E.V.. min lagrange factor
543
+ -lmax <int> E.V.. max lagrange factor
544
+ -nr <int> E.V.. noise reduction
545
+ -rc_init_occupancy <int> E.V..
546
+ -inter_threshold <int> E.V..
547
+ -flags2 <flags> EDVA.
548
+ -antialias <int> .DV..
549
+ -auto .DV..
550
+ -fastint .DV..
551
+ -int .DV..
552
+ -float .DV..
553
+ -qns <int> E.V.. quantizer noise shaping
554
+ -thread_count <int> EDV..
555
+ -dc <int> E.V..
556
+ -nssew <int> E.V.. nsse weight
557
+ -skip_top <int> .DV..
558
+ -skip_bottom <int> .DV..
559
+ -profile <int> E.VA.
560
+ -unknown E.VA.
561
+ -level <int> E.VA.
562
+ -unknown E.VA.
563
+ -lowres <int> .DV..
564
+ -frame_skip_threshold <int> E.V..
565
+ -frame_skip_factor <int> E.V..
566
+ -frame_skip_exp <int> E.V..
567
+ -skipcmp <int> E.V.. frame skip compare function
568
+ -border_mask <float> E.V..
569
+ -mb_lmin <int> E.V..
570
+ -mb_lmax <int> E.V..
571
+ -me_penalty_compensation <int> E.V..
572
+ -bidir_refine <int> E.V..
573
+ -brd_scale <int> E.V..
574
+ -crf <int> E.V..
575
+ -cqp <int> E.V..
576
+ -keyint_min <int> E.V..
577
+ -refs <int> E.V..
578
+ -chromaoffset <int> E.V..
579
+ -bframebias <int> E.V..
580
+ -trellis <int> E.V..
581
+ -directpred <int> E.V..
582
+ -bpyramid E.V..
583
+ -wpred E.V..
584
+ -mixed_refs E.V..
585
+ -8x8dct E.V..
586
+ -fastpskip E.V..
587
+ -aud E.V..
588
+ -brdo E.V..
589
+ -complexityblur <float> E.V..
590
+ -deblockalpha <int> E.V..
591
+ -deblockbeta <int> E.V..
592
+ -partitions <flags> E.V..
593
+ -parti4x4 E.V..
594
+ -parti8x8 E.V..
595
+ -partp4x4 E.V..
596
+ -partp8x8 E.V..
597
+ -partb8x8 E.V..
598
+ -sc_factor <int> E.V.."
599
+ lambda {
600
+ @ffmpeg.send(:parse_result, result)
601
+ }.should raise_error(TranscoderError::InvalidCommand, "must pass a command to ffmpeg")
602
+ end
603
+
604
+ specify "when given a broken command" do
605
+ result = "FFmpeg version CVS, Copyright (c) 2000-2004 Fabrice Bellard
606
+ Mac OSX universal build for ffmpegX
607
+ configuration: --enable-memalign-hack --enable-mp3lame --enable-gpl --disable-vhook --disable-ffplay --disable-ffserver --enable-a52 --enable-xvid --enable-faac --enable-faad --enable-amr_nb --enable-amr_wb --enable-pthreads --enable-x264
608
+ libavutil version: 49.0.0
609
+ libavcodec version: 51.9.0
610
+ libavformat version: 50.4.0
611
+ built on Apr 15 2006 04:58:19, gcc: 4.0.1 (Apple Computer, Inc. build 5250)
612
+ Unable for find a suitable output format for 'foo'
613
+ "
614
+ lambda {
615
+ @ffmpeg.send(:parse_result, result)
616
+ }.should raise_error(TranscoderError::InvalidCommand, "Unable for find a suitable output format for 'foo'")
617
+ end
618
+
619
+ specify "when given a missing input file" do
620
+ result = "FFmpeg version CVS, Copyright (c) 2000-2004 Fabrice Bellard
621
+ Mac OSX universal build for ffmpegX
622
+ configuration: --enable-memalign-hack --enable-mp3lame --enable-gpl --disable-vhook --disable-ffplay --disable-ffserver --enable-a52 --enable-xvid --enable-faac --enable-faad --enable-amr_nb --enable-amr_wb --enable-pthreads --enable-x264
623
+ libavutil version: 49.0.0
624
+ libavcodec version: 51.9.0
625
+ libavformat version: 50.4.0
626
+ built on Apr 15 2006 04:58:19, gcc: 4.0.1 (Apple Computer, Inc. build 5250)
627
+ asdf: I/O error occured
628
+ Usually that means that input file is truncated and/or corrupted.
629
+ "
630
+ lambda {
631
+ @ffmpeg.send(:parse_result, result)
632
+ }.should raise_error(TranscoderError::InvalidFile, /I\/O error: .+/)
633
+ end
634
+
635
+ specify "when given a file it can't handle" do
636
+ puts "not tested"
637
+ end
638
+
639
+ specify "when cancelled halfway through" do
640
+ puts "not tested"
641
+ end
642
+
643
+ specify "when receiving unexpected results" do
644
+ result = "FFmpeg version CVS, Copyright (c) 2000-2004 Fabrice Bellard
645
+ Mac OSX universal build for ffmpegX
646
+ configuration: --enable-memalign-hack --enable-mp3lame --enable-gpl --disable-vhook --disable-ffplay --disable-ffserver --enable-a52 --enable-xvid --enable-faac --enable-faad --enable-amr_nb --enable-amr_wb --enable-pthreads --enable-x264
647
+ libavutil version: 49.0.0
648
+ libavcodec version: 51.9.0
649
+ libavformat version: 50.4.0
650
+ built on Apr 15 2006 04:58:19, gcc: 4.0.1 (Apple Computer, Inc. build 5250)
651
+
652
+ Seems that stream 1 comes from film source: 600.00 (600/1) -> 59.75 (239/4)
653
+ Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'jobjob2.mov':
654
+ Duration: 00:01:09.0, start: 0.000000, bitrate: 28847 kb/s
655
+ Stream #0.0(eng): Audio: aac, 44100 Hz, stereo
656
+ Stream #0.1(eng), 59.75 fps(r): Video: dvvideo, yuv411p, 720x480
657
+ Stream mapping:
658
+ Stream #0.1 -> #0.0
659
+ Stream #0.0 -> #0.1
660
+ Press [q] to stop encoding
661
+ foo
662
+ bar
663
+ "
664
+ lambda {
665
+ @ffmpeg.send(:parse_result, result)
666
+ }.should raise_error(TranscoderError::UnexpectedResult, 'foo - bar')
667
+ end
668
+
669
+ specify "when a stream cannot be written" do
670
+ result = "FFmpeg version CVS, Copyright (c) 2000-2004 Fabrice Bellard
671
+ Mac OSX universal build for ffmpegX
672
+ configuration: --enable-memalign-hack --enable-mp3lame --enable-gpl --disable-vhook --disable-ffplay --disable-ffserver --enable-a52 --enable-xvid --enable-faac --enable-faad --enable-amr_nb --enable-amr_wb --enable-pthreads --enable-x264
673
+ libavutil version: 49.0.0
674
+ libavcodec version: 51.9.0
675
+ libavformat version: 50.4.0
676
+ built on Apr 15 2006 04:58:19, gcc: 4.0.1 (Apple Computer, Inc. build 5250)
677
+
678
+ Seems that stream 1 comes from film source: 600.00 (600/1) -> 59.75 (239/4)
679
+ Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'jobjob2.mov':
680
+ Duration: 00:01:09.0, start: 0.000000, bitrate: 28847 kb/s
681
+ Stream #0.0(eng): Audio: aac, 44100 Hz, stereo
682
+ Stream #0.1(eng), 59.75 fps(r): Video: dvvideo, yuv411p, 720x480
683
+ Stream mapping:
684
+ Stream #0.1 -> #0.0
685
+ Stream #0.0 -> #0.1
686
+ Press [q] to stop encoding
687
+ [mp3 @ 0x54340c]flv doesnt support that sample rate, choose from (44100, 22050, 11025)
688
+ Could not write header for output file #0 (incorrect codec parameters ?)
689
+ "
690
+ lambda {
691
+ @ffmpeg.send(:parse_result, result)
692
+ }.should raise_error(TranscoderError, /flv doesnt support.*incorrect codec/)
693
+ end
694
+
695
+ end
696
+ end
697
+ end
698
+
699
+ def setup_ffmpeg_spec
700
+ @options = {:input_file => "foo", :output_file => "bar", :resolution => "baz"}
701
+ @simple_avi = "ffmpeg -i $input_file$ -ar 44100 -ab 64 -vcodec xvid -acodec mp3 -r 29.97 -s $resolution$ -y $output_file$"
702
+ @ffmpeg = RVideo::Tools::Ffmpeg.new(@simple_avi, @options)
703
+ end