I’ve been playing around with extracting some metadata from videos in Ruby on Rails, particularly using RVideo (an ffmpeg wrapper) and a Mediainfo wrapper I found on github. Initially I was excited about RVideo, because it has some support for transcoding and stuff, but the version I found on the Google code page didn’t work well with my ffmpeg install, and using ffmpeg to get information about a video isn’t the cleanest technique to begin with.
Installing mediainfo on Debian is pretty straightforward.
sudo dpkg -i libzen0_0.4.2-1_i386.Debian_5.deb
sudo dpkg -i libmediainfo0_0.7.16-1_i386.Debian_5.deb
sudo dpkg -i mediainfo_0.7.16-1_i386.Debian_5.deb
sudo gem install greatseth-mediainfo
Then, I added a line to enviroment.rb, right before Initializer.run block:
I think I should be able to use config.gem ‘mediainfo’ or something like that, but I couldn’t get it to work.
Now, I can do something like
@file = Mediainfo.new @video.base_path + @video.public_filename
and something like
to get much needed information.
If you haven’t install a gem from github before, you might need this page: http://gems.github.com/