J
Jon Dahl
RVideo has just been released as a gem!
RVideo is a Ruby library inspects and processes video and audio files
by providing an interface to free Unix tools like ffmpeg. Install
with:
sudo gem install rvideo
(RVideo requires ffmpeg, and may require other video tools, depending
on what you intend to do.)
For more information, see the full announcement at RailSpikes
(http://railspikes.com/2007/10/2/rvideo-0-9-is-now-available), or the
RVideo site at Google Code (http://code.google.com/p/rvideo)
Code example 1: inspecting a video file
------------------------------
file = RVideo::Inspector.new
file => "#{FILE_PATH}/filename.mp4")
file.video_codec # => mpeg4
file.audio_codec # => aac
file.resolution # => 320x240
Code example 2: transcoding a video file
------------------------------
command = "ffmpeg -i $input_file -vcodec xvid -s $resolution$
$output_file$"
options = {
:input_file => "#{FILE_PATH}/filename.mp4",
utput_file => "#{FILE_PATH}/processed_file.mp4",
:resolution => "640x480"
}
transcoder = RVideo::Transcoder.new
transcoder.execute(command, options)
transcoder.processed.video_codec # => xvid
RVideo is a Ruby library inspects and processes video and audio files
by providing an interface to free Unix tools like ffmpeg. Install
with:
sudo gem install rvideo
(RVideo requires ffmpeg, and may require other video tools, depending
on what you intend to do.)
For more information, see the full announcement at RailSpikes
(http://railspikes.com/2007/10/2/rvideo-0-9-is-now-available), or the
RVideo site at Google Code (http://code.google.com/p/rvideo)
Code example 1: inspecting a video file
------------------------------
file = RVideo::Inspector.new
file.video_codec # => mpeg4
file.audio_codec # => aac
file.resolution # => 320x240
Code example 2: transcoding a video file
------------------------------
command = "ffmpeg -i $input_file -vcodec xvid -s $resolution$
$output_file$"
options = {
:input_file => "#{FILE_PATH}/filename.mp4",
:resolution => "640x480"
}
transcoder = RVideo::Transcoder.new
transcoder.execute(command, options)
transcoder.processed.video_codec # => xvid