public
Fork of greatseth/rvideo
Description: Unofficial home of the RVideo project, a Ruby gem for video and audio transcoding. Working on an up to date rvideo repo. Pardon the dust. Help gladly accepted!
Homepage:
Clone URL: git://github.com/davidjrice/rvideo.git
rvideo /
name age message
file .gitignore Fri Feb 13 10:34:33 -0800 2009 moving from Hoe to Echoe for package utilities ... [greatseth]
file CHANGELOG Wed Mar 04 18:52:01 -0800 2009 let's say this is 0.9.6? minor point is weak fo... [greatseth]
file ENV Thu Feb 12 08:04:40 -0800 2009 copy over things from 0.9.3. rubyforge release ... [greatseth]
file ENV2 Thu Feb 12 08:04:40 -0800 2009 copy over things from 0.9.3. rubyforge release ... [greatseth]
file LICENSE Tue Sep 09 21:27:31 -0700 2008 Moving to GitHub. [jdl]
file Manifest Thu Apr 02 07:27:53 -0700 2009 clean up package config a bit [greatseth]
file README Fri Feb 13 10:34:33 -0800 2009 moving from Hoe to Echoe for package utilities ... [greatseth]
file RULES Tue Sep 09 21:27:31 -0700 2008 Moving to GitHub. [jdl]
file Rakefile Loading commit data...
file VERSION.yml
directory config/ Fri Feb 27 19:48:27 -0800 2009 improved irb harness by moving some spec helper... [greatseth]
directory lib/
file new_file_not_in_branch.txt
file rvideo.gemspec
file rvideo.gemspec~
directory scripts/ Thu Feb 12 08:04:40 -0800 2009 copy over things from 0.9.3. rubyforge release ... [greatseth]
file setup.rb Thu Feb 12 08:04:40 -0800 2009 copy over things from 0.9.3. rubyforge release ... [greatseth]
directory spec/ Mon Apr 13 14:13:16 -0700 2009 Add deinterlace option to ffmpeg tool This new... [kakra]
directory tasks/ Wed Mar 04 18:50:47 -0800 2009 clean up rake tasks a little, put my email in t... [greatseth]
file test_file.txt
directory tmp/ Thu Feb 12 18:46:16 -0800 2009 copied over 0.9.4 svn and got specs passing [greatseth]
directory website/ Thu Feb 12 08:04:40 -0800 2009 copy over things from 0.9.3. rubyforge release ... [greatseth]
README
= RVideo

RVideo allows you to inspect and process video files.


Installation is a little involved. First, install the gem:

  sudo gem install rvideo
  
Next, install ffmpeg and (possibly) other related libraries. This is
documented elsewhere on the web, and can be a headache. If you are on OS X,
the Darwinports build is reasonably good (though not perfect). Install with:

  sudo port install ffmpeg

Or, for a better build (recommended), add additional video- and audio-related
libraries, like this:

  sudo port install ffmpeg +lame +libogg +vorbis +faac +faad +xvid +x264 +a52
  
Most package management systems include a build of ffmpeg, but many include a
poor build. So you may need to compile from scratch.

If you want to create Flash Video files, also install flvtool2:

  sudo gem install flvtool2

Once ffmpeg and RVideo are installed, you're set. 

To inspect a file, initialize an RVideo file inspector object. See the 
documentation for details.

A few examples:

  file = RVideo::Inspector.new(:file => "#{APP_ROOT}/files/input.mp4")
  
  file = RVideo::Inspector.new(:raw_response => @existing_response)
  
  file = RVideo::Inspector.new(:file => "#{APP_ROOT}/files/input.mp4",
                                :ffmpeg_binary => "#{APP_ROOT}/bin/ffmpeg")

  file.fps        # "29.97"
  file.duration   # "00:05:23.4"

To transcode a video, initialize a Transcoder object.

  transcoder = RVideo::Transcoder.new

Then pass a command and valid options to the execute method

  recipe = "ffmpeg -i $input_file$ -ar 22050 -ab 64 -f flv -r 29.97 -s"
  recipe += " $resolution$ -y $output_file$"
  recipe += "\nflvtool2 -U $output_file$"
  begin
    transcoder.execute(recipe, {:input_file => "/path/to/input.mp4",
      :output_file => "/path/to/output.flv", :resolution => "640x360"})
  rescue TranscoderError => e
    puts "Unable to transcode file: #{e.class} - #{e.message}"
  end

If the job succeeds, you can access the metadata of the input and output
files with:

  transcoder.original     # RVideo::Inspector object
  transcoder.processed    # RVideo::Inspector object

If the transcoding succeeds, the file may still have problems. RVideo
will populate an errors array if the duration of the processed video
differs from the duration of the original video, or if the processed
file is unreadable.

Thanks to Peter Boling for early work on RVideo.

Contribute to RVideo! If you want to help out, there are a few things you can 
do.

- Use, test, and submit bugs/patches
- We need a RVideo::Tools::Mencoder class to add mencoder support.
- Other tool classes would be great - On2, mp4box, Quicktime (?), etc.
- Submit other fixes, features, optimizations, and refactorings

If RVideo is useful to you, you may also be interested in RMovie, another Ruby
video library. See http://rmovie.rubyforge.org/ for more.

Finally, watch for Zencoder, a commercial video transcoder built by Slantwise 
Design. Zencoder uses RVideo for its video processing, but adds file queuing,  
distributed transcoding, a web-based transcoder dashboard, and more. See 
http://zencoder.tv or http://slantwisedesign.com for more.

Copyright (c) 2007 Jonathan Dahl and Slantwise Design. Released under the MIT 
license.