Skip to content

My Projects

Tag: mediainfo

Importing, Uploading, Thumbnailing

Last week was a busy week for me on the programming end of things… sorry about the lack of a blog post!

I decided to temporarily halt work on the video “collection” concept (grouping similiar videos together isn’t as important as the videos themselves!) and focus back on the workflow for uploading a video. I’m happy to say things looks and flow much better now. Let me walk you though what happens.

  1. Visit the Add Video page
  2. Give the video a title
  3. Choose to Upload a file or Import a file on the server. Importing works best for really large files, where it might make sense to ftp or scp them over manually before bringing them into the software.
  4. I use Mediainfo to read some metadata about the video file, like duration, codecs, etc and store those back on the Video model.
  5. Then, I generate 3 thumbnails at the beginning, middle and end of the video. They are also stored in 2 smaller versions (like thumbnail, and preview).
  6. Presto! Upload complete.

The thumbnail functionality is finished, such that you can manually specific a timecode anywhere in the video to generate a new thumbnail.

I have run into a few bumps with really high quality files, the thumbnail generation takes longer than the web-browser is willing to wait so the browser times out. The process continues on in the background, but its still not the cleanest implementation.

Next on my list of things to work on is video conversion.

Oh yea, here are some screenshots of the current interface:

Posted on June 15, 2009November 13, 2010 by Brian Michalski 0

Video Metadata

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.

wget http://downloads.sourceforge.net/zenlib/libzen0_0.4.2-1_i386.Debian_5.deb

wget http://downloads.sourceforge.net/mediainfo/libmediainfo0_0.7.16-1_i386.Debian_5.deb

wget http://downloads.sourceforge.net/mediainfo/mediainfo_0.7.16-1_i386.Debian_5.deb

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:

require ‘mediainfo’

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

@file.height

to get much needed information.

If you haven’t install a gem from github before, you might need this page: http://gems.github.com/

Posted on May 31, 2009November 13, 2010 by Brian Michalski 0
Proudly powered by WordPress ~ Theme: Scrawl by WordPress.com.