[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[ANN] RVideo - Ruby video transcoding library

Jon Dahl

10/2/2007 8:19:00 PM

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...), or the
RVideo site at Google Code (http://code.google.co...)


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",
:output_file => "#{FILE_PATH}/processed_file.mp4",
:resolution => "640x480"
}

transcoder = RVideo::Transcoder.new

transcoder.execute(command, options)

transcoder.processed.video_codec # => xvid
--
Posted via http://www.ruby-....

3 Answers

Ilmari Heikkinen

10/3/2007 10:18:00 AM

0

On 10/2/07, Jon Dahl <jon@slantwisedesign.com> wrote:
> 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...), or the
> RVideo site at Google Code (http://code.google.co...)

Hey, great! Thanks for releasing this, it looks very useful.
I'll give it a spin once my replacement power supply arrives.

One API idea:
RVideo.transcode("filename.mp4", "filename.avi",
:resolution => [640,480],
:video_codec => 'xvid',
:audio_codec => 'mp3')

Cheers,
--
Ilmari Heikkinen
http://fhtr.bl...

Jon Dahl

10/3/2007 2:39:00 PM

0

Ilmari Heikkinen wrote:
>
> One API idea:
> RVideo.transcode("filename.mp4", "filename.avi",
> :resolution => [640,480],
> :video_codec => 'xvid',
> :audio_codec => 'mp3')
>

Thanks for the suggestion. I'd like to do something like that at some
point, but I'm not exactly sure how.

I spent quite a bit of time thinking about the best way to define a
command. The problem is that ffmpeg is extremely complex, and a good
quality transcoding job often involves more than just resolution, codec,
format, etc. There are literally hundreds of other options that can be
set that control quality, file size, a/v sync, etc. So I didn't want to
reduce the power of ffmpeg by controlling the options too much.

So I decided for now to just do the simplest thing possible and pass in
a command with variable interpolation. This allows you to store recipes
on your system (in your database, in a yaml config file, etc.), and to
pass in whatever variables you want.

For now, you can certainly build your own RVideo recipe constructor,
which does exactly what you're describing. It should just output a
string, and then pass that string to a RVideo::Transcoder object.
--
Posted via http://www.ruby-....

John Joyce

10/3/2007 3:28:00 PM

0


On Oct 3, 2007, at 9:38 AM, Jon Dahl wrote:

> Ilmari Heikkinen wrote:
>>
>> One API idea:
>> RVideo.transcode("filename.mp4", "filename.avi",
>> :resolution => [640,480],
>> :video_codec => 'xvid',
>> :audio_codec => 'mp3')
>>
>
> Thanks for the suggestion. I'd like to do something like that at some
> point, but I'm not exactly sure how.
>
> I spent quite a bit of time thinking about the best way to define a
> command. The problem is that ffmpeg is extremely complex, and a good
> quality transcoding job often involves more than just resolution,
> codec,
> format, etc. There are literally hundreds of other options that can be
> set that control quality, file size, a/v sync, etc. So I didn't
> want to
> reduce the power of ffmpeg by controlling the options too much.
>
> So I decided for now to just do the simplest thing possible and
> pass in
> a command with variable interpolation. This allows you to store
> recipes
> on your system (in your database, in a yaml config file, etc.), and to
> pass in whatever variables you want.
>
> For now, you can certainly build your own RVideo recipe constructor,
> which does exactly what you're describing. It should just output a
> string, and then pass that string to a RVideo::Transcoder object.
> --
> Posted via http://www.ruby-....
>
Check VLC (video lan client) it's open source and they use ffmpeg.
You might find some ideas in there.