twinge-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 (68) 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/config/boot.rb +25 -0
  10. data/lib/rvideo.rb +44 -0
  11. data/lib/rvideo/errors.rb +24 -0
  12. data/lib/rvideo/float.rb +7 -0
  13. data/lib/rvideo/frame_capturer.rb +126 -0
  14. data/lib/rvideo/inspector.rb +481 -0
  15. data/lib/rvideo/reporter.rb +176 -0
  16. data/lib/rvideo/reporter/views/index.html.erb +27 -0
  17. data/lib/rvideo/reporter/views/report.css +27 -0
  18. data/lib/rvideo/reporter/views/report.html.erb +81 -0
  19. data/lib/rvideo/reporter/views/report.js +9 -0
  20. data/lib/rvideo/string.rb +5 -0
  21. data/lib/rvideo/tools/abstract_tool.rb +401 -0
  22. data/lib/rvideo/tools/ffmpeg.rb +277 -0
  23. data/lib/rvideo/tools/ffmpeg2theora.rb +42 -0
  24. data/lib/rvideo/tools/flvtool2.rb +50 -0
  25. data/lib/rvideo/tools/mencoder.rb +103 -0
  26. data/lib/rvideo/tools/mp4box.rb +21 -0
  27. data/lib/rvideo/tools/mp4creator.rb +35 -0
  28. data/lib/rvideo/tools/mplayer.rb +31 -0
  29. data/lib/rvideo/tools/qtfaststart.rb +37 -0
  30. data/lib/rvideo/tools/yamdi.rb +44 -0
  31. data/lib/rvideo/transcoder.rb +120 -0
  32. data/lib/rvideo/version.rb +9 -0
  33. data/rvideo.gemspec +37 -0
  34. data/scripts/txt2html +67 -0
  35. data/setup.rb +1585 -0
  36. data/spec/files/boat.avi +0 -0
  37. data/spec/files/kites.mp4 +0 -0
  38. data/spec/fixtures/ffmpeg_builds.yml +28 -0
  39. data/spec/fixtures/ffmpeg_results.yml +608 -0
  40. data/spec/fixtures/files.yml +398 -0
  41. data/spec/fixtures/recipes.yml +58 -0
  42. data/spec/integrations/formats_spec.rb +315 -0
  43. data/spec/integrations/frame_capturer_spec.rb +26 -0
  44. data/spec/integrations/inspection_spec.rb +112 -0
  45. data/spec/integrations/recipes_spec.rb +0 -0
  46. data/spec/integrations/rvideo_spec.rb +17 -0
  47. data/spec/integrations/transcoder_integration_spec.rb +29 -0
  48. data/spec/integrations/transcoding_spec.rb +9 -0
  49. data/spec/spec.opts +1 -0
  50. data/spec/spec_helper.rb +16 -0
  51. data/spec/support.rb +36 -0
  52. data/spec/units/abstract_tool_spec.rb +111 -0
  53. data/spec/units/ffmpeg_spec.rb +323 -0
  54. data/spec/units/flvtool2_spec.rb +324 -0
  55. data/spec/units/frame_capturer_spec.rb +72 -0
  56. data/spec/units/inspector_spec.rb +59 -0
  57. data/spec/units/mencoder_spec.rb +4994 -0
  58. data/spec/units/mp4box_spec.rb +34 -0
  59. data/spec/units/mp4creator_spec.rb +34 -0
  60. data/spec/units/mplayer_spec.rb +34 -0
  61. data/spec/units/qtfaststart_spec.rb +35 -0
  62. data/spec/units/string_spec.rb +8 -0
  63. data/spec/units/transcoder_spec.rb +156 -0
  64. data/tasks/deployment.rake +5 -0
  65. data/tasks/testing.rake +27 -0
  66. data/tasks/transcoding.rake +40 -0
  67. data/tasks/website.rake +8 -0
  68. metadata +175 -0
data/CHANGELOG ADDED
@@ -0,0 +1,70 @@
1
+ v0.9.6 IN PROGRESS, TODO: need more documentation of changes here, coming later..
2
+
3
+ Major Enhancements:
4
+ * Inspector#capture_frame behavior moved to new FrameCapturer class
5
+
6
+ Minor Enhancements:
7
+ * Inspector support for [VARIOUS NEW THINGS, TODO: itemize]
8
+
9
+
10
+ v0.9.5 2008-09-09
11
+ Note:
12
+ * Moving hosting to GitHub.
13
+ http://github.com/zencoder/rvideo/tree
14
+
15
+ 2 major enhancements:
16
+ * Large files, or some tools, would dump out so much output that it could run a server out of memory.
17
+ Changed the way that output is parsed. Instead of pulling it all into memory, the log file is sent to
18
+ disk, and then post-processed.
19
+ * Added support for yamdi (http://yamdi.sourceforge.net/) for FLV metadata injection. This is much faster
20
+ than flvtool2 on huge files, and uses less memory as well.
21
+
22
+
23
+ v0.9.4 2007-12-12
24
+
25
+ 3 major enhancements:
26
+ * Changed transcoder interface. The preferred interface is now to pass the input file to RVideo::Transcoder.new. This allows you to create multiple output files from the same Transcoder object, and inspects the input file metadata before the job is transcoded.
27
+ * Added screengrab functionality to the Inspector class. Fire up an inspector instance on a file, and you can take one or more screenshots through inspected_file.capture_frame("50%").
28
+ * Added resolution/aspect support. Pass :width and :height parameters to a Transcoder instance, and include $resolution$ or $aspect_ratio$ in the recipe.
29
+
30
+ 4 minor enhancements:
31
+ * Remove old/unnecessary files and features
32
+ * Three additional ffmpeg results: unsupported codec and no output streams
33
+ * One additional flvtool2 result: empty input file
34
+ * Check that input file exists earlier in the transcoding process
35
+
36
+
37
+ v0.9.3 2007-10-30
38
+
39
+ One minor enhancement:
40
+ * Reraise all unhandled RVideo exceptions as TranscoderErrors
41
+
42
+
43
+ v0.9.2 2007-10-30
44
+
45
+ One minor bug fix:
46
+ * Correctly parse invalid files, where duration and bitrate are N/A, but start: 0.000 is included
47
+
48
+
49
+ v0.9.1 2007-10-11
50
+
51
+ One major enhancement:
52
+ * Added Mencoder support. (Andre Medeiros)
53
+
54
+ Two minor enhancements:
55
+ * Added total_time method to RVideo::Transcoder instances.
56
+ * Added another error condition for ffmpeg - codec not found.
57
+
58
+ Two notes:
59
+ * Tried and tested using open3 and open4 for command execution, but mencoder would unexpectedly hang with certain files when using these. Reverted these changes.
60
+ * Mencoder has basic unit tests, but needs more tests. In particular, example output should be added for a variety of cases (especially failures and errors).
61
+
62
+
63
+ v0.9.0 2007-09-27
64
+
65
+ * Public RVideo release.
66
+
67
+
68
+ v0.8.0 2007-09-27
69
+
70
+ * RVideo rewrite.
data/ENV ADDED
@@ -0,0 +1,100 @@
1
+ RVideo is only as good as the tools it uses. To make the best use of RVideo, follow these instructions.
2
+
3
+ 1. First, install dependencies.
4
+
5
+ wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/all-20061022.tar.bz2 (Mencoder complete codec pack)
6
+ wget http://easynews.dl.sourceforge.net/sourceforge/lame/lame-3.97.tar.gz (LAME mp3 encoder)
7
+ a (Ogg)
8
+ sudo gem install flvtool2 (flvtool2 flv packager)
9
+
10
+ unzip...
11
+
12
+ svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
13
+ svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
14
+
15
+ -. Move mplayer codecs.
16
+
17
+ sudo mkdir /usr/local/lib/codecs/
18
+ mv essential-20061022/* /usr/local/lib/codecs/
19
+ chmod -R 755 /usr/local/lib/codecs/
20
+
21
+ 3. Build
22
+ add /usr/local/lib to /etc/ld.so.conf
23
+ yum install libncurses-devel
24
+
25
+ For most:
26
+ ./configure --enable-shared
27
+ make
28
+ sudo make install
29
+
30
+ FAAC
31
+ -- sudo yum install automake, autoconf, libtool, m4, gcc-c++
32
+ sh bootstrap
33
+ ./configure
34
+ make
35
+ sudo make install
36
+
37
+ FAAD
38
+ (report of bugs - http://www.webhostingtalk.com/archive/index.php/t-565563.html and http://wiki.linuxfromscratch.org/blfs/wiki/faad2)
39
+
40
+ sed -i 's/ /\t/' Makefile.am &&
41
+ sed -i 's/NULL/0/' common/mp4v2/{mp4property.h,rtphint.h} &&
42
+ sed -i '/dd(m/ s/^v/static v/' common/mp4ff/mp4ffint.h
43
+ autoreconf -vif
44
+ ./configure && make && sudo make install
45
+ (maybe add --mp4v2 to ./configure?)
46
+
47
+ XVID
48
+ wget http://downloads.xvid.org/downloads/xvidcore-1.1.3.tar.gz
49
+ ./configure etc. from within xvid/build/generic
50
+
51
+ A52
52
+ wget http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gz
53
+ ./configure etc.
54
+
55
+ AMR
56
+ ???
57
+ wget http://www.3gpp.org/ftp/Specs/archive/26_series/26.104/26104-700.zip
58
+ wget http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-700.zip
59
+ cd ffmpeg/libavcodec/
60
+ mkdir amr_float
61
+ mkdir amrwb_float
62
+ cd amr_float
63
+ unzip ../../../26104-700.zip
64
+ unzip 26104-700_ANSI_C_source_code.zip
65
+ cd ../amrwb_float/
66
+ unzip ../../../26204-700.zip
67
+ unzip 26204-700_ANSI-C_source_code.zip
68
+ ** not working.
69
+
70
+ X264
71
+ svn co svn://svn.videolan.org/x264/trunk x264
72
+ sudo yum install yasm # for mmx/sse - not sure if these are supported
73
+ ./configure --enable-pthread --enable-shared # error adding --enable-mp4-output
74
+ make && sudo make install
75
+
76
+ FFMPEG
77
+ ./configure --enable-libmp3lame --enable-libogg --enable-libvorbis --enable-liba52 --enable-libxvid --enable-libfaac --enable-libfaad --enable-libx264 --enable-xvid --enable-pp --enable-shared --enable-gpl
78
+
79
+ Sources:
80
+ http://vexxhost.com/blog/2007/03/03/installing-ffmpeg-ffmpeg-php-mplayer-mencoder-flv2tool-lame-mp3-encoder-libogg-%E2%80%93-the-easy-way/
81
+ http://cihilt.com/book/export/html/49
82
+
83
+ TODO
84
+ wget http://downloads.xiph.org/releases/flac/flac-1.2.0.tar.gz (FLAC) *
85
+ faac
86
+ faad
87
+ xvid
88
+ x264
89
+ mp4box
90
+ wget http://downloads.xiph.org/releases/theora/libtheora-1.0alpha7.tar.bz2 (theora) *
91
+ wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.2.0.tar.gz (Vorbis) (Gives error - LD_LIBRARY_PATH something)
92
+
93
+ liba52 dlopened no
94
+ libamr-nb support no
95
+ libamr-wb support no
96
+ libdc1394 support no
97
+ libfaad dlopened no
98
+ libgsm enabled no
99
+ libnut enabled no
100
+ libtheora enabled no
data/ENV2 ADDED
@@ -0,0 +1,129 @@
1
+ adduser rvideo
2
+ (add rvideo to sudoers)
3
+ su - rvideo
4
+ mkdir src
5
+ cd src
6
+
7
+ sudo apt-get update (necessary?)
8
+ sudo apt-get install automake
9
+ sudo apt-get install autoconf
10
+ sudo apt-get install libtool
11
+ sudo apt-get install m4
12
+ sudo apt-get install g++ (gcc-c++ in fedora?) # not in OS X - xcode instead?
13
+ sudo apt-get install yasm
14
+
15
+ wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/all-20061022.tar.bz2
16
+ wget http://easynews.dl.sourceforge.net/sourceforge/lame/lame-3.97.tar.gz
17
+ wget http://downloads.xiph.org/releases/ogg/libogg-1.1.3.tar.gz
18
+ wget http://downloads.xvid.org/downloads/xvidcore-1.1.3.tar.gz
19
+ wget http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gz
20
+ wget http://downloads.sourceforge.net/faac/faac-1.25.tar.gz
21
+ wget http://downloads.sourceforge.net/faac/faad2-2.5.tar.gz
22
+ wget http://downloads.xiph.org/releases/theora/libtheora-1.0alpha7.tar.bz2
23
+ wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.2.0.tar.gz
24
+ wget http://ftp.penguin.cz/pub/users/utx/amr/amrnb-7.0.0.0.tar.bz2
25
+ wget http://ftp.penguin.cz/pub/users/utx/amr/amrwb-7.0.0.2.tar.bz2
26
+
27
+ sudo gem install flvtool2
28
+
29
+ svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
30
+ svn co svn://svn.videolan.org/x264/trunk x264
31
+
32
+ tar xzvf a52dec-0.7.4.tar.gz
33
+ tar xzvf faac-1.25.tar.gz
34
+ tar xzvf faad2-2.5.tar.gz
35
+ tar xzvf lame-3.97.tar.gz
36
+ tar xzvf xvidcore-1.1.3.tar.gz
37
+ tar xzvf libogg-1.1.3.tar.gz
38
+ tar xjvf all-20061022.tar.bz2
39
+ tar xjvf libtheora-1.0alpha7.tar.bz2
40
+ tar xjvf amrnb-7.0.0.0.tar.bz2
41
+ tar xjvf amrwb-7.0.0.2.tar.bz2
42
+
43
+ sudo mkdir /usr/local/lib/codecs
44
+ sudo mv all-20061022/* /usr/local/lib/codecs
45
+ sudo chmod -R 755 /usr/local/lib/codecs/
46
+
47
+ echo /usr/local/lib >>/etc/ld.so.conf # not OS X
48
+ sudo ldconfig -v # not OS X
49
+
50
+ cd libogg-1.1.3
51
+ ./configure --enable-shared && make && sudo make install
52
+ cd ..
53
+
54
+ cd libvorbis-1.2.0
55
+ ./configure --enable-shared && make && sudo make install
56
+ cd ..
57
+ :3
58
+ cd libtheora-1.0alpha7
59
+ ./configure --enable-shared && make && sudo make install
60
+ cd ..
61
+
62
+ cd faac
63
+ # PATCH as described at http://research.m1stereo.tv/wiki/index.php/Build_video_enc_env#faac
64
+ autoreconf -vif
65
+ ./configure --with-mp4v2 && make && sudo make install
66
+ cd ..
67
+
68
+ cd faad2
69
+
70
+ # OS X -
71
+ # Patch as per darwinports version
72
+ # Comment out #define HAS_LRINTF block in common.h (including lrintf method definition)
73
+
74
+ # PATCH as described at (Linux) http://research.m1stereo.tv/wiki/index.php/Build_video_enc_env#faad2
75
+ autoreconf -vif
76
+ ./configure && make && sudo make install
77
+ cd ..
78
+
79
+ cd xvidcore/build/generic
80
+ # OS X (see http://rob.opendot.cl/index.php/useful-stuff/xvid-with-asm-on-os-x/)
81
+ ./configure --enable-macosx_module
82
+ Edit build/generic/platform.inc and ADD the flags shown below:
83
+ "-undefined suppress" to SPECIFIC_CFLAGS
84
+ "-f macho -DPREFIX" to AFLAGS (so it reads AFLAGS="AFLAGS=-I$(<D)/ -f macho -DPREFIX")
85
+ "-read_only_relocs suppress" to SPECIFIC_LDFLAGS
86
+
87
+ # Linux
88
+ ./configure && make && sudo make install
89
+ cd ../../..
90
+
91
+ cd a52dec-0.7.4
92
+ ./configure --enable-shared=yes && make && sudo make install
93
+ cd ..
94
+
95
+ cd lame-3.97
96
+ ./configure && make && sudo make install
97
+ cd ..
98
+
99
+ cd x264
100
+ ./configure --enable-pthread && make && sudo make install
101
+ cd ..
102
+
103
+ cd amrnb-7.0.0.0/
104
+ ./configure && make && sudo make install
105
+ cd ..
106
+
107
+ cd amrwb-7.0.0.0/
108
+ ./configure && make && sudo make install
109
+ cd ..
110
+
111
+ cd ffmpeg
112
+ # apply patch from http://research.m1stereo.tv/wiki/index.php/Build_video_enc_env - though use libfaad.c, not faad.c
113
+ ./configure --enable-libmp3lame --enable-libogg --enable-libvorbis --enable-liba52 --enable-libxvid --enable-libfaac --enable-libfaad --enable-libx264 --enable-libxvid --enable-pp --enable-shared --enable-gpl --enable-libtheora --enable-libfaadbin --enable-liba52bin --enable-libamr_nb --enable-libamr_wb
114
+ make && sudo make install
115
+ cd ..
116
+
117
+
118
+ NOT EXECUTED
119
+ apt-get install libncurses-devel (names of yum packages)
120
+ svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
121
+ twolame
122
+ flac
123
+ speex
124
+ libdv
125
+ libmad
126
+ libmpeg2
127
+ mpeg4ip
128
+
129
+ http://graphics.cs.uni-sb.de/NMM/Download/external/nmm-1.0.0/external-libraries-optional/mpeg2dec-0.4.0b.tar.gz
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2007 Jonathan Dahl and Slantwise Design
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Manifest ADDED
@@ -0,0 +1,67 @@
1
+ CHANGELOG
2
+ config/boot.rb
3
+ ENV
4
+ ENV2
5
+ lib/rvideo/errors.rb
6
+ lib/rvideo/float.rb
7
+ lib/rvideo/frame_capturer.rb
8
+ lib/rvideo/inspector.rb
9
+ lib/rvideo/reporter/views/index.html.erb
10
+ lib/rvideo/reporter/views/report.css
11
+ lib/rvideo/reporter/views/report.html.erb
12
+ lib/rvideo/reporter/views/report.js
13
+ lib/rvideo/reporter.rb
14
+ lib/rvideo/string.rb
15
+ lib/rvideo/tools/abstract_tool.rb
16
+ lib/rvideo/tools/ffmpeg.rb
17
+ lib/rvideo/tools/ffmpeg2theora.rb
18
+ lib/rvideo/tools/flvtool2.rb
19
+ lib/rvideo/tools/mencoder.rb
20
+ lib/rvideo/tools/mp4box.rb
21
+ lib/rvideo/tools/mp4creator.rb
22
+ lib/rvideo/tools/mplayer.rb
23
+ lib/rvideo/tools/qtfaststart.rb
24
+ lib/rvideo/tools/yamdi.rb
25
+ lib/rvideo/transcoder.rb
26
+ lib/rvideo/version.rb
27
+ lib/rvideo.rb
28
+ LICENSE
29
+ Manifest
30
+ Rakefile
31
+ README
32
+ RULES
33
+ rvideo.gemspec
34
+ scripts/txt2html
35
+ setup.rb
36
+ spec/files/boat.avi
37
+ spec/files/kites.mp4
38
+ spec/fixtures/ffmpeg_builds.yml
39
+ spec/fixtures/ffmpeg_results.yml
40
+ spec/fixtures/files.yml
41
+ spec/fixtures/recipes.yml
42
+ spec/integrations/formats_spec.rb
43
+ spec/integrations/frame_capturer_spec.rb
44
+ spec/integrations/inspection_spec.rb
45
+ spec/integrations/recipes_spec.rb
46
+ spec/integrations/rvideo_spec.rb
47
+ spec/integrations/transcoder_integration_spec.rb
48
+ spec/integrations/transcoding_spec.rb
49
+ spec/spec.opts
50
+ spec/spec_helper.rb
51
+ spec/support.rb
52
+ spec/units/abstract_tool_spec.rb
53
+ spec/units/ffmpeg_spec.rb
54
+ spec/units/flvtool2_spec.rb
55
+ spec/units/frame_capturer_spec.rb
56
+ spec/units/inspector_spec.rb
57
+ spec/units/mencoder_spec.rb
58
+ spec/units/mp4box_spec.rb
59
+ spec/units/mp4creator_spec.rb
60
+ spec/units/mplayer_spec.rb
61
+ spec/units/qtfaststart_spec.rb
62
+ spec/units/string_spec.rb
63
+ spec/units/transcoder_spec.rb
64
+ tasks/deployment.rake
65
+ tasks/testing.rake
66
+ tasks/transcoding.rake
67
+ tasks/website.rake
data/README ADDED
@@ -0,0 +1,91 @@
1
+ = RVideo
2
+
3
+ RVideo allows you to inspect and process video files.
4
+
5
+
6
+ Installation is a little involved. First, install the gem:
7
+
8
+ sudo gem install rvideo
9
+
10
+ Next, install ffmpeg and (possibly) other related libraries. This is
11
+ documented elsewhere on the web, and can be a headache. If you are on OS X,
12
+ the Darwinports build is reasonably good (though not perfect). Install with:
13
+
14
+ sudo port install ffmpeg
15
+
16
+ Or, for a better build (recommended), add additional video- and audio-related
17
+ libraries, like this:
18
+
19
+ sudo port install ffmpeg +lame +libogg +vorbis +faac +faad +xvid +x264 +a52
20
+
21
+ Most package management systems include a build of ffmpeg, but many include a
22
+ poor build. So you may need to compile from scratch.
23
+
24
+ If you want to create Flash Video files, also install flvtool2:
25
+
26
+ sudo gem install flvtool2
27
+
28
+ Once ffmpeg and RVideo are installed, you're set.
29
+
30
+ To inspect a file, initialize an RVideo file inspector object. See the
31
+ documentation for details.
32
+
33
+ A few examples:
34
+
35
+ file = RVideo::Inspector.new(:file => "#{APP_ROOT}/files/input.mp4")
36
+
37
+ file = RVideo::Inspector.new(:raw_response => @existing_response)
38
+
39
+ file = RVideo::Inspector.new(:file => "#{APP_ROOT}/files/input.mp4",
40
+ :ffmpeg_binary => "#{APP_ROOT}/bin/ffmpeg")
41
+
42
+ file.fps # "29.97"
43
+ file.duration # "00:05:23.4"
44
+
45
+ To transcode a video, initialize a Transcoder object.
46
+
47
+ transcoder = RVideo::Transcoder.new
48
+
49
+ Then pass a command and valid options to the execute method
50
+
51
+ recipe = "ffmpeg -i $input_file$ -ar 22050 -ab 64 -f flv -r 29.97 -s"
52
+ recipe += " $resolution$ -y $output_file$"
53
+ recipe += "\nflvtool2 -U $output_file$"
54
+ begin
55
+ transcoder.execute(recipe, {:input_file => "/path/to/input.mp4",
56
+ :output_file => "/path/to/output.flv", :resolution => "640x360"})
57
+ rescue TranscoderError => e
58
+ puts "Unable to transcode file: #{e.class} - #{e.message}"
59
+ end
60
+
61
+ If the job succeeds, you can access the metadata of the input and output
62
+ files with:
63
+
64
+ transcoder.original # RVideo::Inspector object
65
+ transcoder.processed # RVideo::Inspector object
66
+
67
+ If the transcoding succeeds, the file may still have problems. RVideo
68
+ will populate an errors array if the duration of the processed video
69
+ differs from the duration of the original video, or if the processed
70
+ file is unreadable.
71
+
72
+ Thanks to Peter Boling for early work on RVideo.
73
+
74
+ Contribute to RVideo! If you want to help out, there are a few things you can
75
+ do.
76
+
77
+ - Use, test, and submit bugs/patches
78
+ - We need a RVideo::Tools::Mencoder class to add mencoder support.
79
+ - Other tool classes would be great - On2, mp4box, Quicktime (?), etc.
80
+ - Submit other fixes, features, optimizations, and refactorings
81
+
82
+ If RVideo is useful to you, you may also be interested in RMovie, another Ruby
83
+ video library. See http://rmovie.rubyforge.org/ for more.
84
+
85
+ Finally, watch for Zencoder, a commercial video transcoder built by Slantwise
86
+ Design. Zencoder uses RVideo for its video processing, but adds file queuing,
87
+ distributed transcoding, a web-based transcoder dashboard, and more. See
88
+ http://zencoder.tv or http://slantwisedesign.com for more.
89
+
90
+ Copyright (c) 2007 Jonathan Dahl and Slantwise Design. Released under the MIT
91
+ license.