's Ruby Interface to FFMpeg.
C Ruby
Switch branches/tags
Nothing to show
Latest commit 051c138 Feb 17, 2010 @hackerdude hackerdude Fourcc codes.
Failed to load latest commit information.


Ruby FFMpeg Library

“ffmpeg-ruby” is a ruby gem library (work in progress) that provides bindings allowing you to access the ffmpeg under ruby. FFMpeg is a cross-platform solution to record, convert and stream audio and video. It includes libavcodec - the leading audio/video codec library.

This implementation is starting by doing the translation for some of the functions in libavcodec and libavformat to ruby.

FFMpeg is provided by under the LGPL license.

This bindings gem is graciously provided by under the LGPL license.


$ gem install ffmpeg-ruby

Installation troubleshooting

If you run into trouble, it could be the C bundle not building. This is known to happen on MacOS 64-bit or with the ffmpeg from macports. You basically need to run ruby extconf yourself then.

$ ruby extconf.rb

You may need to add --with on mac, to point it to macports' /opt/local for the libraries.

Mac Notes

Because of the way the library gets built, it needs to match the architecture type of your ruby. You can force it to do this by specifying the +-arch+ flag. For a 64-bit ruby on Snow Leopard:

$ sudo port install ffmpeg
(go have coffee)
$ sudo env ARCHFLAGS="-arch x86_64" gem install ffmpeg-ruby

If your machine is 32 bit, the ARCHFLAGS above should be ++ARCHFLAGS=“-arch i386”+

This will provide you with a bundle you can require.


See the code on test/ for usage. But basically it goes like this:

require 'ffmpeg-ruby'

# Get a list of the video codecs supported FFMpeg::AVCodec.supported_video_codecs

# Get a list of the audio codecs supported FFMpeg::AVCodec.supported_video_codecs

# Create new AVFormatContext f =“/path/to/my/”)

f.codec_contexts.each{ |ctx| puts # The name of the codec this file uses. }