Permalink
Browse files

Moving to GitHub.

  • Loading branch information...
0 parents commit d122bb70c8bf479fc7a13737d707082e08966e20 @jdl jdl committed Sep 10, 2008
@@ -0,0 +1,56 @@
+== 0.9.5 2008-09-09
+Note:
+* Moving hosting to GitHub.
+ http://github.com/zencoder/rvideo/tree
+
+2 major enhancements:
+* Large files, or some tools, would dump out so much output that it could run a server out of memory.
+ Changed the way that output is parsed. Instead of pulling it all into memory, the log file is sent to
+ disk, and then post-processed.
+* Added support for yamdi (http://yamdi.sourceforge.net/) for FLV metadata injection. This is much faster
+ than flvtool2 on huge files, and uses less memory as well.
+
+
+== 0.9.4 2007-12-12
+
+3 major enhancements:
+* 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.
+* 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%").
+* Added resolution/aspect support. Pass :width and :height parameters to a Transcoder instance, and include $resolution$ or $aspect_ratio$ in the recipe.
+
+4 minor enhancements:
+* Remove old/unnecessary files and features
+* Three additional ffmpeg results: unsupported codec and no output streams
+* One additional flvtool2 result: empty input file
+* Check that input file exists earlier in the transcoding process
+
+== 0.9.3 2007-10-30
+
+One minor enhancement:
+* Reraise all unhandled RVideo exceptions as TranscoderErrors
+
+== 0.9.2 2007-10-30
+
+One minor bug fix:
+* Correctly parse invalid files, where duration and bitrate are N/A, but start: 0.000 is included
+
+== 0.9.1 2007-10-11
+
+One major enhancement:
+* Added Mencoder support. (Andre Medeiros)
+
+Two minor enhancements:
+* Added total_time method to RVideo::Transcoder instances.
+* Added another error condition for ffmpeg - codec not found.
+
+Two notes:
+* Tried and tested using open3 and open4 for command execution, but mencoder would unexpectedly hang with certain files when using these. Reverted these changes.
+* 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).
+
+== 0.9.0 2007-09-27
+
+* Public RVideo release.
+
+== 0.8.0 2007-09-27
+
+* RVideo rewrite.
@@ -0,0 +1,20 @@
+Copyright (c) 2007 Jonathan Dahl and Slantwise Design
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,91 @@
+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.
11 RULES
@@ -0,0 +1,11 @@
+Collection of transcoding edge cases and rules
+------------------------
+
+* mpeg4 output errors out if frame rate is not supplied
+
+ [mpeg4 @ 0x149e810]timebase not supported by mpeg 4 standard
+ Error while opening codec for output stream #0.0 - maybe incorrect parameters such as bit_rate, rate, width or height
+
+ Solution: provide a frame rate with -r (any frame rate will do)
+
+
178 Rakefile
@@ -0,0 +1,178 @@
+require 'rubygems'
+require 'rake'
+require 'rake/clean'
+require 'rake/testtask'
+require 'rake/packagetask'
+require 'rake/gempackagetask'
+require 'rake/rdoctask'
+require 'rake/contrib/rubyforgepublisher'
+require 'fileutils'
+require 'hoe'
+begin
+ require 'spec/rake/spectask'
+rescue LoadError
+ puts 'To use rspec for testing you must install rspec gem:'
+ puts '$ sudo gem install rspec'
+ exit
+end
+
+include FileUtils
+require File.join(File.dirname(__FILE__), 'lib', 'rvideo', 'version')
+
+AUTHOR = 'Jonathan Dahl (Slantwise Design)' # can also be an array of Authors
+EMAIL = "jon@slantwisedesign.com"
+DESCRIPTION = "Inspect and process video or audio files"
+GEM_NAME = 'rvideo' # what ppl will type to install your gem
+
+@config_file = "~/.rubyforge/user-config.yml"
+@config = nil
+def rubyforge_username
+ unless @config
+ begin
+ @config = YAML.load(File.read(File.expand_path(@config_file)))
+ rescue
+ puts <<-EOS
+ERROR: No rubyforge config file found: #{@config_file}"
+Run 'rubyforge setup' to prepare your env for access to Rubyforge
+ - See http://newgem.rubyforge.org/rubyforge.html for more details
+ EOS
+ exit
+ end
+ end
+ @rubyforge_username ||= @config["username"]
+end
+
+RUBYFORGE_PROJECT = 'rvideo' # The unix name for your project
+HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
+DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
+
+NAME = "rvideo"
+REV = nil
+# UNCOMMENT IF REQUIRED:
+# REV = `svn info`.each {|line| if line =~ /^Revision:/ then k,v = line.split(': '); break v.chomp; else next; end} rescue nil
+VERS = Rvideo::VERSION::STRING + (REV ? ".#{REV}" : "")
+CLEAN.include ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store']
+RDOC_OPTS = ['--quiet', '--title', 'rvideo documentation',
+ "--opname", "index.html",
+ "--line-numbers",
+ "--main", "README",
+ "--inline-source"]
+
+class Hoe
+ def extra_deps
+ @extra_deps.reject { |x| Array(x).first == 'hoe' }
+ end
+end
+
+# Generate all the Rake tasks
+# Run 'rake -T' to see list of generated tasks (from gem root directory)
+hoe = Hoe.new(GEM_NAME, VERS) do |p|
+ p.author = AUTHOR
+ p.description = DESCRIPTION
+ p.email = EMAIL
+ p.summary = DESCRIPTION
+ p.url = HOMEPATH
+ p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
+ p.test_globs = ["test/**/test_*.rb"]
+ p.clean_globs |= CLEAN #An array of file patterns to delete on clean.
+
+ # == Optional
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
+ #p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
+ #p.spec_extras = {} # A hash of extra values to set in the gemspec.
+end
+
+CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\n\n")
+PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
+hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
+
+desc 'Generate website files'
+task :website_generate do
+ Dir['website/**/*.txt'].each do |txt|
+ sh %{ ruby scripts/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
+ end
+end
+
+desc 'Upload website files to rubyforge'
+task :website_upload do
+ host = "#{rubyforge_username}@rubyforge.org"
+ remote_dir = "/var/www/gforge-projects/#{PATH}/"
+ local_dir = 'website'
+ sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
+end
+
+desc 'Generate and upload website files'
+task :website => [:website_generate, :website_upload, :publish_docs]
+
+desc 'Release the website and new gem version'
+task :deploy => [:check_version, :website, :release] do
+ puts "Remember to create SVN tag:"
+ puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
+ "svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
+ puts "Suggested comment:"
+ puts "Tagging release #{CHANGES}"
+end
+
+desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
+task :local_deploy => [:website_generate, :install_gem]
+
+task :check_version do
+ unless ENV['VERSION']
+ puts 'Must pass a VERSION=x.y.z release version'
+ exit
+ end
+ unless ENV['VERSION'] == VERS
+ puts "Please update your version.rb to match the release version, currently #{VERS}"
+ exit
+ end
+end
+
+#require 'rake'
+#require 'spec/rake/spectask'
+require File.dirname(__FILE__) + '/lib/rvideo'
+
+namespace :spec do
+ desc "Run Unit Specs"
+ Spec::Rake::SpecTask.new("units") do |t|
+ t.spec_files = FileList['spec/units/**/*.rb']
+ end
+
+ desc "Run Integration Specs"
+ Spec::Rake::SpecTask.new("integrations") do |t|
+ t.spec_files = FileList['spec/integrations/**/*.rb']
+ end
+end
+
+desc "Process a file"
+task(:transcode) do
+ RVideo::Transcoder.logger = Logger.new(STDOUT)
+ transcode_single_job(ENV['RECIPE'], ENV['FILE'])
+end
+
+desc "Batch transcode files"
+task(:batch_transcode) do
+ RVideo::Transcoder.logger = Logger.new(File.dirname(__FILE__) + '/test/output.log')
+ f = YAML::load(File.open(File.dirname(__FILE__) + '/test/batch_transcode.yml'))
+ recipes = f['recipes']
+ files = f['files']
+ files.each do |f|
+ file = "#{File.dirname(__FILE__)}/test/files/#{f}"
+ recipes.each do |recipe|
+ transcode_single_job(recipe, file)
+ end
+ end
+end
+
+def transcode_single_job(recipe, input_file)
+ puts "Transcoding #{File.basename(input_file)} to #{recipe}"
+ r = YAML::load(File.open(File.dirname(__FILE__) + '/test/recipes.yml'))[recipe]
+ transcoder = RVideo::Transcoder.new(input_file)
+ output_file = "#{TEMP_PATH}/#{File.basename(input_file, ".*")}-#{recipe}.#{r['extension']}"
+ FileUtils.mkdir_p(File.dirname(output_file))
+ begin
+ transcoder.execute(r['command'], {:output_file => output_file}.merge(r))
+ puts "Finished #{File.basename(output_file)} in #{transcoder.total_time}"
+ rescue StandardError => e
+ puts "Error transcoding #{File.basename(output_file)} - #{e.class} (#{e.message}\n#{e.backtrace})"
+ end
+end
@@ -0,0 +1,22 @@
+$LOAD_PATH.unshift File.dirname(__FILE__) + '/rvideo'
+
+require 'inspector'
+require 'float'
+require 'tools/abstract_tool'
+require 'tools/ffmpeg'
+require 'tools/mencoder'
+require 'tools/flvtool2'
+require 'tools/mp4box'
+require 'tools/mplayer'
+require 'tools/mp4creator'
+require 'tools/ffmpeg2theora'
+require 'tools/yamdi'
+require 'errors'
+require 'transcoder'
+require 'active_support'
+
+TEMP_PATH = File.expand_path(File.dirname(__FILE__) + '/../tmp')
+FIXTURE_PATH = File.expand_path(File.dirname(__FILE__) + '/../spec/fixtures')
+TEST_FILE_PATH = File.expand_path(File.dirname(__FILE__) + '/../spec/files')
+REPORT_PATH = File.expand_path(File.dirname(__FILE__) + '/../report')
+
Oops, something went wrong.

0 comments on commit d122bb7

Please sign in to comment.