1
I Use This!
Inactive
Analyzed 1 day ago. based on code collected 2 days ago.

Project Summary

RVideoRVideo is a Ruby library inspects and processes video and audio files by providing an interface to free Unix tools like ffmpeg.

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

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

sudo port install ffmpegOr, 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 +a52Most 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 flvtool2Once ffmpeg and RVideo are installed, you’re set.

The basicsfile = RVideo::Inspector.new(:file => "#{FILE_PATH}/filename.mp4")
file.video_codec # => mpeg4
file.audio_codec # => aac
file.resolution # => 320x240

command = "ffmpeg -i $input_file -vcodec xvid -s $resolution$ $output_file$"
options = {
:input_file => "#{FILE_PATH}/filename.mp4",
:output_file => "#{FILE_PATH}/processed_file.mp4",
:resolution => "640x480"
}

transcoder = RVideo::Transcoder.new

transcoder.execute(command, options)

transcoder.processed.video_codec # => xvidDemonstration of usageTo 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.newThen 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}"
endIf the job succeeds, you can access the metadata of the input and output files with:

transcoder.original # RVideo::Inspector object
transcoder.processed # RVideo::Inspector objectEven if the file is processed, it 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.

ContributeContribute 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 Read the 8 steps for fixing other people’s code and for section 8b: Submit patch to Google Groups, use the Google Group above.

The trunk repository is svn://rubyforge.org/var/svn/rvideo/trunk for anonymous access.

LicenseThis code is free to use under the terms of the MIT license.

Tags

audio ruby video

In a Nutshell, rvideo...

MIT License
Permitted

Commercial Use

Modify

Distribute

Sub-License

Private Use

Forbidden

Hold Liable

Required

Include Copyright

Include License

These details are provided for information only. No information here is legal advice and should not be used as such.

Project Security

Vulnerabilities per Version ( last 10 releases )

There are no reported vulnerabilities

Project Vulnerability Report

Security Confidence Index

Poor security track-record
Favorable security track-record

Vulnerability Exposure Index

Many reported vulnerabilities
Few reported vulnerabilities

Did You Know...

  • ...
    55% of companies leverage OSS for production infrastructure
  • ...
    by exploring contributors within projects, you can view details on every commit they have made to that project
  • ...
    65% of companies leverage OSS to speed application development in 2016
  • ...
    you can embed statistics from Open Hub on your site
About Project Security

Languages

Ruby
95%
3 Other
5%

30 Day Summary

Feb 25 2024 — Mar 26 2024

12 Month Summary

Mar 26 2023 — Mar 26 2024