Access movies from Ruby


RubyForge Project Page:
Google rmovie discussion group:
API Documentation
Browse Source:
Anonymous SVN:
  1. svn checkout svn://


rmovie is a Ruby extension that adds methods for accessing media files. It can return video frames as images that can be imported by RMagick. This allows automatic creation of thumbnail images from movies. rmovie is also useful for reporting the duration and bitrate of audio files (mp3, wma...). rmovie can access many of the video formats supported by ffmpeg (mov, avi, mpg, wmv...)


11/02/06 - Version 0.5.1 released. New in this release are, support for creating animated GIFs and a gem install.

09/28/06 - New developer added to the project. Peter Brown (aka flippyhead) will be working on fixing the borked test scripts.

08/08/06 - The initial release of rmovie is now available for download.



Only tested on Linux so far. If you get it working on another platform, let me know and I'll update this


gem install rmovie

Testing the Installation



# simple script to open a movie and output frame ten as a jpeg image

require 'rmovie'
require 'RMagick'

mov ="")

frame =  mov.frame(10)

frame_as_string = frame.to_string();

img =, frame.height)

img.import_pixels(0, 0, frame.width, frame.height, "RGB", frame_as_string, Magick::CharPixel)



API Documentation


Q: How come it doesn't work with <myfavoritetype> movies?

A: The rmovie extension uses ffmpeg libraries for access to video info. Some movie types have limited support in ffmpeg. If the movie can't be read correctly by ffmpeg then it won't work with rmovie. Consult the ffmpeg documentation for more info on supported formats. If rmovie won't read a movie, try using the ffmpeg command line program to convert the movie to another type. If it fails, then ffmpeg (and thus rmovie) don't support your movie type. If ffmpeg converts it correctly then the problem is most likely in rmovie, in which case you can bug me about it.

Q: rmovie doesn't do the one freakin' thing I absolutely need! Can you add it to the program?

I am available for hire if you need further development or customization as long as the resulting code is made open source.

Q:This page looks almost exactly like the ffmpeg-php project page, are they related projects?

A: Yes. I wrote the ffmpeg-php extension a few years ago. When I started learning Ruby (Thanks why!), I decided to take a stab at porting ffmpeg-php to Ruby. That stab resulted in rmovie. In the process of porting the code, I factored out much of the lower level stuff so that both projects can share the same core code. The core was released as a separate library called quadrupel. The websites look similar (exactly similar) because I have no design talent and I'm too lazy to come up with a new layout for the rmovie extension. I'm open to any help with a new look for this website.


If you need help using rmovie, sign up for the rmovie google group and post your questions there. If you want to report a bug, please use the RubyForge project page.

Google Groups Subscribe to rmovie
Browse Archives at